Skip to content

Commit e44022f

Browse files
committed
Made the changes Issue #151
1 parent 5b592f2 commit e44022f

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

lib/helpers/route_page.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ 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';
56
import 'package:retro_shopping/views/auth/signup_view.dart';
67
import 'package:retro_shopping/views/profile/orders.dart';
78

@@ -27,10 +28,6 @@ class RoutePage {
2728
return SlideLeftRoute(
2829
page: Cart(),
2930
);
30-
case '/':
31-
return PageRouteBuilder(
32-
pageBuilder: (ctx, firstAni, secondAni) => LoginScreen(),
33-
);
3431
case RouteConstant.HOME_SCREEN:
3532
return SlideLeftRoute(
3633
page: Home(),
@@ -61,9 +58,11 @@ class RoutePage {
6158
page: Dashboard(),
6259
);
6360
case RouteConstant.PRODUCTS_SCREEN:
61+
Product product = settings.arguments as Product;
6462
return SlideBottomRoute(
65-
settings: settings,
66-
page: ProductPage(),
63+
page: ProductPage(
64+
product: product,
65+
),
6766
);
6867

6968
case RouteConstant.WISHLIST_SCREEN:

lib/helpers/slide_route.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@ class SlideTopRoute extends PageRouteBuilder<SlideTopRoute> {
7979
}
8080

8181
class SlideBottomRoute extends PageRouteBuilder<SlideBottomRoute> {
82-
SlideBottomRoute({
83-
this.page,
84-
this.settings,
85-
}) : super(
82+
SlideBottomRoute({this.page})
83+
: super(
8684
pageBuilder: (
8785
BuildContext context,
8886
Animation<double> animation,
@@ -104,5 +102,4 @@ class SlideBottomRoute extends PageRouteBuilder<SlideBottomRoute> {
104102
),
105103
);
106104
final Widget page;
107-
final RouteSettings settings;
108105
}

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class MyApp extends StatelessWidget {
5151
textTheme:
5252
GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)),
5353
onGenerateRoute: RoutePage.generateRoute,
54+
initialRoute: RouteConstant.DASHBOARD_SCREEN,
5455
),
5556
);
5657
}

lib/views/profile/settings/address_screen.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ class _AddressScreenState extends State<AddressScreen> {
2020
padding: const EdgeInsets.all(8.0),
2121
child: GestureDetector(
2222
onTap: () {
23-
Navigator.of(context).pushNamedAndRemoveUntil(
24-
RouteConstant.SETTINGS_SCREEN,
25-
(Route<dynamic> route) => false,
26-
);
23+
Navigator.of(context).pop();
2724
},
2825
child: RetroButton(
2926
upperColor: Colors.white,

lib/views/profile/settings/manage_address.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,7 @@ class _ManageAddressState extends State<ManageAddress> {
353353
});
354354
}
355355
address = finalAddress;
356-
Navigator.of(context).pushNamedAndRemoveUntil(
357-
RouteConstant.ADDRESS_SCREEN,
358-
(Route<dynamic> route) => false,
359-
);
356+
Navigator.of(context).pop();
360357
},
361358
child: const Text(
362359
'Yes',

lib/widgets/product/product_page.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import '../retro_button.dart';
99

1010
// ignore: must_be_immutable
1111
class ProductPage extends StatefulWidget {
12+
final Product product;
13+
14+
const ProductPage({this.product});
15+
1216
@override
1317
_ProductPageState createState() => _ProductPageState();
1418
}
@@ -36,7 +40,7 @@ class _ProductPageState extends State<ProductPage> {
3640

3741
@override
3842
Widget build(BuildContext context) {
39-
final Product args = ModalRoute.of(context).settings.arguments as Product;
43+
4044
final double height = MediaQuery.of(context).size.height;
4145
final double width = MediaQuery.of(context).size.width;
4246
return Scaffold(
@@ -103,7 +107,7 @@ class _ProductPageState extends State<ProductPage> {
103107
mainAxisSize: MainAxisSize.min,
104108
crossAxisAlignment: CrossAxisAlignment.start,
105109
children: <Widget>[
106-
for (String s in args.text.split(' '))
110+
for (String s in widget.product.text.split(' '))
107111
Text(
108112
s,
109113
style: const TextStyle(
@@ -135,7 +139,7 @@ class _ProductPageState extends State<ProductPage> {
135139
],
136140
),
137141
Text(
138-
args.owner,
142+
widget.product.owner,
139143
style: const TextStyle(
140144
fontWeight: FontWeight.bold, color: Colors.white),
141145
),
@@ -159,7 +163,7 @@ class _ProductPageState extends State<ProductPage> {
159163
fontSize: 11),
160164
),
161165
Text(
162-
args.height.toString(),
166+
widget.product.height.toString(),
163167
overflow: TextOverflow.ellipsis,
164168
style: const TextStyle(
165169
fontWeight: FontWeight.bold,
@@ -180,7 +184,7 @@ class _ProductPageState extends State<ProductPage> {
180184
fontSize: 11),
181185
),
182186
Text(
183-
args.seller,
187+
widget.product.seller,
184188
overflow: TextOverflow.ellipsis,
185189
style: const TextStyle(
186190
fontWeight: FontWeight.bold,
@@ -204,7 +208,7 @@ class _ProductPageState extends State<ProductPage> {
204208
borderColor: Colors.white,
205209
child: Center(
206210
child: Text(
207-
args.amount,
211+
widget.product.amount,
208212
style: const TextStyle(
209213
fontWeight: FontWeight.bold,
210214
color: RelicColors.primaryColor,
@@ -292,7 +296,7 @@ class _ProductPageState extends State<ProductPage> {
292296
Transform.translate(
293297
offset: const Offset(120, -180),
294298
child: Image.asset(
295-
args.image,
299+
widget.product.image,
296300
width: 300,
297301
height: 300,
298302
),

0 commit comments

Comments
 (0)