Skip to content

Commit

Permalink
Made the changes Issue #151
Browse files Browse the repository at this point in the history
  • Loading branch information
SapinderSingh committed Mar 24, 2021
1 parent 5b592f2 commit e44022f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
11 changes: 5 additions & 6 deletions lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
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/model/product_model.dart';
import 'package:retro_shopping/views/auth/signup_view.dart';
import 'package:retro_shopping/views/profile/orders.dart';

Expand All @@ -27,10 +28,6 @@ class RoutePage {
return SlideLeftRoute(
page: Cart(),
);
case '/':
return PageRouteBuilder(
pageBuilder: (ctx, firstAni, secondAni) => LoginScreen(),
);
case RouteConstant.HOME_SCREEN:
return SlideLeftRoute(
page: Home(),
Expand Down Expand Up @@ -61,9 +58,11 @@ class RoutePage {
page: Dashboard(),
);
case RouteConstant.PRODUCTS_SCREEN:
Product product = settings.arguments as Product;
return SlideBottomRoute(
settings: settings,
page: ProductPage(),
page: ProductPage(
product: product,
),
);

case RouteConstant.WISHLIST_SCREEN:
Expand Down
7 changes: 2 additions & 5 deletions lib/helpers/slide_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ class SlideTopRoute extends PageRouteBuilder<SlideTopRoute> {
}

class SlideBottomRoute extends PageRouteBuilder<SlideBottomRoute> {
SlideBottomRoute({
this.page,
this.settings,
}) : super(
SlideBottomRoute({this.page})
: super(
pageBuilder: (
BuildContext context,
Animation<double> animation,
Expand All @@ -104,5 +102,4 @@ class SlideBottomRoute extends PageRouteBuilder<SlideBottomRoute> {
),
);
final Widget page;
final RouteSettings settings;
}
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class MyApp extends StatelessWidget {
textTheme:
GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)),
onGenerateRoute: RoutePage.generateRoute,
initialRoute: RouteConstant.DASHBOARD_SCREEN,
),
);
}
Expand Down
5 changes: 1 addition & 4 deletions lib/views/profile/settings/address_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ class _AddressScreenState extends State<AddressScreen> {
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamedAndRemoveUntil(
RouteConstant.SETTINGS_SCREEN,
(Route<dynamic> route) => false,
);
Navigator.of(context).pop();
},
child: RetroButton(
upperColor: Colors.white,
Expand Down
5 changes: 1 addition & 4 deletions lib/views/profile/settings/manage_address.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,7 @@ class _ManageAddressState extends State<ManageAddress> {
});
}
address = finalAddress;
Navigator.of(context).pushNamedAndRemoveUntil(
RouteConstant.ADDRESS_SCREEN,
(Route<dynamic> route) => false,
);
Navigator.of(context).pop();
},
child: const Text(
'Yes',
Expand Down
18 changes: 11 additions & 7 deletions lib/widgets/product/product_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import '../retro_button.dart';

// ignore: must_be_immutable
class ProductPage extends StatefulWidget {
final Product product;

const ProductPage({this.product});

@override
_ProductPageState createState() => _ProductPageState();
}
Expand Down Expand Up @@ -36,7 +40,7 @@ class _ProductPageState extends State<ProductPage> {

@override
Widget build(BuildContext context) {
final Product args = ModalRoute.of(context).settings.arguments as Product;

final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;
return Scaffold(
Expand Down Expand Up @@ -103,7 +107,7 @@ class _ProductPageState extends State<ProductPage> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
for (String s in args.text.split(' '))
for (String s in widget.product.text.split(' '))
Text(
s,
style: const TextStyle(
Expand Down Expand Up @@ -135,7 +139,7 @@ class _ProductPageState extends State<ProductPage> {
],
),
Text(
args.owner,
widget.product.owner,
style: const TextStyle(
fontWeight: FontWeight.bold, color: Colors.white),
),
Expand All @@ -159,7 +163,7 @@ class _ProductPageState extends State<ProductPage> {
fontSize: 11),
),
Text(
args.height.toString(),
widget.product.height.toString(),
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontWeight: FontWeight.bold,
Expand All @@ -180,7 +184,7 @@ class _ProductPageState extends State<ProductPage> {
fontSize: 11),
),
Text(
args.seller,
widget.product.seller,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontWeight: FontWeight.bold,
Expand All @@ -204,7 +208,7 @@ class _ProductPageState extends State<ProductPage> {
borderColor: Colors.white,
child: Center(
child: Text(
args.amount,
widget.product.amount,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: RelicColors.primaryColor,
Expand Down Expand Up @@ -292,7 +296,7 @@ class _ProductPageState extends State<ProductPage> {
Transform.translate(
offset: const Offset(120, -180),
child: Image.asset(
args.image,
widget.product.image,
width: 300,
height: 300,
),
Expand Down

0 comments on commit e44022f

Please sign in to comment.