Skip to content

Commit 0268e27

Browse files
Merge pull request #154 from SapinderSingh/issue-151
Fixed Issue #151
2 parents 3bc2a72 + e44022f commit 0268e27

18 files changed

+648
-625
lines changed

lib/dashboard.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ class _DashboardState extends State<Dashboard> {
6565
});
6666
},
6767
children: <Widget>[
68-
Home(),
68+
Home(
69+
pageController: _pageController,
70+
),
6971
Search(),
70-
const Cart(),
72+
Cart(
73+
pageController: _pageController,
74+
),
7175
ProfilePage(),
7276
],
7377
),

lib/helpers/constants.dart

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class RouteConstant {
1616
static const String ORDERS_SCREEN = '/orders';
1717
static const String SETTINGS_SCREEN = '/settings';
1818
static const String ABOUT_SCREEN = '/about';
19+
static const String FAQs_SCREEN = '/faqs-screen';
20+
static const String ADDRESS_SCREEN = '/address-screen';
21+
static const String SIGN_UP_SCREEN = '/sign-up-screen';
22+
static const String MANAGE_ADDRESS_SCREEN = '/manage-address-screen';
23+
static const String PAYMENT_SUCCESSFULL = '/payment-successfull';
1924
}
2025

2126
class RelicColors {
@@ -37,44 +42,49 @@ List<ProductCard> productsList = <ProductCard>[
3742
height: 51,
3843
),
3944
),
40-
ProductCard(
45+
ProductCard(
4146
product: Product(
4247
text: 'EDISON TURNTABLE',
4348
owner: 'by Tony Stark',
4449
amount: '₹ 5035',
4550
image: 'assets/items/4.png',
4651
seller: 'SciPedia',
47-
height: 43),),
48-
ProductCard(
52+
height: 43),
53+
),
54+
ProductCard(
4955
product: Product(
5056
text: 'TATUNG EINSTEIN',
5157
owner: 'by Lloyd Duran',
5258
amount: '₹ 4035',
5359
image: 'assets/items/1.png',
5460
seller: 'Diz Arts',
55-
height: 48),),
56-
ProductCard(
61+
height: 48),
62+
),
63+
ProductCard(
5764
product: Product(
5865
text: 'MYRON DISC THROWER',
5966
owner: 'by Lloyd Duran',
6067
amount: '₹ 4035',
6168
image: 'assets/items/2.png',
6269
seller: 'AB Retial',
63-
height: 32),),
64-
ProductCard(
65-
product: Product(
66-
text: 'GUARDIAN CLOCK',
67-
owner: 'by Claudia Davies',
68-
amount: '₹ 4035',
69-
image: 'assets/items/5.png',
70-
seller: 'Electrica',
71-
height: 19),),
72-
ProductCard(
70+
height: 32),
71+
),
72+
ProductCard(
73+
product: Product(
74+
text: 'GUARDIAN CLOCK',
75+
owner: 'by Claudia Davies',
76+
amount: '₹ 4035',
77+
image: 'assets/items/5.png',
78+
seller: 'Electrica',
79+
height: 19),
80+
),
81+
ProductCard(
7382
product: Product(
7483
text: 'ROTATORY DIALER',
7584
owner: 'by Lloyd Duran',
7685
amount: '₹ 4035',
7786
image: 'assets/items/6.png',
7887
seller: 'RS Telecom',
79-
height: 29),),
88+
height: 29),
89+
),
8090
];

lib/helpers/route_page.dart

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,40 @@ import 'package:flutter/cupertino.dart';
22
import 'package:retro_shopping/dashboard.dart';
33
import 'package:retro_shopping/helpers/constants.dart';
44
import 'package:retro_shopping/helpers/slide_route.dart';
5+
import 'package:retro_shopping/model/product_model.dart';
6+
import 'package:retro_shopping/views/auth/signup_view.dart';
7+
import 'package:retro_shopping/views/profile/orders.dart';
8+
9+
import 'package:retro_shopping/views/auth/login_view.dart';
510

611
import 'package:retro_shopping/views/cart_view.dart';
712
import 'package:retro_shopping/views/home_view.dart';
813
import 'package:retro_shopping/views/profile/profile_view.dart';
14+
import 'package:retro_shopping/views/profile/settings/about.dart';
15+
import 'package:retro_shopping/views/profile/settings/address_screen.dart';
16+
import 'package:retro_shopping/views/profile/settings/faqs_screen.dart';
17+
import 'package:retro_shopping/views/profile/settings/manage_address.dart';
18+
import 'package:retro_shopping/views/profile/settings/settings_view.dart';
19+
import 'package:retro_shopping/views/profile/wishlist.dart';
920
import 'package:retro_shopping/views/search_view.dart';
21+
import 'package:retro_shopping/widgets/payment/payment_successful.dart';
1022
import 'package:retro_shopping/widgets/product/product_page.dart';
1123

1224
class RoutePage {
1325
static Route<dynamic> generateRoute(RouteSettings settings) {
1426
switch (settings.name) {
1527
case RouteConstant.CART_SCREEN:
1628
return SlideLeftRoute(
17-
page: const Cart(),
29+
page: Cart(),
1830
);
19-
2031
case RouteConstant.HOME_SCREEN:
2132
return SlideLeftRoute(
2233
page: Home(),
2334
);
2435

2536
case RouteConstant.LOGIN_SCREEN:
2637
return SlideLeftRoute(
27-
page: const SizedBox(
28-
child: Text('Login Screen'),
29-
),
38+
page: LoginScreen(),
3039
);
3140

3241
case RouteConstant.PROFILE_SCREEN:
@@ -41,44 +50,61 @@ class RoutePage {
4150

4251
case RouteConstant.ABOUT_SCREEN:
4352
return SlideLeftRoute(
44-
page: const SizedBox(
45-
child: Text('About'),
46-
),
53+
page: AboutScreen(),
4754
);
4855

4956
case RouteConstant.DASHBOARD_SCREEN:
5057
return SlideLeftRoute(
5158
page: Dashboard(),
5259
);
5360
case RouteConstant.PRODUCTS_SCREEN:
61+
Product product = settings.arguments as Product;
5462
return SlideBottomRoute(
55-
page: ProductPage(),
63+
page: ProductPage(
64+
product: product,
65+
),
5666
);
5767

5868
case RouteConstant.WISHLIST_SCREEN:
5969
return SlideLeftRoute(
60-
page: const SizedBox(
61-
child: Text('Wishlist Screen'),
62-
),
70+
page: const Wishlist(),
71+
);
72+
case RouteConstant.MANAGE_ADDRESS_SCREEN:
73+
return SlideLeftRoute(
74+
page: ManageAddress(),
6375
);
6476

6577
case RouteConstant.ORDERS_SCREEN:
6678
return SlideLeftRoute(
67-
page: const SizedBox(
68-
child: Text('Orders Screen'),
69-
),
79+
page: Order(),
7080
);
71-
81+
7282
case RouteConstant.SETTINGS_SCREEN:
7383
return SlideLeftRoute(
74-
page: const SizedBox(
75-
child: Text('Settings Screen'),
76-
),
84+
page: Settings(),
85+
);
86+
case RouteConstant.PAYMENT_SUCCESSFULL:
87+
return SlideLeftRoute(
88+
page: const PaymentSuccessful(),
89+
);
90+
case RouteConstant.FAQs_SCREEN:
91+
return SlideLeftRoute(
92+
page: FaqsScreen(),
93+
);
94+
case RouteConstant.ADDRESS_SCREEN:
95+
return SlideLeftRoute(
96+
page: AddressScreen(),
97+
);
98+
case RouteConstant.SIGN_UP_SCREEN:
99+
return SlideLeftRoute(
100+
page: SignUpScreen(),
77101
);
78102
//TODO: Needs to have a separate screen for this
79103
default:
80104
return PageRouteBuilder<dynamic>(
81-
pageBuilder: (_, Animation<double> firstAni, Animation<double> secondAni) => const SizedBox(
105+
pageBuilder:
106+
(_, Animation<double> firstAni, Animation<double> secondAni) =>
107+
const SizedBox(
82108
child: Text('Nothing'),
83109
),
84110
);

lib/main.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:provider/provider.dart';
55
import 'package:retro_shopping/helpers/ad_state.dart';
66
import 'package:retro_shopping/helpers/constants.dart';
77
import 'package:google_mobile_ads/google_mobile_ads.dart';
8-
import 'package:retro_shopping/views/auth/login_view.dart';
8+
import 'package:retro_shopping/helpers/route_page.dart';
99

1010
Future<void> main() async {
1111
//firebase Initialization
@@ -50,10 +50,8 @@ class MyApp extends StatelessWidget {
5050
visualDensity: VisualDensity.adaptivePlatformDensity,
5151
textTheme:
5252
GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)),
53-
routes: <String, WidgetBuilder>{
54-
'/login': (BuildContext context) => LoginScreen(),
55-
},
56-
home: LoginScreen(),
53+
onGenerateRoute: RoutePage.generateRoute,
54+
initialRoute: RouteConstant.DASHBOARD_SCREEN,
5755
),
5856
);
5957
}

lib/views/auth/login_view.dart

Lines changed: 38 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
3+
import 'package:retro_shopping/helpers/constants.dart';
34
import 'package:retro_shopping/services/auth_service.dart';
4-
import 'package:retro_shopping/views/auth/signup_view.dart';
55
import 'package:retro_shopping/widgets/retro_button.dart';
6-
import 'package:retro_shopping/dashboard.dart';
76
import 'package:retro_shopping/widgets/stacked_container.dart';
87

98
class LoginScreen extends StatefulWidget {
@@ -76,37 +75,38 @@ class LoginScreenState extends State<LoginScreen> {
7675
height: height * 0.020,
7776
),
7877
Stack(
79-
// ignore: always_specify_types
80-
children: [
81-
Transform.translate(
82-
offset: const Offset(25, 10),
83-
child: Container(
84-
color: Colors.black,
85-
width: width * 0.77,
86-
height: height * 0.065,
87-
),
78+
// ignore: always_specify_types
79+
children: [
80+
Transform.translate(
81+
offset: const Offset(25, 10),
82+
child: Container(
83+
color: Colors.black,
84+
width: width * 0.77,
85+
height: height * 0.065,
8886
),
89-
Padding(
90-
padding: const EdgeInsets.only(
91-
left: 20.0, right: 20.0),
92-
// ignore: sized_box_for_whitespace
93-
child: Container(
94-
height: height * 0.07,
95-
child: TextField(
96-
controller: _emailController,
97-
decoration: const InputDecoration(
98-
labelText: 'Email Address',
99-
labelStyle: TextStyle(
100-
fontSize: 20.0,
101-
color: Colors.black),
102-
filled: true,
103-
fillColor: Colors.white,
104-
border: OutlineInputBorder(
105-
borderRadius:
106-
BorderRadius.zero))),
87+
),
88+
Padding(
89+
padding: const EdgeInsets.only(
90+
left: 20.0, right: 20.0),
91+
// ignore: sized_box_for_whitespace
92+
child: Container(
93+
height: height * 0.07,
94+
child: TextField(
95+
controller: _emailController,
96+
decoration: const InputDecoration(
97+
labelText: 'Email Address',
98+
labelStyle: TextStyle(
99+
fontSize: 20.0, color: Colors.black),
100+
filled: true,
101+
fillColor: Colors.white,
102+
border: OutlineInputBorder(
103+
borderRadius: BorderRadius.zero),
104+
),
107105
),
108106
),
109-
]),
107+
),
108+
],
109+
),
110110
SizedBox(
111111
height: height * 0.030,
112112
),
@@ -155,10 +155,9 @@ class LoginScreenState extends State<LoginScreen> {
155155
onTap: () {
156156
debugPrint('Login!');
157157
// ignore: always_specify_types
158-
Navigator.push(context, MaterialPageRoute(
159-
builder: (BuildContext context) {
160-
return Dashboard();
161-
}));
158+
Navigator.of(context).pushNamed(
159+
RouteConstant.DASHBOARD_SCREEN,
160+
);
162161
},
163162
child: RetroButton(
164163
upperColor: Colors.black,
@@ -196,13 +195,9 @@ class LoginScreenState extends State<LoginScreen> {
196195
.then(
197196
(String result) {
198197
if (result != null) {
199-
Navigator.of(context).pushReplacement(
200-
// ignore: always_specify_types
201-
MaterialPageRoute(
202-
builder: (BuildContext context) {
203-
return Dashboard();
204-
},
205-
),
198+
Navigator.of(context)
199+
.pushReplacementNamed(
200+
RouteConstant.DASHBOARD_SCREEN,
206201
);
207202
}
208203
},
@@ -242,12 +237,8 @@ class LoginScreenState extends State<LoginScreen> {
242237
InkWell(
243238
onTap: () {
244239
// ignore: always_specify_types
245-
Navigator.pushReplacement(context,
246-
MaterialPageRoute<dynamic>(
247-
builder: (BuildContext context) {
248-
debugPrint('Navigate to sign up page');
249-
return SignUpScreen();
250-
}));
240+
Navigator.of(context)
241+
.pushNamed(RouteConstant.SIGN_UP_SCREEN);
251242
},
252243
child: const Text(
253244
'SignUp',

0 commit comments

Comments
 (0)