From 436ee3d50f489a28f43e5e17be43be95ba534a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Wed, 5 Jun 2024 14:36:31 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E9=94=81=E5=88=86?= =?UTF-8?q?=E7=BB=84bug=E3=80=822=E3=80=81=E4=BF=AE=E6=94=B9=E7=BE=A4?= =?UTF-8?q?=E5=8F=91=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdmin_logic.dart | 8 -- .../volumeAuthorizationLock_logic.dart | 10 ++- .../massSendLockGroupCell.dart | 24 ++--- .../massSendLockGroupList_page.dart | 2 + .../authorityManagement_page.dart | 2 + .../administratorAssociationLock_page.dart | 2 + .../groupEditLock/groupEditLock_logic.dart | 22 ++--- .../groupEditLock/groupEditLock_page.dart | 46 ++++++---- .../lockItemList_page.dart | 18 ++-- .../lockGroupList/lockGroupList_logic.dart | 35 ++++---- .../lockGroupList/lockGroupList_page.dart | 88 +++++-------------- .../lockGroupList/lockGroupList_state.dart | 4 +- lib/tools/ExpandedListView.dart | 83 ++++++++--------- 13 files changed, 158 insertions(+), 186 deletions(-) diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 6a42c878..e7beb599 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -325,21 +325,13 @@ class AuthorizedAdminLogic extends BaseGetXController { @override void onReady() { - // TODO: implement onReady super.onReady(); _initReplySubscription(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - @override void onClose() { - // TODO: implement onClose _replySubscription.cancel(); } } diff --git a/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart b/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart index 339c84de..c1aa86c4 100755 --- a/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart +++ b/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart @@ -1,10 +1,10 @@ -import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../tools/showTipView.dart'; import 'volumeAuthorizationLock_state.dart'; class VolumeAuthorizationLockLogic extends BaseGetXController { @@ -46,11 +46,13 @@ class VolumeAuthorizationLockLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { state.isSendSuccess.value = true; } else { - EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds); if (entity.errorCode == 425) { //用户未注册 - state.isCreateUser.value = true; - addAuthorizedAdminRequest(); + ShowTipView().showIosTipWithContentDialog( + '${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}', () { + state.isCreateUser.value = true; + addAuthorizedAdminRequest(); + }); } } } diff --git a/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.dart b/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.dart index 5bab6e32..ee8e011b 100755 --- a/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.dart +++ b/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.dart @@ -11,12 +11,14 @@ class massSendLockGroupCell extends StatelessWidget { required this.lockListByGroup, required this.selectLockAction, required this.isVip, + required this.isShowBtn, Key? key}) : super(key: key); final int currentIndex; List lockListByGroup; final _CallBack selectLockAction; bool isVip; + bool isShowBtn; @override Widget build(BuildContext context) { @@ -65,26 +67,28 @@ class massSendLockGroupCell extends StatelessWidget { child: SizedBox( width: 20.w, )), - Image.asset( - itemData.isChecked - ? 'images/icon_round_select.png' - : 'images/icon_round_unSelect.png', - width: 30.w, - height: 30.w, - color: !isVip ? Colors.grey : AppColors.mainColor, - ), + Visibility( + visible: isShowBtn, + child: Image.asset( + itemData.isChecked + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 30.w, + height: 30.w, + color: !isVip ? Colors.grey : AppColors.mainColor, + ),), SizedBox( width: 30.w, ) ], ), ), - onTap: () { + onTap: isShowBtn ? () { if (isVip == false) { return; } selectLockAction(itemIndex, itemData.lockId.toString()); - }, + } : null, ); } } diff --git a/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart b/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart index 1dca45df..1a4deb84 100755 --- a/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart +++ b/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart @@ -131,12 +131,14 @@ class _MassSendLockGroupListPageState extends State { } setState(() {}); }, + isShowBtn: true, typeImgList: const [], groupItem: itemData, child: massSendLockGroupCell(index, currentIndex: index, lockListByGroup: lockItemList, isVip: state.isVip.value, + isShowBtn: true, selectLockAction: (selectIndex, selectLockId) { LockListItem lockItem = lockItemList[selectIndex]; lockItem.isChecked = !lockItem.isChecked; diff --git a/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart b/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart index d088cc6f..cf2f3dfc 100755 --- a/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart +++ b/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart @@ -174,6 +174,7 @@ class _AuthorityManagementPageState extends State }, // title: deviceName, // imgName: 'images/icon_lock.png', + isShowBtn: true, typeImgList: const [], groupItem: GroupListItem(), child: ListView.separated( @@ -214,6 +215,7 @@ class _AuthorityManagementPageState extends State }, // title: deviceName, // imgName: 'images/controls_user.png', + isShowBtn: true, typeImgList: const ['images/icon_password.png', 'images/icon_card.png'], groupItem: GroupListItem(), child: ListView.separated( diff --git a/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart b/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart index c1e39e82..5b07ec57 100644 --- a/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart @@ -75,12 +75,14 @@ class _AdministratorAssociationLockPageState onTap: () { }, + isShowBtn: false, typeImgList: const [], groupItem: getItemData, child: massSendLockGroupCell(index, currentIndex: index, lockListByGroup: lockItemList, isVip: true, + isShowBtn: false, selectLockAction: (int selectIndex, String selectLockId) { }), diff --git a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart index d4c5f5e9..1db23f2b 100755 --- a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart +++ b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart @@ -12,31 +12,33 @@ class GroupEditLockLogic extends BaseGetXController { //锁分组里面添加锁 Future lockGroupAddLock(List lockIds) async { if (lockIds.isEmpty) { - showToast("请选择锁".tr); + showToast('请选择锁'.tr); return; } var entity = await ApiRepository.to.lockGroupAddLock( lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!); if (entity.errorCode!.codeIsSuccessful) { - showToast("添加成功"); - eventBus.fire(LockGroupEditGroupLockRefreshEvent()); - eventBus.fire(RefreshLockListInfoDataEvent()); - Get.close(2); + showToast('添加成功', something: () { + eventBus.fire(LockGroupEditGroupLockRefreshEvent()); + eventBus.fire(RefreshLockListInfoDataEvent()); + Get.close(2); + }); } } //锁分组里面添加锁 Future lockGroupDeletLock(List lockIds) async { if (lockIds.isEmpty) { - showToast("请选择锁".tr); + showToast('请选择锁'.tr); return; } var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds); if (entity.errorCode!.codeIsSuccessful) { - showToast("删除成功"); - eventBus.fire(LockGroupEditGroupLockRefreshEvent()); - eventBus.fire(RefreshLockListInfoDataEvent()); - Get.close(2); + showToast('删除成功', something: () { + eventBus.fire(LockGroupEditGroupLockRefreshEvent()); + eventBus.fire(RefreshLockListInfoDataEvent()); + Get.close(2); + }); } } diff --git a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart index 4201afa9..82584030 100755 --- a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart +++ b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; +import 'package:star_lock/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart'; import 'package:star_lock/tools/showCupertinoAlertView.dart'; import 'package:star_lock/tools/noData.dart'; @@ -19,8 +20,8 @@ class GroupEditLockPage extends StatefulWidget { } class _GroupEditLockPageState extends State { - final logic = Get.put(GroupEditLockLogic()); - final state = Get.find().state; + final GroupEditLockLogic logic = Get.put(GroupEditLockLogic()); + final GroupEditLockState state = Get.find().state; @override Widget build(BuildContext context) { @@ -33,15 +34,15 @@ class _GroupEditLockPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor), body: Column( - children: [ + children: [ Obx(() => Visibility( - visible: state.isVip.value ? false : true, + visible: !state.isVip.value, child: ShowCupertinoAlertView() .topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))), Container( margin: EdgeInsets.all(15.w), child: Row( - children: [ + children: [ Text( TranslationLoader .lanKeys!.selectTheLockToJoinTheGroup!.tr, @@ -51,13 +52,13 @@ class _GroupEditLockPageState extends State { ), Expanded(child: _buildMainUI()), Obx(() => Visibility( - visible: state.isVip.value ? true : false, + visible: state.isVip.value, child: SubmitBtn( btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () async { - var idList = []; + final List idList = []; for (int i = 0; i < state.lockList.length; i++) { - LockListItem lockListItem = state.lockList[i]; + final LockListItem lockListItem = state.lockList[i]; if (lockListItem.isChecked == true) { idList.add(lockListItem.lockId); } @@ -78,8 +79,8 @@ class _GroupEditLockPageState extends State { Widget _buildMainUI() { return state.lockList.isNotEmpty ? ListView.separated( - itemBuilder: (context, index) { - LockListItem itemData = state.lockList[index]; + itemBuilder: (BuildContext context, int index) { + final LockListItem itemData = state.lockList[index]; return _listItemView(itemData); }, itemCount: state.lockList.length, @@ -109,24 +110,35 @@ class _GroupEditLockPageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, - children: [ + children: [ SizedBox( width: 20.w, ), Image.asset( 'images/icon_lockGroup_item.png', - width: 36, - height: 36, + width: 50.w, + height: 50.w, fit: BoxFit.fill, ), SizedBox( width: 10.w, ), - Text( - itemData.lockAlias ?? '', - style: TextStyle(fontSize: 24.sp), + Expanded( + child: SizedBox( + width: 1.sw - 80.w - 75.w, + child: Text( + itemData.lockAlias ?? '', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 24.sp), + ) + ) ), - Expanded(child: SizedBox(width: 10.w)), + // Text( + // itemData.lockAlias ?? '', + // style: TextStyle(fontSize: 24.sp), + // ), + SizedBox(width: 10.w), Image.asset( itemData.isChecked ? 'images/icon_round_select.png' diff --git a/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart b/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart index 45b6ce69..5614c69a 100755 --- a/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart +++ b/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart @@ -108,17 +108,22 @@ class _LockItemListPageState extends State { ), Image.asset( 'images/icon_lockGroup_item.png', - width: 36, - height: 36, + width: 50.w, + height: 50.w, fit: BoxFit.fill, ), SizedBox( width: 10.w, ), - Text( - itemData.lockAlias ?? '', - style: TextStyle(fontSize: 24.sp), - ) + Expanded(child: + Text(itemData.lockAlias ?? '', + style: TextStyle(fontSize: 24.sp), + ) + ), + // Text( + // itemData.lockAlias ?? '', + // style: TextStyle(fontSize: 24.sp), + // ) ], ), ), @@ -142,7 +147,6 @@ class _LockItemListPageState extends State { } else if (getSelectIndex == 1) { Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 1}); } - }, ); }); diff --git a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_logic.dart b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_logic.dart index ad25b09c..0d807613 100755 --- a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_logic.dart +++ b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_logic.dart @@ -13,8 +13,8 @@ class LockGroupListLogic extends BaseGetXController { final LockGroupListState state = LockGroupListState(); //分组列表请求 - void mockNetworkDataRequest() async { - var entity = await ApiRepository.to.lockGroupList('0'); + Future mockNetworkDataRequest() async { + final MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('0'); if (entity.errorCode!.codeIsSuccessful) { if (entity.data != null) { state.lockNum = 0; @@ -25,58 +25,53 @@ class LockGroupListLogic extends BaseGetXController { //创建锁分组请求 Future addLockGroupRequest() async { - MassSendLockGroupListEntity entity = + final MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0'); if (entity.errorCode!.codeIsSuccessful) { - showToast("创建成功".tr); - mockNetworkDataRequest(); + showToast('创建成功'.tr, something: (){ + mockNetworkDataRequest(); + }); } } //编辑锁名字 Future editLockGroupRequest(int groupId) async { - var entity = await ApiRepository.to.editLockGroupRequest(groupId:groupId, groupName:state.changeNameController.text); + final MassSendLockGroupListEntity entity = await ApiRepository.to.editLockGroupRequest(groupId:groupId, groupName:state.changeNameController.text); if (entity.errorCode!.codeIsSuccessful) { - showToast("编辑成功".tr); - mockNetworkDataRequest(); + showToast('编辑成功'.tr, something: (){ + mockNetworkDataRequest(); + }); } } //删除组 Future deleteLockGroupRequest(int groupId) async { - var entity = await ApiRepository.to.deleteGroup(groupId); + final MassSendLockGroupListEntity entity = await ApiRepository.to.deleteGroup(groupId); if (entity.errorCode!.codeIsSuccessful) { - showToast("删除成功".tr); - mockNetworkDataRequest(); + showToast('删除成功'.tr, something: (){ + mockNetworkDataRequest(); + }); } } // 监听修改完详情之后刷新列表 late StreamSubscription _teamEvent; void _initRefreshAction() { - _teamEvent = eventBus.on().listen((event) { + _teamEvent = eventBus.on().listen((LockGroupEditGroupLockRefreshEvent event) { mockNetworkDataRequest(); }); } @override void onReady() { - // TODO: implement onReady super.onReady(); _initRefreshAction(); mockNetworkDataRequest(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - @override void onClose() { - // TODO: implement onClose _teamEvent.cancel(); } diff --git a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart index ddef1726..83eb78ce 100755 --- a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart +++ b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; +import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart'; import 'package:star_lock/tools/showTipView.dart'; import '../../../../../../appRouters.dart'; @@ -11,7 +12,6 @@ import '../../../../../../tools/titleAppBar.dart'; import '../../../../../../translations/trans_lib.dart'; import '../../../../tools/left_slide_actions.dart'; import '../../../../tools/noData.dart'; -import '../../../../tools/showIosTipView.dart'; import 'lockGroupList_logic.dart'; class LockGroupListPage extends StatefulWidget { @@ -22,8 +22,8 @@ class LockGroupListPage extends StatefulWidget { } class _LockGroupListPageState extends State { - final logic = Get.put(LockGroupListLogic()); - final state = Get.find().state; + final LockGroupListLogic logic = Get.put(LockGroupListLogic()); + final LockGroupListState state = Get.find().state; @override Widget build(BuildContext context) { @@ -32,7 +32,7 @@ class _LockGroupListPageState extends State { appBar: TitleAppBar( barTitle: TranslationLoader.lanKeys!.lockGroup!.tr, haveBack: true, - actionsList: [ + actionsList: [ IconButton( icon: Image.asset( 'images/icon_add_white.png', @@ -41,7 +41,7 @@ class _LockGroupListPageState extends State { ), onPressed: () { // 处理操作按钮的点击事件-添加锁分组 - state.changeNameController.text = ""; + state.changeNameController.text = ''; // showCupertinoAlertDialog(context, true, 0); ShowTipView().showTFViewAlertDialog( state.changeNameController, @@ -61,7 +61,7 @@ class _LockGroupListPageState extends State { ], backgroundColor: AppColors.mainColor), body: Column( - children: [ + children: [ Expanded( child: Obx(() => state.itemDataList.value.isEmpty ? NoData() @@ -73,16 +73,16 @@ class _LockGroupListPageState extends State { Widget _buildMainUI() { for (int i = 0; i < state.itemDataList.value.length; i++) { - GroupListItem itemData = state.itemDataList.value[i]; + final GroupListItem itemData = state.itemDataList.value[i]; state.lockNum += itemData.lockList!.length; } return ListView.separated( itemCount: state.itemDataList.value.length + 1, - itemBuilder: (c, index) { + itemBuilder: (BuildContext c, int index) { if (index == state.itemDataList.value.length) { return Center( child: Column( - children: [ + children: [ SizedBox( height: 20.h, ), @@ -98,7 +98,7 @@ class _LockGroupListPageState extends State { ), ); } else { - GroupListItem itemData = state.itemDataList.value[index]; + final GroupListItem itemData = state.itemDataList.value[index]; if (itemData.groupType == 0) { state.ungrouped = itemData; } @@ -107,23 +107,22 @@ class _LockGroupListPageState extends State { key: Key(itemData.keyGroupId!.toString()), actionsWidth: itemData.groupType != 0 ? 200.w : 0, actions: itemData.groupType != 0 - ? [ + ? [ _buildEditBtn(itemData), _buildDeleteBtn(itemData), ] - : [], + : [], decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(1)), ), child: CommonItem( - leftTitel: - '${itemData.keyGroupName}(${itemData.lockList?.length})', - rightTitle: "", + leftTitel: '${itemData.keyGroupName}(${itemData.lockList?.length})', + rightTitle: '', allHeight: 70.h, action: () { - Get.toNamed(Routers.lockItemListPage, arguments: { + Get.toNamed(Routers.lockItemListPage, arguments: { 'groupListItem': itemData, - "ungrouped": state.ungrouped + 'ungrouped': state.ungrouped }); }), ); @@ -139,41 +138,12 @@ class _LockGroupListPageState extends State { }); } - // void showCupertinoAlertDialog(BuildContext context, bool isAdd, int groupId) { - // showDialog( - // context: context, - // builder: (BuildContext context) { - // return ShowTFView( - // title: isAdd ? TranslationLoader.lanKeys!.createNewGroup!.tr : "修改名称", - // tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr, - // controller: state.changeNameController, - // sureClick: () { - // //发送编辑钥匙名称请求 - // if (state.changeNameController.text.isNotEmpty) { - // if(isAdd == true){ - // logic.addLockGroupRequest(); - // }else{ - // logic.editLockGroupRequest(groupId); - // } - // Get.back(); - // } else { - // logic.showToast(TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr); - // } - // }, - // cancelClick: () { - // Get.back(); - // }, - // ); - // }, - // ); - // } - Widget _buildDeleteBtn(GroupListItem groupListItem) { return GestureDetector( onTap: () { // 省略: 弹出是否删除的确认对话框。 // showIosTipViewDialog(context, groupListItem); - ShowTipView().showIosTipWithContentDialog("分组下的锁将被移到未分组里".tr, () { + ShowTipView().showIosTipWithContentDialog('分组下的锁将被移到未分组里'.tr, () { logic.deleteLockGroupRequest(groupListItem.keyGroupId!); }); }, @@ -203,9 +173,10 @@ class _LockGroupListPageState extends State { ShowTipView().showTFViewAlertDialog( state.changeNameController, - TranslationLoader.lanKeys!.createNewGroup!.tr, + '修改名称'.tr, TranslationLoader.lanKeys!.pleaseEnter!.tr, () { if (state.changeNameController.text.isNotEmpty) { + Get.back(); logic.editLockGroupRequest(groupListItem.keyGroupId!); } else { logic.showToast( @@ -218,7 +189,7 @@ class _LockGroupListPageState extends State { color: AppColors.mainColor, alignment: Alignment.center, child: Text( - "重命名".tr, + '重命名'.tr, style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w500, @@ -229,23 +200,4 @@ class _LockGroupListPageState extends State { ), ); } - - // void showIosTipViewDialog(BuildContext context, GroupListItem groupListItem) { - // showDialog( - // context: context, - // builder: (BuildContext context) { - // return ShowIosTipView( - // title: TranslationLoader.lanKeys!.hint!.tr, - // tipTitle: "分组下的锁将被移到未分组里", - // sureClick: () { - // Get.back(); - // logic.deleteLockGroupRequest(groupListItem.keyGroupId!); - // }, - // cancelClick: () { - // Get.back(); - // }, - // ); - // } - // ); - // } } diff --git a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart index 15d1423c..b4524f74 100755 --- a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart +++ b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart @@ -6,8 +6,8 @@ import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSend class LockGroupListState { TextEditingController changeNameController = TextEditingController(); - var itemDataList = [].obs; + RxList itemDataList = [].obs; int lockNum = 0; - var ungrouped = GroupListItem(); + GroupListItem ungrouped = GroupListItem(); } \ No newline at end of file diff --git a/lib/tools/ExpandedListView.dart b/lib/tools/ExpandedListView.dart index cd3a8724..618f484f 100755 --- a/lib/tools/ExpandedListView.dart +++ b/lib/tools/ExpandedListView.dart @@ -7,17 +7,16 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma class ExpandedListTile extends StatefulWidget { const ExpandedListTile( - {Key? key, + {required this.isShowBtn, required this.groupItem, required this.typeImgList, Key? key, this.child, - this.onTap, - required this.groupItem, - required this.typeImgList}) + this.onTap}) : super(key: key); final Widget? child; final List typeImgList; final Function()? onTap; final GroupListItem groupItem; + final bool isShowBtn; @override _ExpandedListTileState createState() => _ExpandedListTileState(); @@ -53,44 +52,48 @@ class _ExpandedListTileState extends State { List _buildExpandRowList() { List widgetList = []; - widgetList.add(GestureDetector( - child: Container( - color: Colors.white, - width: 80.w, - child: Row( - children: [ - SizedBox( - width: 30.w, - ), - Image.asset( - _isCheck - ? "images/icon_round_select.png" - : "images/icon_round_unSelect.png", - width: 30.w, - height: 30.w, - color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey, - ), - SizedBox( - width: 20.w, - ) - ], + + if(widget.isShowBtn){ + widgetList.add(GestureDetector( + child: Container( + color: Colors.white, + width: 80.w, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + _isCheck + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 30.w, + height: 30.w, + color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey, + ), + SizedBox( + width: 20.w, + ) + ], + ), ), - ), - onTap: () { - if (widget.groupItem.isVip == false) { - return; - } - //点击左侧是否勾选按钮 - setState(() { - _isCheck = !_isCheck; - widget.groupItem.isChecked = _isCheck; - }); - widget.onTap?.call(); - }, - )); + onTap: () { + if (widget.groupItem.isVip == false) { + return; + } + //点击左侧是否勾选按钮 + setState(() { + _isCheck = !_isCheck; + widget.groupItem.isChecked = _isCheck; + }); + widget.onTap?.call(); + }, + )); + } + widgetList.add(GestureDetector( child: Container( - width: ScreenUtil().screenWidth - 80.w, + width: ScreenUtil().screenWidth - (widget.isShowBtn ? 80.w : 0), color: Colors.white, child: Row( children: [ @@ -100,7 +103,7 @@ class _ExpandedListTileState extends State { // height: 36.w, // ), SizedBox( - width: 10.w, + width: widget.isShowBtn ? 10.w :30.w, ), Text( widget.groupItem.keyGroupName ?? '',