Tweaks and bug fixes for main.dart

This commit is contained in:
Woosignal 2020-02-10 12:19:53 +00:00 committed by GitHub
parent 303655f220
commit 05f848b442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,37 +31,32 @@ import 'package:label_storemax/helpers/app_themes.dart';
import 'package:label_storemax/helpers/app_localizations.dart';
void main() async {
Widget _defaultHome = new HomePage();
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then(
(_) {
_defaultHome = HomePage();
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
runApp(
new MaterialApp(
title: app_name,
color: Colors.white,
debugShowCheckedModeBanner: false,
initialRoute: "/home",
routes: <String, WidgetBuilder>{
'/home': (BuildContext context) => new HomePage(),
'/cart': (BuildContext context) => new CartPage(),
'/browse-category': (BuildContext context) =>
new BrowseCategoryPage(),
'/product-search': (BuildContext context) =>
new BrowseSearchPage(),
'/product-detail': (BuildContext context) =>
new ProductDetailPage(),
'/checkout': (BuildContext context) =>
new CheckoutConfirmationPage(),
'/checkout-status': (BuildContext context) =>
new CheckoutStatusPage(),
'/browse-category': (BuildContext context) => new BrowseCategoryPage(),
'/product-search': (BuildContext context) => new BrowseSearchPage(),
'/product-detail': (BuildContext context) => new ProductDetailPage(),
'/checkout': (BuildContext context) => new CheckoutConfirmationPage(),
'/checkout-status': (BuildContext context) => new CheckoutStatusPage(),
},
onGenerateRoute: (settings) {
switch (settings.name) {
case '/home-menu':
return PageTransition(
child: HomeMenuPage(),
type: PageTransitionType.leftToRight);
child: HomeMenuPage(), type: PageTransitionType.leftToRight);
case '/checkout-details':
return PageTransition(
child: CheckoutDetailsPage(),
@ -82,8 +77,7 @@ void main() async {
case '/home-search':
return PageTransition(
child: HomeSearchPage(),
type: PageTransitionType.downToUp);
child: HomeSearchPage(), type: PageTransitionType.downToUp);
default:
return null;
}
@ -123,9 +117,8 @@ void main() async {
accentColor: Colors.black,
accentTextTheme: textThemeAccent(),
textTheme: textThemeMain(),
primaryTextTheme: textThemePrimary()),
home: _defaultHome),
);
},
primaryTextTheme: textThemePrimary(),
),
),
);
}