Skip to content

Commit

Permalink
Stacked Container Added
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshusharma89 committed Mar 23, 2021
1 parent 8a49072 commit 3bc2a72
Show file tree
Hide file tree
Showing 20 changed files with 57 additions and 64 deletions.
8 changes: 4 additions & 4 deletions lib/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:provider/provider.dart';
import 'package:retro_shopping/views/cart.dart';
import 'package:retro_shopping/views/home.dart';
import 'package:retro_shopping/views/search.dart';
import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/search_view.dart';
import 'helpers/ad_state.dart';
import 'views/profile/profile.dart';
import 'views/profile/profile_view.dart';
import 'widgets/bottom_nav_bar.dart';

class Dashboard extends StatefulWidget {
Expand Down
5 changes: 2 additions & 3 deletions lib/helpers/constants.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/model/product.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/widgets/product/product_card.dart';

// Route Names

class RouteConstant {
static const String SPLASH_SCREEN = '/';
static const String DASHBOARD_SCREEN = '/dashboard';
static const String HOME_SCREEN = '/home';
static const String LOGIN_SCREEN = '/auth';
Expand All @@ -16,7 +15,7 @@ class RouteConstant {
static const String CART_SCREEN = '/cart';
static const String ORDERS_SCREEN = '/orders';
static const String SETTINGS_SCREEN = '/settings';
static const String ABOUT_SCREEN = 'about';
static const String ABOUT_SCREEN = '/about';
}

class RelicColors {
Expand Down
16 changes: 12 additions & 4 deletions lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/helpers/slide_route.dart';

import 'package:retro_shopping/views/cart.dart';
import 'package:retro_shopping/views/home.dart';
import 'package:retro_shopping/views/profile/profile.dart';
import 'package:retro_shopping/views/search.dart';
import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/profile/profile_view.dart';
import 'package:retro_shopping/views/search_view.dart';
import 'package:retro_shopping/widgets/product/product_page.dart';

class RoutePage {
Expand All @@ -21,26 +21,31 @@ class RoutePage {
return SlideLeftRoute(
page: Home(),
);

case RouteConstant.LOGIN_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Login Screen'),
),
);

case RouteConstant.PROFILE_SCREEN:
return SlideLeftRoute(
page: ProfilePage(),
);

case RouteConstant.SEARCH_SCREEN:
return SlideLeftRoute(
page: Search(),
);

case RouteConstant.ABOUT_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('About'),
),
);

case RouteConstant.DASHBOARD_SCREEN:
return SlideLeftRoute(
page: Dashboard(),
Expand All @@ -49,18 +54,21 @@ class RoutePage {
return SlideBottomRoute(
page: ProductPage(),
);

case RouteConstant.WISHLIST_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Wishlist Screen'),
),
);

case RouteConstant.ORDERS_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Orders Screen'),
),
);

case RouteConstant.SETTINGS_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:provider/provider.dart';
import 'package:retro_shopping/helpers/ad_state.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:retro_shopping/views/auth/login.dart';
import 'package:retro_shopping/views/auth/login_view.dart';

Future<void> main() async {
//firebase Initialization
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:retro_shopping/services/auth_service.dart';
import 'package:retro_shopping/views/auth/signup.dart';
import 'package:retro_shopping/views/auth/signup_view.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/widgets/stacked_container.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/views/auth/login.dart';
import 'package:retro_shopping/views/auth/login_view.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/services/auth_service.dart';
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/views/drawer.dart → lib/views/drawer_view.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/services/auth_service.dart';
import 'package:retro_shopping/views/profile/settings/about.dart';
import 'package:retro_shopping/views/auth/login.dart';
import 'package:retro_shopping/views/auth/login_view.dart';
import 'package:retro_shopping/views/profile/orders.dart';
import 'package:retro_shopping/views/profile/wishlist.dart';
import '../widgets/drawer_item.dart';
import 'Wishlist.dart';

class DrawerWidget extends StatelessWidget {
const DrawerWidget({
Expand Down
65 changes: 25 additions & 40 deletions lib/views/home.dart → lib/views/home_view.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/app_icons.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/views/drawer.dart';
import 'package:retro_shopping/views/drawer_view.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/widgets/stacked_container.dart';

class Home extends StatelessWidget {
final GlobalKey<ScaffoldState> _drawerKey = GlobalKey();
Expand Down Expand Up @@ -30,19 +31,19 @@ class Home extends StatelessWidget {
SizedBox(
height: height * 0.01,
),
sizedBox(context),
topBar(context),
SizedBox(
height: height * 0.03,
),
textRead(),
greetingUserText(),
SizedBox(
height: height * 0.02,
),
searchBar(context),
SizedBox(
height: height * 0.02,
),
sized(height, width),
products(height, width),
SizedBox(
height: height * 0.1,
),
Expand All @@ -53,49 +54,33 @@ class Home extends StatelessWidget {
);
}

Widget sized(double height, double width) {
Widget products(double height, double width) {
return SizedBox(
height: height * 1.08,
width: width,
child: Stack(
children: <Widget>[
Container(
width: width * 0.9,
// height: 729.0,
decoration: const BoxDecoration(
color: RelicColors.primaryBlack,
),
child: StackedContainer(
width: width * 0.9,
// height: 729.0,
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(),
primary: false,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
childAspectRatio: 1 / 1.6),
itemCount: productsList.length,
itemBuilder: (_, int index) => productsList[index],
),
Transform.translate(
offset: const Offset(10, 10),
child: Container(
width: width * 0.9,
// height: 729.0,
decoration: const BoxDecoration(
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(),
primary: false,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
childAspectRatio: 1 / 1.6),
itemCount: productsList.length,
itemBuilder: (_, int index) => productsList[index],
),
),
),
),
],
),
),
);
}

Widget sizedBox(BuildContext context) {
Widget topBar(BuildContext context) {
return SizedBox(
width: MediaQuery.of(context).size.width,
child: Row(
Expand Down Expand Up @@ -133,7 +118,7 @@ class Home extends StatelessWidget {
);
}

Widget textRead() {
Widget greetingUserText() {
return const Text.rich(
TextSpan(
style: TextStyle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/payment/order_item.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/views/profile/settings/settings.dart';
import 'package:retro_shopping/views/profile/settings/settings_view.dart';

class ProfilePage extends StatelessWidget {
@override
Expand Down
4 changes: 2 additions & 2 deletions lib/views/profile/settings/address_screen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/model/address.dart';
import 'package:retro_shopping/model/address_model.dart';
import 'package:retro_shopping/views/profile/settings/manage_address.dart';
import 'package:retro_shopping/views/profile/settings/settings.dart';
import 'package:retro_shopping/views/profile/settings/settings_view.dart';
import 'package:retro_shopping/widgets/retro_button.dart';

class AddressScreen extends StatefulWidget {
Expand Down
2 changes: 1 addition & 1 deletion lib/views/profile/settings/manage_address.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:geocoder/geocoder.dart';
import 'package:geolocator/geolocator.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/model/address.dart';
import 'package:retro_shopping/model/address_model.dart';
import 'package:retro_shopping/views/profile/settings/address_screen.dart';
import 'package:retro_shopping/widgets/address_text_field.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/widgets/product/product_card.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/helpers/slide_route.dart';
import 'package:retro_shopping/model/product.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/widgets/product/product_page.dart';

class ProductCard extends StatelessWidget {
Expand Down
5 changes: 3 additions & 2 deletions lib/widgets/stacked_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';

class StackedContainer extends StatelessWidget {
const StackedContainer({Key key, this.height, this.width, this.child})
const StackedContainer({@required this.child, Key key, this.height, this.width, this.color})
: super(key: key);

final double height;
final double width;
final Widget child;
final Color color;

@override
Widget build(BuildContext context) {
Expand All @@ -26,7 +27,7 @@ class StackedContainer extends StatelessWidget {
Container(
height: height,
width: width,
decoration: const BoxDecoration(color: RelicColors.primaryColor),
decoration: BoxDecoration(color: color ?? RelicColors.primaryColor),
child: child),
],
),
Expand Down
2 changes: 1 addition & 1 deletion test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:retro_shopping/helpers/app_icons.dart';

import 'package:retro_shopping/model/product.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/widgets/payment/cart_item.dart';
import 'package:retro_shopping/widgets/payment/order_item.dart';
import 'package:retro_shopping/widgets/product/product_card.dart';
Expand Down

0 comments on commit 3bc2a72

Please sign in to comment.