|
|
@ -5,12 +5,14 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; |
|
|
|
import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; |
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
import 'package:flutter_svg/flutter_svg.dart'; |
|
|
|
import 'package:flutter_svg/flutter_svg.dart'; |
|
|
|
import 'package:huixiang/community/community_page.dart'; |
|
|
|
import 'package:huixiang/community/community_page.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/home/home_page.dart'; |
|
|
|
import 'package:huixiang/home/home_page.dart'; |
|
|
|
import 'package:huixiang/main.dart'; |
|
|
|
import 'package:huixiang/main.dart'; |
|
|
|
import 'package:huixiang/mine/mine_page.dart'; |
|
|
|
import 'package:huixiang/mine/mine_page.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/app_update.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/user_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/user_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
@ -20,6 +22,7 @@ import 'package:huixiang/utils/bridge.dart'; |
|
|
|
import 'package:huixiang/utils/event_type.dart'; |
|
|
|
import 'package:huixiang/utils/event_type.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/native_event_handler.dart'; |
|
|
|
import 'package:huixiang/utils/native_event_handler.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/update_dialog.dart'; |
|
|
|
import 'package:permission_handler/permission_handler.dart'; |
|
|
|
import 'package:permission_handler/permission_handler.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:sharesdk_plugin/sharesdk_interface.dart'; |
|
|
|
import 'package:sharesdk_plugin/sharesdk_interface.dart'; |
|
|
@ -46,6 +49,10 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver { |
|
|
|
List<String> icons; |
|
|
|
List<String> icons; |
|
|
|
final GlobalKey homePageKey = GlobalKey(); |
|
|
|
final GlobalKey homePageKey = GlobalKey(); |
|
|
|
// List<String> iconn; |
|
|
|
// List<String> iconn; |
|
|
|
|
|
|
|
ApiService apiService; |
|
|
|
|
|
|
|
String version = "1.0.1"; |
|
|
|
|
|
|
|
AppUpdate appUpdate; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
void dispose() { |
|
|
@ -138,6 +145,8 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
queryUserInfo(); |
|
|
|
queryUserInfo(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appAutoUpdate(); |
|
|
|
} |
|
|
|
} |
|
|
|
final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); |
|
|
|
final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); |
|
|
|
initSdk() async { |
|
|
|
initSdk() async { |
|
|
@ -316,6 +325,31 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///app自动更新 |
|
|
|
|
|
|
|
appAutoUpdate() async { |
|
|
|
|
|
|
|
if (apiService == null) { |
|
|
|
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
|
|
|
apiService = ApiService( |
|
|
|
|
|
|
|
Dio(), |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
token: value.getString("token"), |
|
|
|
|
|
|
|
showLoading: true |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BaseData<AppUpdate> baseData = await apiService.appVersion().catchError((onError) {}); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
if(version != appUpdate?.appLastVersion ?? ""){ |
|
|
|
|
|
|
|
showAlertDialog(version); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
SmartDialog.showToast(baseData.msg, |
|
|
|
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final PageController pageController = PageController(initialPage: 0); |
|
|
|
final PageController pageController = PageController(initialPage: 0); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -358,8 +392,8 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver { |
|
|
|
// bottomNavigationBigItem(S.of(context).pinpai, 0), |
|
|
|
// bottomNavigationBigItem(S.of(context).pinpai, 0), |
|
|
|
bottomNavigationItem(S.of(context).main_menu1, 0), |
|
|
|
bottomNavigationItem(S.of(context).main_menu1, 0), |
|
|
|
bottomNavigationItem(S.of(context).main_menu2, 1), |
|
|
|
bottomNavigationItem(S.of(context).main_menu2, 1), |
|
|
|
// bottomNavigationItem(S.of(context).main_menu3 , 2) |
|
|
|
bottomNavigationItem(S.of(context).main_menu3 , 2), |
|
|
|
bottomNavigationItem("订单", 2), |
|
|
|
// bottomNavigationItem("订单", 2), |
|
|
|
bottomNavigationItem(S.of(context).main_menu4, 3), |
|
|
|
bottomNavigationItem(S.of(context).main_menu4, 3), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
@ -441,6 +475,17 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///app更新弹窗 |
|
|
|
|
|
|
|
showAlertDialog(version) { |
|
|
|
|
|
|
|
//显示对话框 |
|
|
|
|
|
|
|
showDialog( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
builder: (BuildContext context) { |
|
|
|
|
|
|
|
return UpdateDialog(version,appUpdate); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Widget bottomNavigationBigItem(text, index) { |
|
|
|
// Widget bottomNavigationBigItem(text, index) { |
|
|
|
// var isSelected = index == clickIndex; |
|
|
|
// var isSelected = index == clickIndex; |
|
|
|