Browse Source

loading更改

new_revision_app
wurong 1 year ago
parent
commit
b483be8dfc
  1. 158
      lib/main.dart
  2. 11
      lib/main_page.dart

158
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/account_security_page.dart';
import 'package:huixiang/setting/binding_phone_page.dart'; import 'package:huixiang/setting/binding_phone_page.dart';
import 'package:huixiang/setting/help_feedback_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_ing.dart';
import 'package:huixiang/setting/logout_page.dart'; import 'package:huixiang/setting/logout_page.dart';
import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart';
@ -138,8 +139,8 @@ void main() async {
if (sharedPreferences.containsKey("language") && if (sharedPreferences.containsKey("language") &&
sharedPreferences.getString("language") == "tw") { sharedPreferences.getString("language") == "tw") {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
} else if(sharedPreferences.containsKey("language") && } else if (sharedPreferences.containsKey("language") &&
sharedPreferences.getString("language") == "ch"){ sharedPreferences.getString("language") == "ch") {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH');
} }
ImgCachePath(); ImgCachePath();
@ -154,11 +155,10 @@ void main() async {
// final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); // final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin();
EventBus eventBus = EventBus(sync: true); EventBus eventBus = EventBus(sync: true);
Route lastRoutePage; Route lastRoutePage;
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
final Locale appLocale; final Locale appLocale;
final bool isFirst; final bool isFirst;
@ -167,6 +167,18 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { 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( return MediaQuery(
data: const MediaQueryData( data: const MediaQueryData(
size: Size(375, 812), size: Size(375, 812),
@ -175,7 +187,9 @@ class MyApp extends StatelessWidget {
designSize: Size(375, 812), designSize: Size(375, 812),
builder: () => MaterialApp( builder: () => MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: Platform.isAndroid ? (ExamineInstance.instance.isExamine?"一心回乡":""):"", title: Platform.isAndroid
? (ExamineInstance.instance.isExamine ? "一心回乡" : "")
: "",
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
// fontFamily: 'JDZhengHT', // fontFamily: 'JDZhengHT',
@ -201,11 +215,14 @@ class MyApp extends StatelessWidget {
print("locale: ${locales[0]}"); print("locale: ${locales[0]}");
Locale locale; Locale locale;
if (locales[0].countryCode == "TW") { if (locales[0].countryCode == "TW") {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); locale =
} else if (locales[0].countryCode == "US"){ Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
locale = Locale.fromSubtags(languageCode: 'en', countryCode: 'US'); } else if (locales[0].countryCode == "US") {
} else{ locale =
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); Locale.fromSubtags(languageCode: 'en', countryCode: 'US');
} else {
locale =
Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH');
} }
return appLocale ?? locale; return appLocale ?? locale;
}, },
@ -225,11 +242,10 @@ class MyApp extends StatelessWidget {
), ),
onGenerateRoute: (settings) { onGenerateRoute: (settings) {
final String name = settings.name; final String name = settings.name;
if(lastRoutePage?.settings?.name == name){ if (lastRoutePage?.settings?.name == name) {
if(lastRoutePage?.settings?.name == "/router/personal_page" if (lastRoutePage?.settings?.name == "/router/personal_page" &&
&& lastRoutePage.navigator != null) lastRoutePage.navigator != null)
lastRoutePage.navigator.pop(); lastRoutePage.navigator.pop();
} }
final Function pageContentBuilder = routers[name]; final Function pageContentBuilder = routers[name];
if (pageContentBuilder != null) { if (pageContentBuilder != null) {
@ -280,7 +296,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/order_history_page': (context, {arguments}) => '/router/order_history_page': (context, {arguments}) =>
OrderHistoryPage(arguments: arguments), OrderHistoryPage(arguments: arguments),
'/router/bargain_group_order': (context, {arguments}) => '/router/bargain_group_order': (context, {arguments}) =>
BargainGroupOrder(arguments:arguments), BargainGroupOrder(arguments: arguments),
'/router/union_detail_page': (context, {arguments}) => '/router/union_detail_page': (context, {arguments}) =>
UnionDetailsPage(arguments: arguments), UnionDetailsPage(arguments: arguments),
'/router/address_edit_page': (context, {arguments}) => '/router/address_edit_page': (context, {arguments}) =>
@ -301,7 +317,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/shopping_goods_details': (context, {arguments}) => '/router/shopping_goods_details': (context, {arguments}) =>
ShoppingGoodsDetails(arguments: arguments), ShoppingGoodsDetails(arguments: arguments),
'/router/search_page': (context, {arguments}) => '/router/search_page': (context, {arguments}) =>
SearchPage(arguments:arguments), SearchPage(arguments: arguments),
'/router/vip_balance': (context, {arguments}) => '/router/vip_balance': (context, {arguments}) =>
VipBalancePage(arguments: arguments), VipBalancePage(arguments: arguments),
'/router/exchange_order_details': (context, {arguments}) => '/router/exchange_order_details': (context, {arguments}) =>
@ -311,7 +327,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/settlement': (context, {arguments}) => '/router/settlement': (context, {arguments}) =>
Settlement(arguments: arguments), Settlement(arguments: arguments),
'/router/integral_detailed_page': (context, {arguments}) => '/router/integral_detailed_page': (context, {arguments}) =>
IntegralDetailedPage(arguments:arguments), IntegralDetailedPage(arguments: arguments),
'/router/write_off_success_page': (context, {arguments}) => '/router/write_off_success_page': (context, {arguments}) =>
WriteOffSuccessPage(), WriteOffSuccessPage(),
'/router/exchange_history_page': (context, {arguments}) => '/router/exchange_history_page': (context, {arguments}) =>
@ -323,15 +339,20 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/new_login_page': (context, {arguments}) => '/router/new_login_page': (context, {arguments}) =>
NewLoginPage(arguments: arguments), NewLoginPage(arguments: arguments),
'/router/edit_name': (context, {arguments}) => EditName(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/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_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/help_feedback_page': (context, {arguments}) => HelpFeedbackPage(),
'/router/founder_story_page': (context, {arguments}) => FounderStoryPage(), '/router/founder_story_page': (context, {arguments}) => FounderStoryPage(),
'/router/system_msg_page': (context, {arguments}) => SystemMessagePage(), '/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/hot_article_page': (context, {arguments}) => HotArticlePage(),
'/router/address_map_page': (context, {arguments}) => AddressMapPage(), '/router/address_map_page': (context, {arguments}) => AddressMapPage(),
'/router/roll_center_page': (context, {arguments}) => RollCenterPage(), '/router/roll_center_page': (context, {arguments}) => RollCenterPage(),
@ -357,7 +378,8 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/main_page': (context, {arguments}) => MainPage(arguments: arguments), '/router/main_page': (context, {arguments}) => MainPage(arguments: arguments),
'/router/start_page': (context, {arguments}) => StartPage(), '/router/start_page': (context, {arguments}) => StartPage(),
'/router/test_page': (context, {arguments}) => TestPage(), '/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/releasePage': (context, {arguments}) => ReleasePage(),
'/router/activity_list': (context, {arguments}) => ActivityList(), '/router/activity_list': (context, {arguments}) => ActivityList(),
'/router/class_details': (context, {arguments}) => '/router/class_details': (context, {arguments}) =>
@ -367,77 +389,61 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/headlines_column_details': (context, {arguments}) => '/router/headlines_column_details': (context, {arguments}) =>
HeadlinesColumnDetails(arguments: arguments), HeadlinesColumnDetails(arguments: arguments),
'/router/group_details': (context, {arguments}) => '/router/group_details': (context, {arguments}) =>
GroupDetails(arguments:arguments), GroupDetails(arguments: arguments),
'/router/bargain_details': (context, {arguments}) => '/router/bargain_details': (context, {arguments}) =>
BargainDetails(arguments:arguments), BargainDetails(arguments: arguments),
'/router/group_page_details': (context, {arguments}) => '/router/group_page_details': (context, {arguments}) =>
GroupPageDetails(arguments:arguments), GroupPageDetails(arguments: arguments),
'/router/photo_view_gallery_screen': (context, {arguments}) => '/router/photo_view_gallery_screen': (context, {arguments}) =>
PhotoViewGalleryScreen(), PhotoViewGalleryScreen(),
'/router/system_details': (context, {arguments}) => '/router/system_details': (context, {arguments}) =>
SystemDetails(arguments: arguments), SystemDetails(arguments: arguments),
'/router/invitation_record': (context, {arguments}) => '/router/invitation_record': (context, {arguments}) => InvitationRecord(),
InvitationRecord(),
'/router/personal_page': (context, {arguments}) => '/router/personal_page': (context, {arguments}) =>
PersonalPage(arguments:arguments), PersonalPage(arguments: arguments),
'/router/report_page': (context, {arguments}) => '/router/report_page': (context, {arguments}) =>
ReportPage(arguments:arguments), ReportPage(arguments: arguments),
'/router/report_notice': (context, {arguments}) => '/router/report_notice': (context, {arguments}) => ReportNotice(),
ReportNotice(), '/router/report_success': (context, {arguments}) => ReportSuccess(),
'/router/report_success': (context, {arguments}) => '/router/logout_page': (context, {arguments}) => LogoutPage(),
ReportSuccess(), '/router/logout_ing': (context, {arguments}) => LogoutIng(),
'/router/logout_page': (context, {arguments}) => '/router/user_service_page': (context, {arguments}) => UserServicePage(),
LogoutPage(), '/router/welfare_page': (context, {arguments}) => WelfarePage(),
'/router/logout_ing': (context, {arguments}) => '/router/invite_friends': (context, {arguments}) => InviteFriends(),
LogoutIng(), '/router/report_assess': (context, {arguments}) => ReportAssess(),
'/router/user_service_page': (context, {arguments}) => '/router/shop_details_page': (context, {arguments}) => ShopDetailsPage(
UserServicePage(), arguments: arguments,
'/router/welfare_page': (context, {arguments}) => ),
WelfarePage(), '/router/mine_greenery': (context, {arguments}) => MineGreenery(),
'/router/invite_friends': (context, {arguments}) => '/router/mine_shop_page': (context, {arguments}) => MineShopPage(),
InviteFriends(), '/router/mine_shop_details': (context, {arguments}) => MineShopDetails(
'/router/report_assess': (context, {arguments}) => arguments: arguments,
ReportAssess(), ),
'/router/shop_details_page': (context, {arguments}) => '/router/coupon_page': (context, {arguments}) => CouponPage(),
ShopDetailsPage(arguments: arguments,), '/router/welfare_exchange': (context, {arguments}) => WelfareExchange(),
'/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}) => '/router/account_security_page': (context, {arguments}) =>
AccountSecurityPage(), AccountSecurityPage(),
'/router/platform_code_page': (context, {arguments}) => '/router/platform_code_page': (context, {arguments}) =>
PlatformCodePage(arguments:arguments), PlatformCodePage(arguments: arguments),
'/router/platform_pay_code': (context, {arguments}) => '/router/platform_pay_code': (context, {arguments}) =>
PlatformPayCode(arguments:arguments), PlatformPayCode(arguments: arguments),
'/router/platform_pay_code_success': (context, {arguments}) => '/router/platform_pay_code_success': (context, {arguments}) =>
PlatformPayCodeSuccess(arguments:arguments), PlatformPayCodeSuccess(arguments: arguments),
'/router/phone_address_page': (context, {arguments}) => '/router/phone_address_page': (context, {arguments}) => PhoneAddressPage(),
PhoneAddressPage(),
'/router/product_meals_sku': (context, {arguments}) => '/router/product_meals_sku': (context, {arguments}) =>
ProductMealsSku(arguments:arguments), ProductMealsSku(arguments: arguments),
'/router/user_vip_service_page': (context, {arguments}) => '/router/user_vip_service_page': (context, {arguments}) =>
UserVipServicePage(), UserVipServicePage(),
'/router/help_farmers_page': (context, {arguments}) => '/router/help_farmers_page': (context, {arguments}) => HelpFarmersPage(),
HelpFarmersPage(), '/router/scan_web': (context, {arguments}) => ScanWeb(arguments: arguments),
'/router/scan_web': (context, {arguments}) => '/router/vip_pay_code': (context, {arguments}) => VipPayCode(),
ScanWeb(arguments:arguments), '/router/system_notice': (context, {arguments}) => SystemNotice(),
'/router/vip_pay_code': (context, {arguments}) =>
VipPayCode(),
'/router/system_notice': (context, {arguments}) =>
SystemNotice(),
'/router/store_html': (context, {arguments}) => '/router/store_html': (context, {arguments}) =>
StoreHtml(arguments:arguments), StoreHtml(arguments: arguments),
'/router/login_store_select': (context, {arguments}) => '/router/login_store_select': (context, {arguments}) =>
LoginStoreSelect(arguments:arguments), LoginStoreSelect(arguments: arguments),
'/router/binding_phone_page': (context, {arguments}) => '/router/binding_phone_page': (context, {arguments}) =>
BindingPhonePage(arguments:arguments), BindingPhonePage(arguments: arguments),
'/router/trading_card_page': (context, {arguments}) => '/router/trading_card_page': (context, {arguments}) => TradingCardPage(),
TradingCardPage(), '/router/loading_page': (context, {arguments}) => LoadingPage(),
}; };

11
lib/main_page.dart

@ -101,17 +101,6 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
if (widget.arguments != null && widget.arguments["index"] != null) if (widget.arguments != null && widget.arguments["index"] != null)
clickIndex = widget.arguments["index"]; clickIndex = widget.arguments["index"];
WidgetsBinding.instance.addObserver(this); 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(); initSdk();
UmengCommonSdk.initCommon('6491509087568a379b5a1345', '6491509087568a379b5a1345', 'Umeng'); UmengCommonSdk.initCommon('6491509087568a379b5a1345', '6491509087568a379b5a1345', 'Umeng');

Loading…
Cancel
Save