diff --git a/assets/gif/loading_logo.gif b/assets/gif/loading_logo.gif new file mode 100644 index 00000000..6b0525c8 Binary files /dev/null and b/assets/gif/loading_logo.gif differ diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index c4d5f9b1..d11cbedc 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -241,7 +241,7 @@ class _NewLoginPage extends State { "areaCode": area, "regChannel":channelName ?? "" }; - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(); BaseData value = await apiService.memberLogin(param).catchError((error) { print(error.message); SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 98a91778..6522f918 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -449,7 +449,8 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { return GestureDetector( onTap: (){ if(position == 0){ - Navigator.of(context).pushNamed('/router/invite_friends'); + Navigator.of(context).pushNamed('/router/loading_page'); + // Navigator.of(context).pushNamed('/router/invite_friends'); }else if(position == 1){ Navigator.of(context).pushNamed('/router/trading_card_page'); } diff --git a/lib/mine/mine_shop_details.dart b/lib/mine/mine_shop_details.dart index 244ca00c..4a0956bc 100644 --- a/lib/mine/mine_shop_details.dart +++ b/lib/mine/mine_shop_details.dart @@ -511,13 +511,14 @@ class _MineShopDetails extends State { ), ), ), + if(S.of(context).mi(((store.distance ?? 0) * 100).toInt() / 100.0) != "0.0米") Text( - (store.distance ?? 0) > 1000 + ((store.distance ?? 0) > 1000 ? S.of(context).gongli( ((store.distance ?? 0) / 1000 * 100).toInt() / 100.0) : S .of(context) - .mi(((store.distance ?? 0) * 100).toInt() / 100.0), + .mi(((store.distance ?? 0) * 100).toInt() / 100.0)), style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 4beff7f6..eda4e63f 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -99,7 +99,11 @@ abstract class ApiService { debugPrint("headers = ${options.headers}"); if (showLoading && !EasyLoading.isShow) { //是否显示loading - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(indicator:Image.asset( + "assets/gif/loading_logo.gif", + width: 150, + height: 150, + )); } if (options.data is FormData) { debugPrint("params data = FormData"); diff --git a/lib/setting/account_security_page.dart b/lib/setting/account_security_page.dart index bb9e859d..50756b27 100644 --- a/lib/setting/account_security_page.dart +++ b/lib/setting/account_security_page.dart @@ -26,7 +26,7 @@ class _AccountSecurityPage extends State { @override void initState() { super.initState(); - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(); SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token"),), diff --git a/lib/setting/loading_page.dart b/lib/setting/loading_page.dart new file mode 100644 index 00000000..79ac626e --- /dev/null +++ b/lib/setting/loading_page.dart @@ -0,0 +1,72 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/user_info.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class LoadingPage extends StatefulWidget { + @override + State createState() { + return _LoadingPage(); + } +} + +class _LoadingPage extends State { + + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: Container( + width: double.infinity, + margin: EdgeInsets.only(top: 100,left: 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + onTap: (){ + EasyLoading.show(indicator:Image.asset( + "assets/gif/loading_logo.gif", + width: 250, + height: 250, + )); + Future.delayed(Duration(seconds: 10), () { + EasyLoading.dismiss(); + }); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + color: Colors.blue, + child: Text("纯图"), + ), + ), + GestureDetector( + onTap: (){ + EasyLoading.show(); + Future.delayed(Duration(seconds: 10), () { + EasyLoading.dismiss(); + }); + }, + child: Container( + margin: EdgeInsets.only(top:20), + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + color: Colors.blue, + child: Text("图文"), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b7b60ce2..29199d54 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -97,12 +97,12 @@ class _StoreOrderPage extends State /// 小程序登录 minLogin(SharedPreferences shared) async { - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(); apiService = ApiService( Dio(), context: context, token: shared.getString('token'), - showLoading: true, + // showLoading: true, ); apiService.minLogin(storeId).catchError((onError) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), @@ -128,7 +128,7 @@ class _StoreOrderPage extends State storeId: storeId, ); - EasyLoading.dismiss(); + // EasyLoading.dismiss(); queryMemberInfo(); @@ -207,7 +207,7 @@ class _StoreOrderPage extends State setState(() {}); } } - EasyLoading.dismiss(); + // EasyLoading.dismiss(); } RefreshController refreshController; diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 19e69013..d57ce79d 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -133,7 +133,7 @@ class UnionPageState extends State } startLocation(bool isOnRefresh) async { - if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai); + if (!isOnRefresh) EasyLoading.show(); Location.getInstance().startLocation(context, (BaiduLocation result) { if (result != null && result.latitude != null && @@ -171,7 +171,7 @@ class UnionPageState extends State } }).then((value) { if (!value) { - EasyLoading.dismiss(); + // EasyLoading.dismiss(); tabRefresh().refreshCompleted(); } }); @@ -289,8 +289,8 @@ class UnionPageState extends State } else { if (index == -1) tabRefresh().refreshFailed(); } - EasyLoading.dismiss(); setState(() {}); + EasyLoading.dismiss(); } TabController tabController; diff --git a/lib/vip/vip_page.dart b/lib/vip/vip_page.dart index cddee8a4..b032dc14 100644 --- a/lib/vip/vip_page.dart +++ b/lib/vip/vip_page.dart @@ -88,7 +88,6 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { Dio(), context: context, token: value.getString("token"), - showLoading: true ); } BaseData baseData = diff --git a/pubspec.yaml b/pubspec.yaml index 6f52ab0b..33b2bc63 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -88,7 +88,7 @@ dependencies: sharesdk_plugin: ^1.3.4 flutter_spinkit: ^5.0.0 - flutter_easyloading: ^3.0.0 + flutter_easyloading: ^3.0.5 rive: ^0.6.8 flare_flutter: ^3.0.2 @@ -128,6 +128,7 @@ flutter: - assets/map_style/ - assets/riv/ - assets/svg/ + - assets/gif/ # - assets/fonts/ fonts: