diff --git a/lib/main.dart b/lib/main.dart index 98ec30b6..cd44b226 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -49,6 +49,7 @@ import 'package:huixiang/setting/about_page.dart'; import 'package:huixiang/setting/account_security_page.dart'; import 'package:huixiang/setting/binding_phone_page.dart'; import 'package:huixiang/setting/help_feedback_page.dart'; +import 'package:huixiang/setting/loading_page.dart'; import 'package:huixiang/setting/logout_ing.dart'; import 'package:huixiang/setting/logout_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; @@ -138,8 +139,8 @@ void main() async { if (sharedPreferences.containsKey("language") && sharedPreferences.getString("language") == "tw") { locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); - } else if(sharedPreferences.containsKey("language") && - sharedPreferences.getString("language") == "ch"){ + } else if (sharedPreferences.containsKey("language") && + sharedPreferences.getString("language") == "ch") { locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); } ImgCachePath(); @@ -154,11 +155,10 @@ void main() async { // final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); - - EventBus eventBus = EventBus(sync: true); Route lastRoutePage; + class MyApp extends StatelessWidget { final Locale appLocale; final bool isFirst; @@ -167,6 +167,18 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + EasyLoading.instance + ..indicatorWidget = Image.asset( + "assets/gif/loading_logo.gif", + width: 150, + height: 150, + ) + ..loadingStyle = EasyLoadingStyle.custom + ..progressColor = Colors.black + ..backgroundColor = Colors.transparent + ..indicatorColor = Colors.black + ..textColor = Colors.black + ..boxShadow = []; return MediaQuery( data: const MediaQueryData( size: Size(375, 812), @@ -175,7 +187,9 @@ class MyApp extends StatelessWidget { designSize: Size(375, 812), builder: () => MaterialApp( debugShowCheckedModeBanner: false, - title: Platform.isAndroid ? (ExamineInstance.instance.isExamine?"一心回乡":""):"", + title: Platform.isAndroid + ? (ExamineInstance.instance.isExamine ? "一心回乡" : "") + : "", theme: ThemeData( primarySwatch: Colors.blue, // fontFamily: 'JDZhengHT', @@ -201,11 +215,14 @@ class MyApp extends StatelessWidget { print("locale: ${locales[0]}"); Locale locale; if (locales[0].countryCode == "TW") { - locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); - } else if (locales[0].countryCode == "US"){ - locale = Locale.fromSubtags(languageCode: 'en', countryCode: 'US'); - } else{ - locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); + locale = + Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); + } else if (locales[0].countryCode == "US") { + locale = + Locale.fromSubtags(languageCode: 'en', countryCode: 'US'); + } else { + locale = + Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); } return appLocale ?? locale; }, @@ -225,11 +242,10 @@ class MyApp extends StatelessWidget { ), onGenerateRoute: (settings) { final String name = settings.name; - if(lastRoutePage?.settings?.name == name){ - if(lastRoutePage?.settings?.name == "/router/personal_page" - && lastRoutePage.navigator != null) + if (lastRoutePage?.settings?.name == name) { + if (lastRoutePage?.settings?.name == "/router/personal_page" && + lastRoutePage.navigator != null) lastRoutePage.navigator.pop(); - } final Function pageContentBuilder = routers[name]; if (pageContentBuilder != null) { @@ -280,7 +296,7 @@ Map routers = { '/router/order_history_page': (context, {arguments}) => OrderHistoryPage(arguments: arguments), '/router/bargain_group_order': (context, {arguments}) => - BargainGroupOrder(arguments:arguments), + BargainGroupOrder(arguments: arguments), '/router/union_detail_page': (context, {arguments}) => UnionDetailsPage(arguments: arguments), '/router/address_edit_page': (context, {arguments}) => @@ -301,7 +317,7 @@ Map routers = { '/router/shopping_goods_details': (context, {arguments}) => ShoppingGoodsDetails(arguments: arguments), '/router/search_page': (context, {arguments}) => - SearchPage(arguments:arguments), + SearchPage(arguments: arguments), '/router/vip_balance': (context, {arguments}) => VipBalancePage(arguments: arguments), '/router/exchange_order_details': (context, {arguments}) => @@ -311,7 +327,7 @@ Map routers = { '/router/settlement': (context, {arguments}) => Settlement(arguments: arguments), '/router/integral_detailed_page': (context, {arguments}) => - IntegralDetailedPage(arguments:arguments), + IntegralDetailedPage(arguments: arguments), '/router/write_off_success_page': (context, {arguments}) => WriteOffSuccessPage(), '/router/exchange_history_page': (context, {arguments}) => @@ -323,15 +339,20 @@ Map routers = { '/router/new_login_page': (context, {arguments}) => NewLoginPage(arguments: arguments), '/router/edit_name': (context, {arguments}) => EditName(arguments: arguments), - '/router/edit_signature': (context, {arguments}) => EditSignature(arguments: arguments), + '/router/edit_signature': (context, {arguments}) => + EditSignature(arguments: arguments), '/router/mine_card_invalid': (context, {arguments}) => MineCardInvalidPage(), - '/router/store_selector_page': (context, {arguments}) => StoreSelectorPage(arguments: arguments,), + '/router/store_selector_page': (context, {arguments}) => StoreSelectorPage( + arguments: arguments, + ), '/router/web_page': (context, {arguments}) => WebPage(arguments: arguments), - '/router/web_turntable_activity': (context, {arguments}) => WebTurntableActivity(), + '/router/web_turntable_activity': (context, {arguments}) => + WebTurntableActivity(), '/router/help_feedback_page': (context, {arguments}) => HelpFeedbackPage(), '/router/founder_story_page': (context, {arguments}) => FounderStoryPage(), '/router/system_msg_page': (context, {arguments}) => SystemMessagePage(), - '/router/edit_remarks_page': (context, {arguments}) => EditRemarksPage(arguments: arguments), + '/router/edit_remarks_page': (context, {arguments}) => + EditRemarksPage(arguments: arguments), // '/router/hot_article_page': (context, {arguments}) => HotArticlePage(), '/router/address_map_page': (context, {arguments}) => AddressMapPage(), '/router/roll_center_page': (context, {arguments}) => RollCenterPage(), @@ -357,7 +378,8 @@ Map routers = { '/router/main_page': (context, {arguments}) => MainPage(arguments: arguments), '/router/start_page': (context, {arguments}) => StartPage(), '/router/test_page': (context, {arguments}) => TestPage(), - '/router/communityFollow': (context, {arguments}) => CommunityFollow(arguments:arguments), + '/router/communityFollow': (context, {arguments}) => + CommunityFollow(arguments: arguments), '/router/releasePage': (context, {arguments}) => ReleasePage(), '/router/activity_list': (context, {arguments}) => ActivityList(), '/router/class_details': (context, {arguments}) => @@ -367,77 +389,61 @@ Map routers = { '/router/headlines_column_details': (context, {arguments}) => HeadlinesColumnDetails(arguments: arguments), '/router/group_details': (context, {arguments}) => - GroupDetails(arguments:arguments), + GroupDetails(arguments: arguments), '/router/bargain_details': (context, {arguments}) => - BargainDetails(arguments:arguments), + BargainDetails(arguments: arguments), '/router/group_page_details': (context, {arguments}) => - GroupPageDetails(arguments:arguments), + GroupPageDetails(arguments: arguments), '/router/photo_view_gallery_screen': (context, {arguments}) => PhotoViewGalleryScreen(), '/router/system_details': (context, {arguments}) => SystemDetails(arguments: arguments), - '/router/invitation_record': (context, {arguments}) => - InvitationRecord(), + '/router/invitation_record': (context, {arguments}) => InvitationRecord(), '/router/personal_page': (context, {arguments}) => - PersonalPage(arguments:arguments), + PersonalPage(arguments: arguments), '/router/report_page': (context, {arguments}) => - ReportPage(arguments:arguments), - '/router/report_notice': (context, {arguments}) => - ReportNotice(), - '/router/report_success': (context, {arguments}) => - ReportSuccess(), - '/router/logout_page': (context, {arguments}) => - LogoutPage(), - '/router/logout_ing': (context, {arguments}) => - LogoutIng(), - '/router/user_service_page': (context, {arguments}) => - UserServicePage(), - '/router/welfare_page': (context, {arguments}) => - WelfarePage(), - '/router/invite_friends': (context, {arguments}) => - InviteFriends(), - '/router/report_assess': (context, {arguments}) => - ReportAssess(), - '/router/shop_details_page': (context, {arguments}) => - ShopDetailsPage(arguments: arguments,), - '/router/mine_greenery': (context, {arguments}) => - MineGreenery(), - '/router/mine_shop_page': (context, {arguments}) => - MineShopPage(), - '/router/mine_shop_details': (context, {arguments}) => - MineShopDetails(arguments:arguments,), - '/router/coupon_page': (context, {arguments}) => - CouponPage(), - '/router/welfare_exchange': (context, {arguments}) => - WelfareExchange(), + ReportPage(arguments: arguments), + '/router/report_notice': (context, {arguments}) => ReportNotice(), + '/router/report_success': (context, {arguments}) => ReportSuccess(), + '/router/logout_page': (context, {arguments}) => LogoutPage(), + '/router/logout_ing': (context, {arguments}) => LogoutIng(), + '/router/user_service_page': (context, {arguments}) => UserServicePage(), + '/router/welfare_page': (context, {arguments}) => WelfarePage(), + '/router/invite_friends': (context, {arguments}) => InviteFriends(), + '/router/report_assess': (context, {arguments}) => ReportAssess(), + '/router/shop_details_page': (context, {arguments}) => ShopDetailsPage( + arguments: arguments, + ), + '/router/mine_greenery': (context, {arguments}) => MineGreenery(), + '/router/mine_shop_page': (context, {arguments}) => MineShopPage(), + '/router/mine_shop_details': (context, {arguments}) => MineShopDetails( + arguments: arguments, + ), + '/router/coupon_page': (context, {arguments}) => CouponPage(), + '/router/welfare_exchange': (context, {arguments}) => WelfareExchange(), '/router/account_security_page': (context, {arguments}) => AccountSecurityPage(), '/router/platform_code_page': (context, {arguments}) => - PlatformCodePage(arguments:arguments), + PlatformCodePage(arguments: arguments), '/router/platform_pay_code': (context, {arguments}) => - PlatformPayCode(arguments:arguments), + PlatformPayCode(arguments: arguments), '/router/platform_pay_code_success': (context, {arguments}) => - PlatformPayCodeSuccess(arguments:arguments), - '/router/phone_address_page': (context, {arguments}) => - PhoneAddressPage(), + PlatformPayCodeSuccess(arguments: arguments), + '/router/phone_address_page': (context, {arguments}) => PhoneAddressPage(), '/router/product_meals_sku': (context, {arguments}) => - ProductMealsSku(arguments:arguments), + ProductMealsSku(arguments: arguments), '/router/user_vip_service_page': (context, {arguments}) => UserVipServicePage(), - '/router/help_farmers_page': (context, {arguments}) => - HelpFarmersPage(), - '/router/scan_web': (context, {arguments}) => - ScanWeb(arguments:arguments), - '/router/vip_pay_code': (context, {arguments}) => - VipPayCode(), - '/router/system_notice': (context, {arguments}) => - SystemNotice(), + '/router/help_farmers_page': (context, {arguments}) => HelpFarmersPage(), + '/router/scan_web': (context, {arguments}) => ScanWeb(arguments: arguments), + '/router/vip_pay_code': (context, {arguments}) => VipPayCode(), + '/router/system_notice': (context, {arguments}) => SystemNotice(), '/router/store_html': (context, {arguments}) => - StoreHtml(arguments:arguments), + StoreHtml(arguments: arguments), '/router/login_store_select': (context, {arguments}) => - LoginStoreSelect(arguments:arguments), + LoginStoreSelect(arguments: arguments), '/router/binding_phone_page': (context, {arguments}) => - BindingPhonePage(arguments:arguments), - '/router/trading_card_page': (context, {arguments}) => - TradingCardPage(), + BindingPhonePage(arguments: arguments), + '/router/trading_card_page': (context, {arguments}) => TradingCardPage(), + '/router/loading_page': (context, {arguments}) => LoadingPage(), }; diff --git a/lib/main_page.dart b/lib/main_page.dart index a0fc31bd..ce705774 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -101,17 +101,6 @@ class _MainPage extends State with WidgetsBindingObserver { if (widget.arguments != null && widget.arguments["index"] != null) clickIndex = widget.arguments["index"]; WidgetsBinding.instance.addObserver(this); - EasyLoading.instance - ..indicatorType = EasyLoadingIndicatorType.circle - // ..indicatorType = EasyLoadingIndicatorType.wave - // ..indicatorType = EasyLoadingIndicatorType.threeBounce - ..loadingStyle = EasyLoadingStyle.dark - ..indicatorSize = 35.0 - ..backgroundColor = Colors.white - ..progressColor = Colors.green - ..progressWidth = 3.0 - ..userInteractions = false - ..dismissOnTap = false; initSdk(); UmengCommonSdk.initCommon('6491509087568a379b5a1345', '6491509087568a379b5a1345', 'Umeng');