From eb650460addbf6d96b96f969f26e3150bbd8e250 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Wed, 5 Jun 2024 16:13:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20=E5=8D=8E=E4=B8=BA?= =?UTF-8?q?=E9=9A=90=E7=A7=81=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E5=A4=87=E5=88=97=E8=A1=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 +- .../lockMian/lockList/lockList_xhj_page.dart | 24 ++++++++++++------- lib/network/request_interceptor.dart | 2 +- lib/tools/platform_info_services.dart | 7 +++++- pubspec.yaml | 3 ++- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 31267a30..2399f005 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -59,7 +59,6 @@ Future _initTranslation() async => TranslationLoader.loadTranslation( // 设置包名服务设备信息 Future _setCommonServices() async { await Get.putAsync(() => StoreService().init()); - await Get.putAsync(() => PlatformInfoService().init()); Get.put(ApiProvider()); Get.put(ApiRepository(Get.find())); if (F.isLite) { @@ -72,6 +71,7 @@ Future _setCommonServices() async { //关于隐私协议的初始化 Future privacySDKInitialization() async { + await Get.putAsync(() => PlatformInfoService().init()); await BuglyTool.init(); await XSJPushProvider().initJPushService(); } diff --git a/lib/main/lockMian/lockList/lockList_xhj_page.dart b/lib/main/lockMian/lockList/lockList_xhj_page.dart index 0eab9fd7..3ffd4e5c 100755 --- a/lib/main/lockMian/lockList/lockList_xhj_page.dart +++ b/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -147,6 +147,7 @@ class _LockListXHJPageState extends State with RouteAware { BuildContext context, int index, GroupList itemData) { final List lockItemList = itemData.lockList ?? []; + final List list = forItems(lockItemList); return LockListGroupView( onTap: () { setState(() {}); @@ -155,15 +156,20 @@ class _LockListXHJPageState extends State with RouteAware { backgroundColor: Colors.transparent, typeImgList: const [], groupItem: itemData, - child: GridView.extent( + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 15.w, + mainAxisSpacing: 15.h, + childAspectRatio: 1.1, + ), padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w), - maxCrossAxisExtent: Get.width * .6, - childAspectRatio: 1.2, - crossAxisSpacing: 15.w, - mainAxisSpacing: 15.h, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - children: forItems(lockItemList), + itemBuilder: (BuildContext context, int index) { + return list[index]; + }, + itemCount: list.length, )); } @@ -317,8 +323,8 @@ class _LockListXHJPageState extends State with RouteAware { Visibility( visible: keyInfo.passageMode == 1, child: Container( - padding: - EdgeInsets.only(top: 2.h, right: 3.w, left: 3.w,bottom: 1.h), + padding: EdgeInsets.only( + top: 2.h, right: 3.w, left: 3.w, bottom: 1.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor, @@ -338,7 +344,7 @@ class _LockListXHJPageState extends State with RouteAware { children: [ Container( padding: EdgeInsets.only( - top: 2.h, right: 3.w, left: 3.w,bottom: 1.h), + top: 2.h, right: 3.w, left: 3.w, bottom: 1.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.w), color: AppColors.mainColor, diff --git a/lib/network/request_interceptor.dart b/lib/network/request_interceptor.dart index 0e88f698..eee3dc3d 100755 --- a/lib/network/request_interceptor.dart +++ b/lib/network/request_interceptor.dart @@ -11,7 +11,7 @@ import '../tools/storage.dart'; String getUserAgent() { //赋值变量方便调试 String ua = - 'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}'; + 'StarLock/${PlatformInfoService.to?.info.version}/${PlatformInfoService.to?.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}'; return ua; } diff --git a/lib/tools/platform_info_services.dart b/lib/tools/platform_info_services.dart index 95e82558..2417033b 100755 --- a/lib/tools/platform_info_services.dart +++ b/lib/tools/platform_info_services.dart @@ -3,7 +3,12 @@ import 'package:get/get.dart'; import 'package:package_info_plus/package_info_plus.dart'; class PlatformInfoService extends GetxService { - static PlatformInfoService get to => Get.find(); + static PlatformInfoService? get to { + if(Get.isRegistered()){ + return Get.find(); + } + return null; + } late PackageInfo _packageInfo; PackageInfo get info => _packageInfo; Future init() async { diff --git a/pubspec.yaml b/pubspec.yaml index 5f669045..2617b42f 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -63,8 +63,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.53+2024052804:xhj 线上环境,提审 修改鑫锁名字为星星锁 # 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060401:xhj 线上环境,对外发布,提交测试 +# 1.0.56+2024060502:xhj 线上环境,对外发布,提交测试 -version: 1.0.56+2024060401 +version: 1.0.56+2024060502 environment: sdk: '>=2.12.0 <3.0.0'