diff --git a/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart index c1941350..bac4a877 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart @@ -1,36 +1,20 @@ -import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:intl/intl.dart'; -import 'package:star_lock/flavors.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart'; -import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/tools/titleAppBar.dart'; -import 'package:star_lock/widget/flavors_img.dart'; -import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; -import '../../../blue/blue_manage.dart'; -import '../../../blue/io_tool/io_tool.dart'; -import '../../../common/XSConstantMacro/XSConstantMacro.dart'; -import '../../../tools/appRouteObserver.dart'; -import '../../../tools/commonDataManage.dart'; -import '../../../tools/dateTool.dart'; -import '../../../tools/eventBusEventManage.dart'; -import '../../../tools/storage.dart'; -import '../../../translations/trans_lib.dart'; -import '../../lockMian/entity/lockListInfo_entity.dart'; import 'lockDetail_logic.dart'; class LockDetailListPage extends StatefulWidget { + + const LockDetailListPage({required this.title, required this.items, Key? key}) + : super(key: key); final String title; final List items; - const LockDetailListPage({Key? key, required this.title, required this.items}) - : super(key: key); - @override State createState() => _LockDetailListPageState(); } @@ -59,7 +43,7 @@ class _LockDetailListPageState extends State body: ListView.builder( padding: EdgeInsets.only(top: 15.h), itemCount: widget.items.length, - itemBuilder: (context, index) => widget.items[index]), + itemBuilder: (BuildContext context, int index) => widget.items[index]), ); } } diff --git a/lib/main/lockMian/lockList/lockList_xhj_page.dart b/lib/main/lockMian/lockList/lockList_xhj_page.dart index 2c9188e5..137a5ba0 100755 --- a/lib/main/lockMian/lockList/lockList_xhj_page.dart +++ b/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -65,20 +65,15 @@ class _LockListXHJPageState extends State with RouteAware { ), ), Expanded( - child: ListView.separated( - itemCount: logic.groupDataList.length, - itemBuilder: (BuildContext context, int index) { - final GroupList itemData = logic.groupDataList[index]; - return _buildLockExpandedList(context, index, itemData); - }, - shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics(), - separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); - }), + child: ListView.builder( + itemCount: logic.groupDataList.length, + itemBuilder: (BuildContext context, int index) { + final GroupList itemData = logic.groupDataList[index]; + return _buildLockExpandedList(context, index, itemData); + }, + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + ), ), ], ), @@ -87,7 +82,8 @@ class _LockListXHJPageState extends State with RouteAware { } //设备多层级列表 - Widget _buildLockExpandedList(context, index, GroupList itemData) { + Widget _buildLockExpandedList( + BuildContext context, int index, GroupList itemData) { final List lockItemList = itemData.lockList ?? []; return LockListGroupView( @@ -110,7 +106,7 @@ class _LockListXHJPageState extends State with RouteAware { )); } - List forItems(List lockItemList) { + List forItems(List lockItemList) { final List list = []; for (int i = 0, j = 0; i < lockItemList.length; i++, j++) { final LockListInfoItemEntity keyInfo = lockItemList[i]; @@ -141,24 +137,24 @@ class _LockListXHJPageState extends State with RouteAware { if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) { - logic.showToast("您的钥匙未生效".tr); + logic.showToast('您的钥匙未生效'.tr); return; } if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { - logic.showToast("您的钥匙已冻结".tr); + logic.showToast('您的钥匙已冻结'.tr); return; } if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { - logic.showToast("您的钥匙已过期".tr); + logic.showToast('您的钥匙已过期'.tr); return; } Get.toNamed(Routers.lockDetailMainPage, arguments: { - "keyInfo": keyInfo, - "isOnlyOneData": false, + 'keyInfo': keyInfo, + 'isOnlyOneData': false, }); }), )); @@ -217,7 +213,7 @@ class _LockListXHJPageState extends State with RouteAware { ), maxLines: 1), Visibility( - visible: keyInfo.passageMode == 1 ? true : false, + visible: keyInfo.passageMode == 1, child: Padding( padding: EdgeInsets.only(top: 5.h), child: Row( @@ -228,7 +224,7 @@ class _LockListXHJPageState extends State with RouteAware { borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor, ), - child: Text("常开模式开启".tr, + child: Text('常开模式开启'.tr, style: TextStyle( fontSize: 18.sp, color: AppColors.appBarIconColor)), @@ -237,14 +233,13 @@ class _LockListXHJPageState extends State with RouteAware { ), )), Visibility( - visible: - keyInfo.lockSetting!.remoteUnlock == 1 ? true : false, + visible: keyInfo.lockSetting!.remoteUnlock == 1, child: Padding( padding: EdgeInsets.only(top: 5.h), child: Row( children: [ Text( - "远程开锁".tr, + '远程开锁'.tr, style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), @@ -253,16 +248,14 @@ class _LockListXHJPageState extends State with RouteAware { ), )), Visibility( - visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || - keyInfo.keyType == XSConstantMacro.keyTypeLoop) && - (keyInfo.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || - keyInfo.keyStatus == - XSConstantMacro.keyStatusFrozen || - keyInfo.keyStatus == - XSConstantMacro.keyStatusExpired)) - ? true - : false, + visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == + XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == + XSConstantMacro.keyStatusExpired), child: Padding( padding: EdgeInsets.only(top: 20.h), child: Row( @@ -292,7 +285,7 @@ class _LockListXHJPageState extends State with RouteAware { child: Text( keyInfo.isLockOwner == 1 ? '超级管理员'.tr - : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr), + : (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr), style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), @@ -304,7 +297,7 @@ class _LockListXHJPageState extends State with RouteAware { ), SizedBox(width: 2.w), Text( - "${keyInfo.electricQuantity!}%", + '${keyInfo.electricQuantity!}%', style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), @@ -326,7 +319,6 @@ class _LockListXHJPageState extends State with RouteAware { @override void didChangeDependencies() { - // TODO: implement didChangeDependencies super.didChangeDependencies(); /// 路由订阅 @@ -335,7 +327,6 @@ class _LockListXHJPageState extends State with RouteAware { @override void dispose() { - // TODO: implement dispose /// 取消路由订阅 AppRouteObserver().routeObserver.unsubscribe(this); super.dispose();