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'