From ed12b39f5b211fac44f2ff81d85ec93d380e3873 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Fri, 7 Jun 2024 11:12:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=E8=B0=83=E9=80=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/app.dart | 6 +- lib/login/login/app_get_version.dart | 3 + lib/main/lockMian/lockMain/lockMain_page.dart | 6 +- .../lockMain/xhj/lockMain_xhj_page.dart | 142 +++++++----------- lib/mine/mall/lockMall_logic.dart | 24 ++- lib/mine/mall/lockMall_page.dart | 13 +- .../messageList/messageList_xhj_page.dart | 5 +- lib/mine/mineSet/mineSet/mineSet_page.dart | 6 +- lib/tools/pay/wx_pay_tool.dart | 8 +- 9 files changed, 97 insertions(+), 116 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index dc825bcd..0af65278 100755 --- a/lib/app.dart +++ b/lib/app.dart @@ -14,6 +14,7 @@ import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/tools/app_manager.dart'; import 'package:star_lock/tools/bindings/app_binding.dart'; import 'package:star_lock/tools/customer_tool.dart'; +import 'package:star_lock/tools/pay/wx_pay_tool.dart'; import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/translations/app_dept.dart'; @@ -117,7 +118,7 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { getPages: AppRouters.routePages, builder: EasyLoading.init(), initialBinding: AppBindings(), - initialRoute: initialRoute ); + initialRoute: initialRoute); } @override @@ -178,4 +179,5 @@ Future getAgreePrivacyShowUpdate() async { Future getAppInfo() async { final GetAppInfo entity = await ApiRepository.to.getAppInfo(); CustomerTool.init(entity.data?.wechatServiceUrl ?? ''); -} \ No newline at end of file + WxPayTool.associationUrl = entity.data?.appSiteUrl ?? ''; +} diff --git a/lib/login/login/app_get_version.dart b/lib/login/login/app_get_version.dart index f224088b..fb738b60 100644 --- a/lib/login/login/app_get_version.dart +++ b/lib/login/login/app_get_version.dart @@ -28,13 +28,16 @@ class GetAppInfo { class Data { Data.fromJson(Map json) { wechatServiceUrl = json['wechat_service_url']; + appSiteUrl = json['app_site_url']; } String? wechatServiceUrl; + String? appSiteUrl; Map toJson() { final Map data = {}; data['wechat_service_url'] = wechatServiceUrl; + data['app_site_url'] = appSiteUrl; return data; } } diff --git a/lib/main/lockMian/lockMain/lockMain_page.dart b/lib/main/lockMian/lockMain/lockMain_page.dart index b23b80c4..ffa55bf2 100755 --- a/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/lib/main/lockMian/lockMain/lockMain_page.dart @@ -33,7 +33,7 @@ class StarLockMainPage extends StatefulWidget { State createState() => _StarLockMainPageState(); } -class _StarLockMainPageState extends State with BaseWidget { +class _StarLockMainPageState extends State with BaseWidget ,AutomaticKeepAliveClientMixin { final logic = Get.put(LockMainLogic()); final state = Get.find().state; @@ -265,8 +265,10 @@ class _StarLockMainPageState extends State with BaseWidget { @override void dispose() { - // TODO: implement dispose super.dispose(); _teamEvent.cancel(); } + + @override + bool get wantKeepAlive => true; } diff --git a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart index c9c5a493..55aefff1 100755 --- a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart +++ b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart @@ -26,6 +26,7 @@ class StarLockMainXHJPage extends StatefulWidget { class _StarLockMainXHJPageState extends State with BaseWidget { + PageController _pageController = PageController(); @override void initState() { @@ -44,109 +45,70 @@ class _StarLockMainXHJPageState extends State builder: (LockMainXHJLogic logic) { return Scaffold( backgroundColor: Colors.white, - body: Stack( + body: PageView( + controller: _pageController, + physics: const NeverScrollableScrollPhysics(), // 禁止滑动 children: [ - pageView( - widget: StarLockMainPage( + StarLockMainPage( + showAppBar: false, + showDrawer: false, + ), + SafeArea( + bottom: false, + child: LockMallPage( + allowReturn: false, + ), + ), + SafeArea( + bottom: false, + child: MessageListXHJPage( showAppBar: false, - showDrawer: false, ), - logic: logic, - index: 0, ), - pageView( - widget: SafeArea( - bottom: false, - child: LockMallPage( - allowReturn: false, - ), + SafeArea( + bottom: false, + child: MineSetPage( + showAppBar: false, + showAbout: true, ), - logic: logic, - index: 1, - ), - pageView( - widget: SafeArea( - bottom: false, - child: MessageListXHJPage( - showAppBar: false, - ), - ), - logic: logic, - index: 2, - ), - pageView( - widget: SafeArea( - bottom: false, - child: MineSetPage( - showAppBar: false, - showAbout: true, - ), - ), - logic: logic, - index: 3, ), ], ), - bottomNavigationBar: Container( - padding: EdgeInsets.only( - top: 20.h, bottom: GetPlatform.isAndroid ? 20.h : 0), - decoration: const BoxDecoration( - color: Colors.transparent, - border: Border( - top: BorderSide( - color: Colors.black, // 设置边框颜色 - width: 0.3, // 设置边框宽度 - ), - ), - ), - child: SafeArea( - top: false, - child: Row( - children: [ - navigationBarItem(Icons.key, - TranslationLoader.lanKeys!.device!.tr, logic, 0, () { - logic.setIndex(0); - }), - navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 1, - () { - logic.setIndex(1); - }), - navigationBarItem(Icons.message, - TranslationLoader.lanKeys!.message!.tr, logic, 2, () { - logic.setIndex(2); - }), - navigationBarItem(Icons.account_circle, '我的'.tr, logic, 3, - () { - logic.setIndex(3); - }), - ], - ), - ), - ), + bottomNavigationBar: buildBottomNavigationBar(logic), ); }); } - //布局 - Widget pageView( - {required Widget widget, - required LockMainXHJLogic logic, - required int index}) { - return Positioned.fill( - child: Offstage( - offstage: logic.state.index != index, - child: widget, + Widget buildBottomNavigationBar(LockMainXHJLogic logic) { + return Container( + padding: + EdgeInsets.only(top: 20.h, bottom: GetPlatform.isAndroid ? 20.h : 0), + decoration: const BoxDecoration( + color: Colors.transparent, + border: Border(top: BorderSide(color: Colors.black, width: 0.3)), + ), + child: SafeArea( + top: false, + child: Row( + children: [ + navigationBarItem(logic, Icons.key, '设备'.tr, 0), + navigationBarItem(logic, Icons.shopping_cart, '商城'.tr, 1), + navigationBarItem(logic, Icons.message, '消息'.tr, 2), + navigationBarItem(logic, Icons.account_circle, '我的'.tr, 3), + ], + ), ), ); } - //底部按钮 - Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic, - int index, GestureTapCallback? onTop) { - final bool check = logic.state.index == index; + Widget navigationBarItem( + LockMainXHJLogic logic, IconData icon, String text, int index) { return Expanded( child: GestureDetector( - onTap: onTop, + onTap: () { + _pageController.jumpToPage(index); + logic.setIndex(index); + }, child: Container( color: Colors.transparent, child: Column( @@ -157,16 +119,18 @@ class _StarLockMainXHJPageState extends State child: Icon( icon, size: 32.r, - color: - check ? AppColors.mainColor : AppColors.darkGrayTextColor, + color: logic.state.index == index + ? AppColors.mainColor + : AppColors.darkGrayTextColor, ), ), Text( text, style: TextStyle( fontSize: 16.sp, - color: - check ? AppColors.mainColor : AppColors.darkGrayTextColor, + color: logic.state.index == index + ? AppColors.mainColor + : AppColors.darkGrayTextColor, ), ), ], diff --git a/lib/mine/mall/lockMall_logic.dart b/lib/mine/mall/lockMall_logic.dart index e9daa4e9..fc41e91d 100755 --- a/lib/mine/mall/lockMall_logic.dart +++ b/lib/mine/mall/lockMall_logic.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:fluwx/fluwx.dart'; import 'package:get/get.dart'; @@ -25,13 +26,12 @@ class LockMallLogic extends BaseGetXController { //获取商城跳转地址 Future getMallURLRequest() async { - LockMallDataEntity entity = await ApiRepository.to.getMallURLData(); + final LockMallDataEntity entity = await ApiRepository.to.getMallURLData(); if (entity.errorCode!.codeIsSuccessful) { state.lockMallUrl.value = entity.data!.url!; state.mallWebView.setNavigationDelegate( NavigationDelegate( onProgress: (int progress) { - // Update loading bar. state.webProgress.value = progress / 100; }, onPageStarted: (String url) { @@ -40,6 +40,7 @@ class LockMallLogic extends BaseGetXController { onPageFinished: (String url) { state.webProgress.value = 1.0; refreshGoBack(); + update(); }, onWebResourceError: (WebResourceError error) {}, onNavigationRequest: (NavigationRequest request) async { @@ -53,27 +54,24 @@ class LockMallLogic extends BaseGetXController { ), ); state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value)); - // FlutterBridge.postMessage({action:'',data:'{}',callFun:'回调给js的方法'}) state.mallWebView.addJavaScriptChannel( - "FlutterBridge", + 'FlutterBridge', onMessageReceived: (JavaScriptMessage message) async { flutterBridge(message); }, ); - // onMessageReceived } } //监听webview的调用 Future flutterBridge(JavaScriptMessage message) async { final dynamic obj = json.decode(message.message); - AppLog.log(obj.toString()); if (obj is! Map && obj['action'] is String) { return; } - String action = obj['action']; - dynamic data = obj['data']; - String? callFun = obj['callFun']; + final String action = obj['action']; + final dynamic data = obj['data']; + final String? callFun = obj['callFun']; switch (action) { case 'WechatPayParams': //微信支付 @@ -84,9 +82,9 @@ class LockMallLogic extends BaseGetXController { //微信支付 Future wxPay(dynamic data, String? callFun) async { - WxPayTool.pay(WxPayTool.mapToPayment(data), (response) { + WxPayTool.pay(WxPayTool.mapToPayment(data), (WeChatResponse response) { if (response is WeChatPaymentResponse) { - Map data = { + final Map data = { 'type': response.type, 'extData': response.extData, 'errCode': response.errCode, @@ -101,7 +99,7 @@ class LockMallLogic extends BaseGetXController { //判断webview 是否可以有路由可以回退,无则退出当前页面 Future canGoBack(bool didPop) async { - bool canGoBack = await state.mallWebView.canGoBack(); + final bool canGoBack = await state.mallWebView.canGoBack(); bool isMall = true; if (Get.isRegistered() && F.isXHJ) { isMall = Get.find().isMall; @@ -131,7 +129,7 @@ class LockMallLogic extends BaseGetXController { if (state.allowReturn) { return; } - state.mallWebView.canGoBack().then((value) { + state.mallWebView.canGoBack().then((bool value) { state.canGoBack = value; update(); }); diff --git a/lib/mine/mall/lockMall_page.dart b/lib/mine/mall/lockMall_page.dart index ef7614c6..1bd6b0b1 100755 --- a/lib/mine/mall/lockMall_page.dart +++ b/lib/mine/mall/lockMall_page.dart @@ -17,7 +17,7 @@ class LockMallPage extends StatefulWidget { State createState() => _LockMallPageState(); } -class _LockMallPageState extends State { +class _LockMallPageState extends State with AutomaticKeepAliveClientMixin { @override void initState() { super.initState(); @@ -25,8 +25,8 @@ class _LockMallPageState extends State { @override Widget build(BuildContext context) { - // FIXME 如果未登录状态,应先跳转登录页 - // FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录 + // 如果未登录状态,应先跳转登录页 + // url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录 // String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e'; return GetBuilder( init: LockMallLogic(allowReturn: widget.allowReturn), @@ -55,7 +55,7 @@ class _LockMallPageState extends State { PopScope( onPopInvoked: logic.canGoBack, canPop: false, - child: SizedBox(), + child: const SizedBox(), ), Container( padding: EdgeInsets.only(bottom: 10.w), @@ -76,10 +76,13 @@ class _LockMallPageState extends State { } String getWebTitle(LockMallLogic logic) { - String webTitleStr = "配件商城".tr; + String webTitleStr = '配件商城'.tr; logic.state.mallWebView.getTitle().then((result) { webTitleStr = result!; }); return webTitleStr; } + + @override + bool get wantKeepAlive => true; } diff --git a/lib/mine/message/messageList/messageList_xhj_page.dart b/lib/mine/message/messageList/messageList_xhj_page.dart index b0837627..ecd5d31f 100755 --- a/lib/mine/message/messageList/messageList_xhj_page.dart +++ b/lib/mine/message/messageList/messageList_xhj_page.dart @@ -25,7 +25,7 @@ class MessageListXHJPage extends StatefulWidget { } class _MessageListXHJPageState extends State - with TickerProviderStateMixin { + with TickerProviderStateMixin ,AutomaticKeepAliveClientMixin { final MessageListLogic logic = Get.put(MessageListLogic()); final MessageListState state = Get.find().state; @@ -257,4 +257,7 @@ class _MessageListXHJPageState extends State ), ); } + + @override + bool get wantKeepAlive => true; } diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index 55718339..51cd8e96 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -29,7 +29,8 @@ class MineSetPage extends StatefulWidget { State createState() => _MineSetPageState(); } -class _MineSetPageState extends State with WidgetsBindingObserver { +class _MineSetPageState extends State + with WidgetsBindingObserver, AutomaticKeepAliveClientMixin { final MineSetLogic logic = Get.put(MineSetLogic()); final MineSetState state = Get.find().state; @@ -590,4 +591,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { WidgetsBinding.instance.removeObserver(this); super.dispose(); } + + @override + bool get wantKeepAlive => true; } diff --git a/lib/tools/pay/wx_pay_tool.dart b/lib/tools/pay/wx_pay_tool.dart index d5231c51..20e025a5 100755 --- a/lib/tools/pay/wx_pay_tool.dart +++ b/lib/tools/pay/wx_pay_tool.dart @@ -5,8 +5,10 @@ import 'package:fluwx/fluwx.dart'; /// /// class WxPayTool { - static bool isInit = false; static Fluwx fluwx = Fluwx(); + static bool isInit = false; + static String associationUrl = ''; + static init(String appId, String universalLink) { fluwx.registerApi(appId: appId, universalLink: universalLink); @@ -15,7 +17,7 @@ class WxPayTool { static Future pay(Payment payment, WeChatResponseSubscriber listener) async { if (!isInit) { isInit = true; - await init(payment.appId, 'https://lock.skychip.top/apple-app-site-association.json'); + await init(payment.appId, associationUrl); //回调 responseListener(WeChatResponse response) { if (response is WeChatPaymentResponse) { @@ -30,7 +32,7 @@ class WxPayTool { } static Payment mapToPayment(dynamic data) { - Payment payment = Payment( + final Payment payment = Payment( appId: data['appId'], partnerId: data['partnerId'], prepayId: data['prepayId'], From a07fcb95a56b738efbc4f9b3fd602dc7dac5bed9 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Fri, 7 Jun 2024 11:16:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E9=92=A5=E5=8C=99/=E6=8E=88=E6=9D=83=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=91=E9=80=81=E6=88=96=E4=BF=AE=E6=94=B9=E5=AE=9E?= =?UTF-8?q?=E5=90=8D=E8=AE=A4=E8=AF=81=E6=B5=81=E7=A8=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdmin/authorizedAdmin_logic.dart | 7 ++++--- .../electronicKeyDetail_logic.dart | 14 ++++++++------ .../view/sendElectronicKeyView_logic.dart | 7 ++++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index e7beb599..47a682c4 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -257,9 +257,10 @@ class AuthorizedAdminLogic extends BaseGetXController { ShowCupertinoAlertView().showBuyTipWithContentAlert( titleStr: '实名认证为付费功能,请购买后再使用'.tr, sureClick: () { - Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { - 'webBuyType': XSConstantMacro.webBuyTypeAuth, - }); + // Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { + // 'webBuyType': XSConstantMacro.webBuyTypeAuth, + // }); + Get.toNamed(Routers.valueAddedServicesRealNamePage); }); } else if (entity.errorCode == 433) { //需联系管理员购买 diff --git a/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 4436d5f8..a95a057c 100755 --- a/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -168,9 +168,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController { ShowCupertinoAlertView().showBuyTipWithContentAlert( titleStr: '实名认证为付费功能,请购买后再使用'.tr, sureClick: () { - Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { - 'webBuyType': XSConstantMacro.webBuyTypeAuth, - }); + Get.toNamed(Routers.valueAddedServicesRealNamePage); + // Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { + // 'webBuyType': XSConstantMacro.webBuyTypeAuth, + // }); }); } else if (entity.errorCode == 433) { //需联系管理员购买 @@ -408,9 +409,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController { ShowCupertinoAlertView().showBuyTipWithContentAlert( titleStr: '实名认证为付费功能,请购买后再使用'.tr, sureClick: () { - Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { - 'webBuyType': XSConstantMacro.webBuyTypeAuth, - }); + // Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { + // 'webBuyType': XSConstantMacro.webBuyTypeAuth, + // }); + Get.toNamed(Routers.valueAddedServicesRealNamePage); }); } else if (entity.errorCode == 433) { //需联系管理员购买 diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index 249fce41..10c253c9 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -217,9 +217,10 @@ class SendElectronicKeyViewLogic extends BaseGetXController { ShowCupertinoAlertView().showBuyTipWithContentAlert( titleStr: '实名认证为付费功能,请购买后再使用'.tr, sureClick: () { - Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { - 'webBuyType': XSConstantMacro.webBuyTypeAuth, - }); + // Get.toNamed(Routers.advancedFeaturesWebPage, arguments: { + // 'webBuyType': XSConstantMacro.webBuyTypeAuth, + // }); + Get.toNamed(Routers.valueAddedServicesRealNamePage); }); } else if (entity.errorCode == 433) { //需联系管理员购买 From bc62d026c98a0c048f104c6d5a5d3bf53c889916 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Fri, 7 Jun 2024 11:20:24 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pubspec.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2617b42f..389dfe17 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,8 +64,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060401:xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060502:xhj 线上环境,对外发布,提交测试 +# 1.0.57+2024060701:xhj 线上环境,对外发布,提交测试 -version: 1.0.56+2024060502 +version: 1.0.57+2024060701 environment: sdk: '>=2.12.0 <3.0.0' From 3e6868c39512adda68f495db8a8bbb4b03eb6197 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Fri, 7 Jun 2024 11:39:08 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=9C=AA=E5=8A=A0=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 8196 -> 8196 bytes .../lockMian/lockMain/lockMain_logic.dart | 7 --- lib/main/lockMian/lockMain/lockMain_page.dart | 48 +++++++----------- lib/tools/EasyRefreshTool.dart | 1 - 4 files changed, 18 insertions(+), 38 deletions(-) diff --git a/.DS_Store b/.DS_Store index 3035c4ed779c60f0963863631eba7089bc783d7d..2e1f43b30d6f6ee3763f1adbbe77a14a8a743420 100755 GIT binary patch delta 73 zcmZp1XmQw}D$KZj@*BZIHSy|dQ)3ey1tYUs9ffL3BLf`;6H}wwT22m8Wqs?Q`0SkA dy!_6|`-J5gyEfkw)@0etCh?tR^FI-GW&lK@7WDuC delta 43 zcmZp1XmQw}Dm?kMU@3=%p|OsFiJ8gdg~HO4n}t+1KM+=9*~~8Sjb-y65q4$(I-m|3 diff --git a/lib/main/lockMian/lockMain/lockMain_logic.dart b/lib/main/lockMian/lockMain/lockMain_logic.dart index 7b006eb1..f658cffa 100755 --- a/lib/main/lockMian/lockMain/lockMain_logic.dart +++ b/lib/main/lockMian/lockMain/lockMain_logic.dart @@ -30,14 +30,7 @@ class LockMainLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { loadMainDataLogic(entity.data!); Storage.saveMainListData(entity.data!); - // return entity.data!; } - // else { - // // showToast("数据请求失败"); - // // state.dataLength.value = 0; - // LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData(); - // loadMainDataLogic(lockListInfoGroupEntity!); - // } return entity; } diff --git a/lib/main/lockMian/lockMain/lockMain_page.dart b/lib/main/lockMian/lockMain/lockMain_page.dart index ffa55bf2..46aec398 100755 --- a/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/lib/main/lockMian/lockMain/lockMain_page.dart @@ -6,6 +6,7 @@ import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/main/lockMian/lockList/lockList_xhj_page.dart'; +import 'package:star_lock/main/lockMian/lockMain/lockMain_state.dart'; import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; @@ -33,24 +34,26 @@ class StarLockMainPage extends StatefulWidget { State createState() => _StarLockMainPageState(); } -class _StarLockMainPageState extends State with BaseWidget ,AutomaticKeepAliveClientMixin { - final logic = Get.put(LockMainLogic()); - final state = Get.find().state; +class _StarLockMainPageState extends State + with BaseWidget, AutomaticKeepAliveClientMixin { + final LockMainLogic logic = Get.put(LockMainLogic()); + final LockMainState state = Get.find().state; Future getHttpData( {bool clearScanDevices = false, bool isUnShowLoading = false}) async { LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData(); if (lockListInfoGroupEntity != null) { - var localLockListInfoGroupEntity = lockListInfoGroupEntity; - logic.loadMainDataLogic(localLockListInfoGroupEntity); + logic.loadMainDataLogic(lockListInfoGroupEntity); + } + lockListInfoGroupEntity = + (await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data; + if (lockListInfoGroupEntity != null) { + logic.loadMainDataLogic(lockListInfoGroupEntity); } - await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading); - await Future.delayed(const Duration(milliseconds: 200)); if (clearScanDevices) { BlueManage().scanDevices.clear(); } - WidgetsBinding.instance.addPostFrameCallback((_) async { setState(() {}); }); @@ -93,7 +96,7 @@ class _StarLockMainPageState extends State with BaseWidget ,Au haveBack: false, haveOtherLeftWidget: true, leftWidget: Builder( - builder: (context) => IconButton( + builder: (BuildContext context) => IconButton( icon: Image.asset( 'images/main/mainLeft_menu_icon.png', color: Colors.white, @@ -125,23 +128,6 @@ class _StarLockMainPageState extends State with BaseWidget ,Au fit: BoxFit.cover, ), ), - // decoration: BoxDecoration( - // // 设置渐变 - // gradient: LinearGradient( - // // 渐变颜色列表 - // colors: [ - // AppColors.mainColor.withOpacity(0.8), // 左上角颜色 - // AppColors.mainColor.withOpacity(0.4), // 右上角颜色 - // Colors.white, // 右下角颜色 - // Colors.white, // 左下角颜色 - // ], - // // 渐变的起始和结束位置 - // begin: Alignment.topLeft, - // end: Alignment.bottomRight, - // // 颜色停靠点,对应颜色数组的索引位置 - // stops: [0.0, 0.23, 0.47, 1], - // ), - // ), child: child, )); return child; @@ -189,16 +175,16 @@ class _StarLockMainPageState extends State with BaseWidget ,Au Widget unHaveData() { return ListView( - children: [ + children: [ Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ SizedBox( height: 160.h, ), Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ SizedBox( width: 330.w, child: InkWell( @@ -255,7 +241,9 @@ class _StarLockMainPageState extends State with BaseWidget ,Au late StreamSubscription _teamEvent; void _initLoadDataAction() { - _teamEvent = eventBus.on().listen((event) { + _teamEvent = eventBus + .on() + .listen((RefreshLockListInfoDataEvent event) { logic.pageNo = 1; getHttpData( clearScanDevices: event.clearScanDevices, diff --git a/lib/tools/EasyRefreshTool.dart b/lib/tools/EasyRefreshTool.dart index 1a086fa4..f754a6fd 100755 --- a/lib/tools/EasyRefreshTool.dart +++ b/lib/tools/EasyRefreshTool.dart @@ -36,7 +36,6 @@ class _EasyRefreshToolState extends State { @override void initState() { - // TODO: implement initState super.initState(); _controller = EasyRefreshController(); } From 34670940505458ef693093408ef887e00f110198 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Fri, 7 Jun 2024 11:39:58 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pubspec.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 389dfe17..4bfba5e8 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,9 +64,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060401:xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060502:xhj 线上环境,对外发布,提交测试 -# 1.0.57+2024060701:xhj 线上环境,对外发布,提交测试 +# 1.0.57+2024060702:xhj 线上环境,对外发布,提交测试 +# 1.0.58+2024060702:xhj 线上环境,对外发布,提交测试 -version: 1.0.57+2024060701 +version: 1.0.58+2024060702 environment: sdk: '>=2.12.0 <3.0.0'