1、修改锁分组bug。2、修改群发电子钥匙问题
This commit is contained in:
parent
54db74b4ba
commit
436ee3d50f
@ -325,21 +325,13 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
import 'volumeAuthorizationLock_state.dart';
|
import 'volumeAuthorizationLock_state.dart';
|
||||||
|
|
||||||
class VolumeAuthorizationLockLogic extends BaseGetXController {
|
class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||||
@ -46,11 +46,13 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
} else {
|
} else {
|
||||||
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
|
|
||||||
if (entity.errorCode == 425) {
|
if (entity.errorCode == 425) {
|
||||||
//用户未注册
|
//用户未注册
|
||||||
state.isCreateUser.value = true;
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
addAuthorizedAdminRequest();
|
'${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}', () {
|
||||||
|
state.isCreateUser.value = true;
|
||||||
|
addAuthorizedAdminRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,12 +11,14 @@ class massSendLockGroupCell extends StatelessWidget {
|
|||||||
required this.lockListByGroup,
|
required this.lockListByGroup,
|
||||||
required this.selectLockAction,
|
required this.selectLockAction,
|
||||||
required this.isVip,
|
required this.isVip,
|
||||||
|
required this.isShowBtn,
|
||||||
Key? key})
|
Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
List lockListByGroup;
|
List lockListByGroup;
|
||||||
final _CallBack selectLockAction;
|
final _CallBack selectLockAction;
|
||||||
bool isVip;
|
bool isVip;
|
||||||
|
bool isShowBtn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -65,26 +67,28 @@ class massSendLockGroupCell extends StatelessWidget {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
)),
|
)),
|
||||||
Image.asset(
|
Visibility(
|
||||||
itemData.isChecked
|
visible: isShowBtn,
|
||||||
? 'images/icon_round_select.png'
|
child: Image.asset(
|
||||||
: 'images/icon_round_unSelect.png',
|
itemData.isChecked
|
||||||
width: 30.w,
|
? 'images/icon_round_select.png'
|
||||||
height: 30.w,
|
: 'images/icon_round_unSelect.png',
|
||||||
color: !isVip ? Colors.grey : AppColors.mainColor,
|
width: 30.w,
|
||||||
),
|
height: 30.w,
|
||||||
|
color: !isVip ? Colors.grey : AppColors.mainColor,
|
||||||
|
),),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: isShowBtn ? () {
|
||||||
if (isVip == false) {
|
if (isVip == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectLockAction(itemIndex, itemData.lockId.toString());
|
selectLockAction(itemIndex, itemData.lockId.toString());
|
||||||
},
|
} : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,12 +131,14 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
|||||||
}
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
|
isShowBtn: true,
|
||||||
typeImgList: const [],
|
typeImgList: const [],
|
||||||
groupItem: itemData,
|
groupItem: itemData,
|
||||||
child: massSendLockGroupCell(index,
|
child: massSendLockGroupCell(index,
|
||||||
currentIndex: index,
|
currentIndex: index,
|
||||||
lockListByGroup: lockItemList,
|
lockListByGroup: lockItemList,
|
||||||
isVip: state.isVip.value,
|
isVip: state.isVip.value,
|
||||||
|
isShowBtn: true,
|
||||||
selectLockAction: (selectIndex, selectLockId) {
|
selectLockAction: (selectIndex, selectLockId) {
|
||||||
LockListItem lockItem = lockItemList[selectIndex];
|
LockListItem lockItem = lockItemList[selectIndex];
|
||||||
lockItem.isChecked = !lockItem.isChecked;
|
lockItem.isChecked = !lockItem.isChecked;
|
||||||
|
|||||||
@ -174,6 +174,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
|
|||||||
},
|
},
|
||||||
// title: deviceName,
|
// title: deviceName,
|
||||||
// imgName: 'images/icon_lock.png',
|
// imgName: 'images/icon_lock.png',
|
||||||
|
isShowBtn: true,
|
||||||
typeImgList: const [],
|
typeImgList: const [],
|
||||||
groupItem: GroupListItem(),
|
groupItem: GroupListItem(),
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
@ -214,6 +215,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
|
|||||||
},
|
},
|
||||||
// title: deviceName,
|
// title: deviceName,
|
||||||
// imgName: 'images/controls_user.png',
|
// imgName: 'images/controls_user.png',
|
||||||
|
isShowBtn: true,
|
||||||
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
|
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
|
||||||
groupItem: GroupListItem(),
|
groupItem: GroupListItem(),
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
|
|||||||
@ -75,12 +75,14 @@ class _AdministratorAssociationLockPageState
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
isShowBtn: false,
|
||||||
typeImgList: const [],
|
typeImgList: const [],
|
||||||
groupItem: getItemData,
|
groupItem: getItemData,
|
||||||
child: massSendLockGroupCell(index,
|
child: massSendLockGroupCell(index,
|
||||||
currentIndex: index,
|
currentIndex: index,
|
||||||
lockListByGroup: lockItemList,
|
lockListByGroup: lockItemList,
|
||||||
isVip: true,
|
isVip: true,
|
||||||
|
isShowBtn: false,
|
||||||
selectLockAction: (int selectIndex, String selectLockId) {
|
selectLockAction: (int selectIndex, String selectLockId) {
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -12,31 +12,33 @@ class GroupEditLockLogic extends BaseGetXController {
|
|||||||
//锁分组里面添加锁
|
//锁分组里面添加锁
|
||||||
Future<void> lockGroupAddLock(List lockIds) async {
|
Future<void> lockGroupAddLock(List lockIds) async {
|
||||||
if (lockIds.isEmpty) {
|
if (lockIds.isEmpty) {
|
||||||
showToast("请选择锁".tr);
|
showToast('请选择锁'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.lockGroupAddLock(
|
var entity = await ApiRepository.to.lockGroupAddLock(
|
||||||
lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!);
|
lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("添加成功");
|
showToast('添加成功', something: () {
|
||||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
Get.close(2);
|
Get.close(2);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//锁分组里面添加锁
|
//锁分组里面添加锁
|
||||||
Future<void> lockGroupDeletLock(List lockIds) async {
|
Future<void> lockGroupDeletLock(List lockIds) async {
|
||||||
if (lockIds.isEmpty) {
|
if (lockIds.isEmpty) {
|
||||||
showToast("请选择锁".tr);
|
showToast('请选择锁'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds);
|
var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功");
|
showToast('删除成功', something: () {
|
||||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
Get.close(2);
|
Get.close(2);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
@ -19,8 +20,8 @@ class GroupEditLockPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||||
final logic = Get.put(GroupEditLockLogic());
|
final GroupEditLockLogic logic = Get.put(GroupEditLockLogic());
|
||||||
final state = Get.find<GroupEditLockLogic>().state;
|
final GroupEditLockState state = Get.find<GroupEditLockLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -33,15 +34,15 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
|||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? false : true,
|
visible: !state.isVip.value,
|
||||||
child: ShowCupertinoAlertView()
|
child: ShowCupertinoAlertView()
|
||||||
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.all(15.w),
|
margin: EdgeInsets.all(15.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
TranslationLoader
|
TranslationLoader
|
||||||
.lanKeys!.selectTheLockToJoinTheGroup!.tr,
|
.lanKeys!.selectTheLockToJoinTheGroup!.tr,
|
||||||
@ -51,13 +52,13 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
|||||||
),
|
),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.isVip.value ? true : false,
|
visible: state.isVip.value,
|
||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var idList = [];
|
final List idList = [];
|
||||||
for (int i = 0; i < state.lockList.length; i++) {
|
for (int i = 0; i < state.lockList.length; i++) {
|
||||||
LockListItem lockListItem = state.lockList[i];
|
final LockListItem lockListItem = state.lockList[i];
|
||||||
if (lockListItem.isChecked == true) {
|
if (lockListItem.isChecked == true) {
|
||||||
idList.add(lockListItem.lockId);
|
idList.add(lockListItem.lockId);
|
||||||
}
|
}
|
||||||
@ -78,8 +79,8 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
|||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return state.lockList.isNotEmpty
|
return state.lockList.isNotEmpty
|
||||||
? ListView.separated(
|
? ListView.separated(
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
LockListItem itemData = state.lockList[index];
|
final LockListItem itemData = state.lockList[index];
|
||||||
return _listItemView(itemData);
|
return _listItemView(itemData);
|
||||||
},
|
},
|
||||||
itemCount: state.lockList.length,
|
itemCount: state.lockList.length,
|
||||||
@ -109,24 +110,35 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_lockGroup_item.png',
|
'images/icon_lockGroup_item.png',
|
||||||
width: 36,
|
width: 50.w,
|
||||||
height: 36,
|
height: 50.w,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Expanded(
|
||||||
itemData.lockAlias ?? '',
|
child: SizedBox(
|
||||||
style: TextStyle(fontSize: 24.sp),
|
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(
|
Image.asset(
|
||||||
itemData.isChecked
|
itemData.isChecked
|
||||||
? 'images/icon_round_select.png'
|
? 'images/icon_round_select.png'
|
||||||
|
|||||||
@ -108,17 +108,22 @@ class _LockItemListPageState extends State<LockItemListPage> {
|
|||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_lockGroup_item.png',
|
'images/icon_lockGroup_item.png',
|
||||||
width: 36,
|
width: 50.w,
|
||||||
height: 36,
|
height: 50.w,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Expanded(child:
|
||||||
itemData.lockAlias ?? '',
|
Text(itemData.lockAlias ?? '',
|
||||||
style: TextStyle(fontSize: 24.sp),
|
style: TextStyle(fontSize: 24.sp),
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
// Text(
|
||||||
|
// itemData.lockAlias ?? '',
|
||||||
|
// style: TextStyle(fontSize: 24.sp),
|
||||||
|
// )
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -142,7 +147,6 @@ class _LockItemListPageState extends State<LockItemListPage> {
|
|||||||
} else if (getSelectIndex == 1) {
|
} else if (getSelectIndex == 1) {
|
||||||
Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 1});
|
Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -13,8 +13,8 @@ class LockGroupListLogic extends BaseGetXController {
|
|||||||
final LockGroupListState state = LockGroupListState();
|
final LockGroupListState state = LockGroupListState();
|
||||||
|
|
||||||
//分组列表请求
|
//分组列表请求
|
||||||
void mockNetworkDataRequest() async {
|
Future<void> mockNetworkDataRequest() async {
|
||||||
var entity = await ApiRepository.to.lockGroupList('0');
|
final MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (entity.data != null) {
|
if (entity.data != null) {
|
||||||
state.lockNum = 0;
|
state.lockNum = 0;
|
||||||
@ -25,58 +25,53 @@ class LockGroupListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//创建锁分组请求
|
//创建锁分组请求
|
||||||
Future<void> addLockGroupRequest() async {
|
Future<void> addLockGroupRequest() async {
|
||||||
MassSendLockGroupListEntity entity =
|
final MassSendLockGroupListEntity entity =
|
||||||
await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
|
await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("创建成功".tr);
|
showToast('创建成功'.tr, something: (){
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//编辑锁名字
|
//编辑锁名字
|
||||||
Future<void> editLockGroupRequest(int groupId) async {
|
Future<void> 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) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("编辑成功".tr);
|
showToast('编辑成功'.tr, something: (){
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除组
|
//删除组
|
||||||
Future<void> deleteLockGroupRequest(int groupId) async {
|
Future<void> deleteLockGroupRequest(int groupId) async {
|
||||||
var entity = await ApiRepository.to.deleteGroup(groupId);
|
final MassSendLockGroupListEntity entity = await ApiRepository.to.deleteGroup(groupId);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功".tr);
|
showToast('删除成功'.tr, something: (){
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<LockGroupEditGroupLockRefreshEvent>().listen((event) {
|
_teamEvent = eventBus.on<LockGroupEditGroupLockRefreshEvent>().listen((LockGroupEditGroupLockRefreshEvent event) {
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
_initRefreshAction();
|
_initRefreshAction();
|
||||||
|
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../../../../appRouters.dart';
|
import '../../../../../../appRouters.dart';
|
||||||
@ -11,7 +12,6 @@ import '../../../../../../tools/titleAppBar.dart';
|
|||||||
import '../../../../../../translations/trans_lib.dart';
|
import '../../../../../../translations/trans_lib.dart';
|
||||||
import '../../../../tools/left_slide_actions.dart';
|
import '../../../../tools/left_slide_actions.dart';
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
|
||||||
import 'lockGroupList_logic.dart';
|
import 'lockGroupList_logic.dart';
|
||||||
|
|
||||||
class LockGroupListPage extends StatefulWidget {
|
class LockGroupListPage extends StatefulWidget {
|
||||||
@ -22,8 +22,8 @@ class LockGroupListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _LockGroupListPageState extends State<LockGroupListPage> {
|
class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||||
final logic = Get.put(LockGroupListLogic());
|
final LockGroupListLogic logic = Get.put(LockGroupListLogic());
|
||||||
final state = Get.find<LockGroupListLogic>().state;
|
final LockGroupListState state = Get.find<LockGroupListLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -32,7 +32,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.lockGroup!.tr,
|
barTitle: TranslationLoader.lanKeys!.lockGroup!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'images/icon_add_white.png',
|
'images/icon_add_white.png',
|
||||||
@ -41,7 +41,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// 处理操作按钮的点击事件-添加锁分组
|
// 处理操作按钮的点击事件-添加锁分组
|
||||||
state.changeNameController.text = "";
|
state.changeNameController.text = '';
|
||||||
// showCupertinoAlertDialog(context, true, 0);
|
// showCupertinoAlertDialog(context, true, 0);
|
||||||
ShowTipView().showTFViewAlertDialog(
|
ShowTipView().showTFViewAlertDialog(
|
||||||
state.changeNameController,
|
state.changeNameController,
|
||||||
@ -61,7 +61,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
],
|
],
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(() => state.itemDataList.value.isEmpty
|
child: Obx(() => state.itemDataList.value.isEmpty
|
||||||
? NoData()
|
? NoData()
|
||||||
@ -73,16 +73,16 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
for (int i = 0; i < state.itemDataList.value.length; i++) {
|
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;
|
state.lockNum += itemData.lockList!.length;
|
||||||
}
|
}
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
itemCount: state.itemDataList.value.length + 1,
|
itemCount: state.itemDataList.value.length + 1,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
if (index == state.itemDataList.value.length) {
|
if (index == state.itemDataList.value.length) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -98,7 +98,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
GroupListItem itemData = state.itemDataList.value[index];
|
final GroupListItem itemData = state.itemDataList.value[index];
|
||||||
if (itemData.groupType == 0) {
|
if (itemData.groupType == 0) {
|
||||||
state.ungrouped = itemData;
|
state.ungrouped = itemData;
|
||||||
}
|
}
|
||||||
@ -107,23 +107,22 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
key: Key(itemData.keyGroupId!.toString()),
|
key: Key(itemData.keyGroupId!.toString()),
|
||||||
actionsWidth: itemData.groupType != 0 ? 200.w : 0,
|
actionsWidth: itemData.groupType != 0 ? 200.w : 0,
|
||||||
actions: itemData.groupType != 0
|
actions: itemData.groupType != 0
|
||||||
? [
|
? <Widget>[
|
||||||
_buildEditBtn(itemData),
|
_buildEditBtn(itemData),
|
||||||
_buildDeleteBtn(itemData),
|
_buildDeleteBtn(itemData),
|
||||||
]
|
]
|
||||||
: [],
|
: <Widget>[],
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||||
),
|
),
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel:
|
leftTitel: '${itemData.keyGroupName}(${itemData.lockList?.length})',
|
||||||
'${itemData.keyGroupName}(${itemData.lockList?.length})',
|
rightTitle: '',
|
||||||
rightTitle: "",
|
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.lockItemListPage, arguments: {
|
Get.toNamed(Routers.lockItemListPage, arguments: <String, GroupListItem>{
|
||||||
'groupListItem': itemData,
|
'groupListItem': itemData,
|
||||||
"ungrouped": state.ungrouped
|
'ungrouped': state.ungrouped
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -139,41 +138,12 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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) {
|
Widget _buildDeleteBtn(GroupListItem groupListItem) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// 省略: 弹出是否删除的确认对话框。
|
// 省略: 弹出是否删除的确认对话框。
|
||||||
// showIosTipViewDialog(context, groupListItem);
|
// showIosTipViewDialog(context, groupListItem);
|
||||||
ShowTipView().showIosTipWithContentDialog("分组下的锁将被移到未分组里".tr, () {
|
ShowTipView().showIosTipWithContentDialog('分组下的锁将被移到未分组里'.tr, () {
|
||||||
logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -203,9 +173,10 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
|
|
||||||
ShowTipView().showTFViewAlertDialog(
|
ShowTipView().showTFViewAlertDialog(
|
||||||
state.changeNameController,
|
state.changeNameController,
|
||||||
TranslationLoader.lanKeys!.createNewGroup!.tr,
|
'修改名称'.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
|
TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
|
||||||
if (state.changeNameController.text.isNotEmpty) {
|
if (state.changeNameController.text.isNotEmpty) {
|
||||||
|
Get.back();
|
||||||
logic.editLockGroupRequest(groupListItem.keyGroupId!);
|
logic.editLockGroupRequest(groupListItem.keyGroupId!);
|
||||||
} else {
|
} else {
|
||||||
logic.showToast(
|
logic.showToast(
|
||||||
@ -218,7 +189,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
"重命名".tr,
|
'重命名'.tr,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@ -229,23 +200,4 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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();
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSend
|
|||||||
class LockGroupListState {
|
class LockGroupListState {
|
||||||
|
|
||||||
TextEditingController changeNameController = TextEditingController();
|
TextEditingController changeNameController = TextEditingController();
|
||||||
var itemDataList = <GroupListItem>[].obs;
|
RxList<GroupListItem> itemDataList = <GroupListItem>[].obs;
|
||||||
int lockNum = 0;
|
int lockNum = 0;
|
||||||
var ungrouped = GroupListItem();
|
GroupListItem ungrouped = GroupListItem();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -7,17 +7,16 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
|||||||
|
|
||||||
class ExpandedListTile extends StatefulWidget {
|
class ExpandedListTile extends StatefulWidget {
|
||||||
const ExpandedListTile(
|
const ExpandedListTile(
|
||||||
{Key? key,
|
{required this.isShowBtn, required this.groupItem, required this.typeImgList, Key? key,
|
||||||
this.child,
|
this.child,
|
||||||
this.onTap,
|
this.onTap})
|
||||||
required this.groupItem,
|
|
||||||
required this.typeImgList})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
final List typeImgList;
|
final List typeImgList;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
final GroupListItem groupItem;
|
final GroupListItem groupItem;
|
||||||
|
final bool isShowBtn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ExpandedListTileState createState() => _ExpandedListTileState();
|
_ExpandedListTileState createState() => _ExpandedListTileState();
|
||||||
@ -53,44 +52,48 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
|||||||
|
|
||||||
List<Widget> _buildExpandRowList() {
|
List<Widget> _buildExpandRowList() {
|
||||||
List<Widget> widgetList = [];
|
List<Widget> widgetList = [];
|
||||||
widgetList.add(GestureDetector(
|
|
||||||
child: Container(
|
if(widget.isShowBtn){
|
||||||
color: Colors.white,
|
widgetList.add(GestureDetector(
|
||||||
width: 80.w,
|
child: Container(
|
||||||
child: Row(
|
color: Colors.white,
|
||||||
children: [
|
width: 80.w,
|
||||||
SizedBox(
|
child: Row(
|
||||||
width: 30.w,
|
children: [
|
||||||
),
|
SizedBox(
|
||||||
Image.asset(
|
width: 30.w,
|
||||||
_isCheck
|
),
|
||||||
? "images/icon_round_select.png"
|
Image.asset(
|
||||||
: "images/icon_round_unSelect.png",
|
_isCheck
|
||||||
width: 30.w,
|
? 'images/icon_round_select.png'
|
||||||
height: 30.w,
|
: 'images/icon_round_unSelect.png',
|
||||||
color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey,
|
width: 30.w,
|
||||||
),
|
height: 30.w,
|
||||||
SizedBox(
|
color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey,
|
||||||
width: 20.w,
|
),
|
||||||
)
|
SizedBox(
|
||||||
],
|
width: 20.w,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
onTap: () {
|
||||||
onTap: () {
|
if (widget.groupItem.isVip == false) {
|
||||||
if (widget.groupItem.isVip == false) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
//点击左侧是否勾选按钮
|
||||||
//点击左侧是否勾选按钮
|
setState(() {
|
||||||
setState(() {
|
_isCheck = !_isCheck;
|
||||||
_isCheck = !_isCheck;
|
widget.groupItem.isChecked = _isCheck;
|
||||||
widget.groupItem.isChecked = _isCheck;
|
});
|
||||||
});
|
widget.onTap?.call();
|
||||||
widget.onTap?.call();
|
},
|
||||||
},
|
));
|
||||||
));
|
}
|
||||||
|
|
||||||
widgetList.add(GestureDetector(
|
widgetList.add(GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: ScreenUtil().screenWidth - 80.w,
|
width: ScreenUtil().screenWidth - (widget.isShowBtn ? 80.w : 0),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -100,7 +103,7 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
|||||||
// height: 36.w,
|
// height: 36.w,
|
||||||
// ),
|
// ),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: widget.isShowBtn ? 10.w :30.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
widget.groupItem.keyGroupName ?? '',
|
widget.groupItem.keyGroupName ?? '',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user