Tweaks and bug fixes for main.dart
This commit is contained in:
parent
303655f220
commit
05f848b442
@ -31,101 +31,94 @@ import 'package:label_storemax/helpers/app_themes.dart';
|
|||||||
import 'package:label_storemax/helpers/app_localizations.dart';
|
import 'package:label_storemax/helpers/app_localizations.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
Widget _defaultHome = new HomePage();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
await SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
]);
|
||||||
|
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then(
|
runApp(
|
||||||
(_) {
|
new MaterialApp(
|
||||||
_defaultHome = HomePage();
|
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(),
|
||||||
|
},
|
||||||
|
onGenerateRoute: (settings) {
|
||||||
|
switch (settings.name) {
|
||||||
|
case '/home-menu':
|
||||||
|
return PageTransition(
|
||||||
|
child: HomeMenuPage(), type: PageTransitionType.leftToRight);
|
||||||
|
case '/checkout-details':
|
||||||
|
return PageTransition(
|
||||||
|
child: CheckoutDetailsPage(),
|
||||||
|
type: PageTransitionType.downToUp);
|
||||||
|
case '/about':
|
||||||
|
return PageTransition(
|
||||||
|
child: AboutPage(), type: PageTransitionType.leftToRight);
|
||||||
|
|
||||||
runApp(
|
case '/checkout-payment-type':
|
||||||
new MaterialApp(
|
return PageTransition(
|
||||||
title: app_name,
|
child: CheckoutPaymentTypePage(),
|
||||||
|
type: PageTransitionType.downToUp);
|
||||||
|
|
||||||
|
case '/checkout-shipping-type':
|
||||||
|
return PageTransition(
|
||||||
|
child: CheckoutShippingTypePage(),
|
||||||
|
type: PageTransitionType.downToUp);
|
||||||
|
|
||||||
|
case '/home-search':
|
||||||
|
return PageTransition(
|
||||||
|
child: HomeSearchPage(), type: PageTransitionType.downToUp);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
supportedLocales: [Locale('en')],
|
||||||
|
localizationsDelegates: [
|
||||||
|
AppLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate
|
||||||
|
],
|
||||||
|
localeResolutionCallback:
|
||||||
|
(Locale locale, Iterable<Locale> supportedLocales) {
|
||||||
|
return locale;
|
||||||
|
},
|
||||||
|
theme: ThemeData(
|
||||||
|
primaryColor: HexColor("#2f4ffe"),
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
buttonTheme: ButtonThemeData(
|
||||||
|
hoverColor: Colors.transparent,
|
||||||
|
buttonColor: HexColor("#529cda"),
|
||||||
|
colorScheme: colorSchemeButton(),
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 70,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: new BorderRadius.circular(5.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
appBarTheme: AppBarTheme(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
debugShowCheckedModeBanner: false,
|
textTheme: textThemeAppBar(),
|
||||||
routes: <String, WidgetBuilder>{
|
elevation: 0.0,
|
||||||
'/home': (BuildContext context) => new HomePage(),
|
brightness: Brightness.light,
|
||||||
'/cart': (BuildContext context) => new CartPage(),
|
iconTheme: IconThemeData(color: Colors.black),
|
||||||
'/browse-category': (BuildContext context) =>
|
actionsIconTheme: IconThemeData(
|
||||||
new BrowseCategoryPage(),
|
color: Colors.black,
|
||||||
'/product-search': (BuildContext context) =>
|
)),
|
||||||
new BrowseSearchPage(),
|
accentColor: Colors.black,
|
||||||
'/product-detail': (BuildContext context) =>
|
accentTextTheme: textThemeAccent(),
|
||||||
new ProductDetailPage(),
|
textTheme: textThemeMain(),
|
||||||
'/checkout': (BuildContext context) =>
|
primaryTextTheme: textThemePrimary(),
|
||||||
new CheckoutConfirmationPage(),
|
),
|
||||||
'/checkout-status': (BuildContext context) =>
|
),
|
||||||
new CheckoutStatusPage(),
|
|
||||||
},
|
|
||||||
onGenerateRoute: (settings) {
|
|
||||||
switch (settings.name) {
|
|
||||||
case '/home-menu':
|
|
||||||
return PageTransition(
|
|
||||||
child: HomeMenuPage(),
|
|
||||||
type: PageTransitionType.leftToRight);
|
|
||||||
case '/checkout-details':
|
|
||||||
return PageTransition(
|
|
||||||
child: CheckoutDetailsPage(),
|
|
||||||
type: PageTransitionType.downToUp);
|
|
||||||
case '/about':
|
|
||||||
return PageTransition(
|
|
||||||
child: AboutPage(), type: PageTransitionType.leftToRight);
|
|
||||||
|
|
||||||
case '/checkout-payment-type':
|
|
||||||
return PageTransition(
|
|
||||||
child: CheckoutPaymentTypePage(),
|
|
||||||
type: PageTransitionType.downToUp);
|
|
||||||
|
|
||||||
case '/checkout-shipping-type':
|
|
||||||
return PageTransition(
|
|
||||||
child: CheckoutShippingTypePage(),
|
|
||||||
type: PageTransitionType.downToUp);
|
|
||||||
|
|
||||||
case '/home-search':
|
|
||||||
return PageTransition(
|
|
||||||
child: HomeSearchPage(),
|
|
||||||
type: PageTransitionType.downToUp);
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
supportedLocales: [Locale('en')],
|
|
||||||
localizationsDelegates: [
|
|
||||||
AppLocalizations.delegate,
|
|
||||||
GlobalWidgetsLocalizations.delegate,
|
|
||||||
GlobalMaterialLocalizations.delegate
|
|
||||||
],
|
|
||||||
localeResolutionCallback:
|
|
||||||
(Locale locale, Iterable<Locale> supportedLocales) {
|
|
||||||
return locale;
|
|
||||||
},
|
|
||||||
theme: ThemeData(
|
|
||||||
primaryColor: HexColor("#2f4ffe"),
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
buttonTheme: ButtonThemeData(
|
|
||||||
hoverColor: Colors.transparent,
|
|
||||||
buttonColor: HexColor("#529cda"),
|
|
||||||
colorScheme: colorSchemeButton(),
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height: 70,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: new BorderRadius.circular(5.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
appBarTheme: AppBarTheme(
|
|
||||||
color: Colors.white,
|
|
||||||
textTheme: textThemeAppBar(),
|
|
||||||
elevation: 0.0,
|
|
||||||
brightness: Brightness.light,
|
|
||||||
iconTheme: IconThemeData(color: Colors.black),
|
|
||||||
actionsIconTheme: IconThemeData(
|
|
||||||
color: Colors.black,
|
|
||||||
)),
|
|
||||||
accentColor: Colors.black,
|
|
||||||
accentTextTheme: textThemeAccent(),
|
|
||||||
textTheme: textThemeMain(),
|
|
||||||
primaryTextTheme: textThemePrimary()),
|
|
||||||
home: _defaultHome),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user