diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart index c0768789..c1f899bd 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart @@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity { } class Data { - int? receiverUid; + String? receiverUid; ReceiverUser? receiverUser; int? keyId; @@ -149,7 +149,7 @@ class Phone { class Cloud { String? username; String? password; - int? cloudUid; + String? cloudUid; int? userId; String? updatedAt; String? createdAt; diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminDetail/authorizedAdminDetail_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminDetail/authorizedAdminDetail_page.dart index 05410444..e872a383 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminDetail/authorizedAdminDetail_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminDetail/authorizedAdminDetail_page.dart @@ -2,13 +2,18 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../network/api_repository.dart'; import '../../../../tools/commonItem.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; +import '../../../../tools/toast.dart'; import '../../../../translations/trans_lib.dart'; +import '../../electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; class AuthorizedAdminDetailPage extends StatefulWidget { const AuthorizedAdminDetailPage({Key? key}) : super(key: key); @@ -89,7 +94,9 @@ class _AuthorizedAdminDetailPageState extends State { margin: EdgeInsets.only( left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () {}), + onClick: () { + showIosTipViewDialog(context); + }), ], ), ); @@ -228,6 +235,39 @@ class _AuthorizedAdminDetailPageState extends State { ], ), ); - }); + } + ); } + + void showIosTipViewDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + // deleteKeyRequest(); + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } + + //删除电子钥匙名称请求 + Future deleteKeyRequest(String keyId) async { + ElectronicKeyListEntity entity = + await ApiRepository.to.deleteElectronicKey(keyId); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "删除成功"); + setState(() { + Get.back(); + }); + } + } + } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart index c4a05ffe..3b99d8a3 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -3,6 +3,8 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../tools/toast.dart'; + class AuthorizedAdminListLogic extends BaseGetXController { final AuthorizedAdminListState state = AuthorizedAdminListState(); @@ -30,6 +32,16 @@ class AuthorizedAdminListLogic extends BaseGetXController { return dataList; } + //删除电子钥匙名称请求 + Future deleteKeyRequest(String keyId) async { + ElectronicKeyListEntity entity = + await ApiRepository.to.deleteElectronicKey(keyId); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "删除成功"); + mockNetworkDataRequest(); + } + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 31a49855..e1834dc2 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -9,6 +9,8 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/left_slide_actions.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -104,19 +106,75 @@ class _AuthorizedAdminListPageState extends State { } else { isAdminKey = false; } - return _electronicKeyItem('images/controls_user.png', - indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { - Navigator.pushNamed(context, Routers.electronicKeyDetailPage, - arguments: {'itemData': indexEntity}).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); - } - }); - }); + + if (index < getItemData.length) { + return LeftSlideActions( + // key: Key(indexEntity.lockId!.toString()), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(indexEntity), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _electronicKeyItem('images/controls_user.png', + indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { + Navigator.pushNamed(context, Routers.electronicKeyDetailPage, + arguments: {'itemData': indexEntity}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }), + ); + } + return const SizedBox.shrink(); }); } + Widget _buildDeleteBtn(ElectronicKeyListItem passwordKeyListItem) { + return GestureDetector( + onTap: () { + // 省略: 弹出是否删除的确认对话框。 + showIosTipViewDialog(context, passwordKeyListItem); + }, + child: Container( + width: 60, + color: const Color(0xFFF20101), + alignment: Alignment.center, + child: const Text( + '删除', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.white, + height: 1, + ), + ), + ), + ); + } + + void showIosTipViewDialog(BuildContext context, ElectronicKeyListItem passwordKeyListItem) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + logic.deleteKeyRequest(passwordKeyListItem.keyId.toString()); + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } + //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; @@ -173,12 +231,8 @@ class _AuthorizedAdminListPageState extends State { return GestureDetector( onTap: action, child: Container( - height: 90.h, - margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10.w), - ), + color: Colors.white, + height: 100.h, child: Row( children: [ SizedBox( @@ -197,31 +251,32 @@ class _AuthorizedAdminListPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( receiveUser, style: TextStyle( fontSize: 24.sp, color: AppColors.blackColor), ), - SizedBox( - width: 8.w, - ), - Container( - padding: EdgeInsets.only( - left: 4.w, right: 4.w, top: 1.w, bottom: 1.w), - decoration: BoxDecoration( - color: AppColors.toBeReceiveBgColor, - borderRadius: BorderRadius.circular(5.0), - ), - child: Text( - keyStatus, - style: TextStyle(color: Colors.red, fontSize: 16.sp), - ), - ) + SizedBox(width: 10.w), + // isAdminKey + // ? Image.asset( + // 'images/icon_electronicKey_admin.png', + // width: 24.w, + // height: 20.w, + // ) + // : Container(), + Expanded( + child: SizedBox( + width: 20.w, + )), + // Text( + // keyStatus, + // style: TextStyle(fontSize: 18.sp, color: Colors.red), + // ), ], ), - SizedBox(height: 5.h), + SizedBox(height: 10.h), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -243,4 +298,80 @@ class _AuthorizedAdminListPageState extends State { ), ); } + + // Widget _electronicKeyItem(String avatarURL, String receiveUser, + // String useDate, String keyStatus, bool isAdminKey, Function() action) { + // return GestureDetector( + // onTap: action, + // child: Container( + // height: 100.h, + // // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + // // decoration: BoxDecoration( + // // color: Colors.white, + // // borderRadius: BorderRadius.circular(10.w), + // // ), + // child: Row( + // children: [ + // SizedBox( + // width: 30.w, + // ), + // Image.asset( + // avatarURL, + // width: 60.w, + // height: 60.w, + // ), + // SizedBox( + // width: 20.w, + // ), + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Text( + // receiveUser, + // style: TextStyle( + // fontSize: 24.sp, color: AppColors.blackColor), + // ), + // SizedBox( + // width: 8.w, + // ), + // Container( + // padding: EdgeInsets.only( + // left: 4.w, right: 4.w, top: 1.w, bottom: 1.w), + // decoration: BoxDecoration( + // color: AppColors.toBeReceiveBgColor, + // borderRadius: BorderRadius.circular(5.0), + // ), + // child: Text( + // keyStatus, + // style: TextStyle(color: Colors.red, fontSize: 16.sp), + // ), + // ) + // ], + // ), + // SizedBox(height: 5.h), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Text( + // useDate, + // style: TextStyle( + // fontSize: 18.sp, + // color: AppColors.placeholderTextColor), + // ), + // ], + // ), + // SizedBox(width: 20.h), + // ], + // ), + // ), + // SizedBox(width: 20.h), + // ], + // ), + // ), + // ); + // } } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart index 29c639a9..4ebf9636 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart @@ -23,11 +23,13 @@ class CheckingInSetWorkTimeState{ getKeyInfosData.value = map["getKeyInfosData"]; companyId.value = map["companyId"]; checkingInSetInfo.value = map["checkingInSetInfo"]; + if(pushType.value != "0"){ + beginTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workStartTime.toString()); + endTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workEndTime.toString()); + beginTimeTimestamp.value = checkingInSetInfo.value.workStartTime.toString(); + endTimeTimestamp.value = checkingInSetInfo.value.workEndTime.toString(); + } - beginTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workStartTime.toString()); - endTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workEndTime.toString()); - beginTimeTimestamp.value = checkingInSetInfo.value.workStartTime.toString(); - endTimeTimestamp.value = checkingInSetInfo.value.workEndTime.toString(); } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index 5eb1d424..9eef9adb 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -13,6 +13,7 @@ import 'package:star_lock/tools/toast.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/commonItem.dart'; +import '../../../../../tools/showIosTipView.dart'; import '../../../../../tools/showTFView.dart'; import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/titleAppBar.dart'; @@ -131,7 +132,7 @@ class _ElectronicKeyDetailPageState extends State { left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () { - deleteKeyRequest(); + showIosTipViewDialog(context); }), ], ), @@ -152,11 +153,11 @@ class _ElectronicKeyDetailPageState extends State { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; + useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 永久'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n 单次'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; @@ -173,68 +174,68 @@ class _ElectronicKeyDetailPageState extends State { return senderDate; } - Widget commonItem(String leftTitle, String rightTitle, - {bool isHaveDirection = false, - bool isHaveLine = false, - bool isHaveRightWidget = false, - Widget? rightWidget, - Function()? action}) { - return GestureDetector( - onTap: action, - child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // height: 80.h, - color: Colors.white, - padding: EdgeInsets.only( - left: 20.w, right: 10.w, top: 20.w, bottom: 20.w), - child: Row( - children: [ - SizedBox(width: 20.w), - Text( - leftTitle, - style: - TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500), - ), - SizedBox(width: 20.w), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - isHaveRightWidget - ? rightWidget! - : Text( - rightTitle, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 28.sp, fontWeight: FontWeight.w500), - ) - ], - ), - ), - SizedBox(width: 5.w), - isHaveDirection - ? Image.asset( - 'images/icon_right.png', - width: 50.w, - height: 50.w, - ) - : SizedBox(width: 10.w), - // SizedBox(width:10.w), - ], - ), - ), - isHaveLine - ? Container( - height: 0.5.h, - color: Colors.grey, - ) - : Container() - ], - ), - ); - } + // Widget commonItem(String leftTitle, String rightTitle, + // {bool isHaveDirection = false, + // bool isHaveLine = false, + // bool isHaveRightWidget = false, + // Widget? rightWidget, + // Function()? action}) { + // return GestureDetector( + // onTap: action, + // child: Column( + // // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Container( + // // height: 80.h, + // color: Colors.white, + // padding: EdgeInsets.only( + // left: 20.w, right: 10.w, top: 20.w, bottom: 20.w), + // child: Row( + // children: [ + // SizedBox(width: 20.w), + // Text( + // leftTitle, + // style: + // TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500), + // ), + // SizedBox(width: 20.w), + // Expanded( + // child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // isHaveRightWidget + // ? rightWidget! + // : Text( + // rightTitle, + // textAlign: TextAlign.end, + // style: TextStyle( + // fontSize: 28.sp, fontWeight: FontWeight.w500), + // ) + // ], + // ), + // ), + // SizedBox(width: 5.w), + // isHaveDirection + // ? Image.asset( + // 'images/icon_right.png', + // width: 50.w, + // height: 50.w, + // ) + // : SizedBox(width: 10.w), + // // SizedBox(width:10.w), + // ], + // ), + // ), + // isHaveLine + // ? Container( + // height: 0.5.h, + // color: Colors.grey, + // ) + // : Container() + // ], + // ), + // ); + // } CupertinoSwitch _switch(isOn) { return CupertinoSwitch( @@ -299,4 +300,24 @@ class _ElectronicKeyDetailPageState extends State { }, ); } + + void showIosTipViewDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + deleteKeyRequest(); + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } + } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart index 106ea751..155e866f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart @@ -42,6 +42,17 @@ class ElectronicKeyListLogic extends BaseGetXController { } } + //删除电子钥匙名称请求 + Future deleteKeyRequest(String keyId) async { + ElectronicKeyListEntity entity = + await ApiRepository.to.deleteElectronicKey(keyId); + if (entity.errorCode!.codeIsSuccessful) { + print("删除电子钥匙成功"); + Toast.show(msg: "删除成功"); + mockNetworkDataRequest(); + } + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index fa746aca..b8d03e97 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -11,6 +11,8 @@ import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/toast.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/left_slide_actions.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -186,16 +188,30 @@ class _ElectronicKeyListPageState extends State { } else { isAdminKey = false; } - return _electronicKeyItem('images/controls_user.png', - indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { - Navigator.pushNamed(context, Routers.electronicKeyDetailPage, - arguments: {"itemData": indexEntity}).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); - } - }); - }); + + if (index < getItemData.length) { + return LeftSlideActions( + key: Key(indexEntity.lockAlias!), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(indexEntity.keyId.toString()), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _electronicKeyItem('images/controls_user.png', + indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { + Navigator.pushNamed(context, Routers.electronicKeyDetailPage, + arguments: {"itemData": indexEntity}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }), + ); + } + return const SizedBox.shrink(); }, separatorBuilder: (BuildContext context, int index) { return const Divider( @@ -206,6 +222,48 @@ class _ElectronicKeyListPageState extends State { ); } + Widget _buildDeleteBtn(String keyId) { + return GestureDetector( + onTap: () { + // 省略: 弹出是否删除的确认对话框。 + showIosTipViewDialog(context, keyId); + }, + child: Container( + width: 60, + color: const Color(0xFFF20101), + alignment: Alignment.center, + child: const Text( + '删除', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.white, + height: 1, + ), + ), + ), + ); + } + + void showIosTipViewDialog(BuildContext context, String keyId) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + logic.deleteKeyRequest(keyId); + }, + cancelClick: () { + Get.back(); + }, + ); + }, + ); + } + //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey_page.dart index 25746a17..e2c8b141 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey_page.dart @@ -165,7 +165,7 @@ class _MassSendElectronicKeyPageState extends State { getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString(); } var entity = - await ApiRepository.to.canSendKey(getFailureDateTime, [], _lockIdList); + await ApiRepository.to.canSendKey(getFailureDateTime, _lockIdList); if (entity.errorCode!.codeIsSuccessful) { for (int i = 0; i < _receiverList.length; i++) { LockUserData data = _receiverList[i]; @@ -270,7 +270,7 @@ class _MassSendElectronicKeyPageState extends State { if (value != null) { value as Map; _lockIdList = value['selectLockIdList']; - + print("_lockIdList:$_lockIdList"); setState(() {}); } }); diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart index 99a2bbda..509fcb1f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/utils.dart'; +import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; @@ -21,9 +21,9 @@ class MassSendLockGroupListPage extends StatefulWidget { class _MassSendLockGroupListPageState extends State { List lockGroupList = []; - List selectGroupIdList = []; + // List selectGroupIdList = []; List selectLockIdList = []; - int clickIndex = -1; + // int clickIndex = -1; @override void initState() { @@ -86,8 +86,7 @@ class _MassSendLockGroupListPageState extends State { //分组列表请求 Future> mockNetworkDataRequest() async { - MassSendLockGroupListEntity entity = - await ApiRepository.to.lockGroupList('1'); + MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1'); List dataList = []; if (entity.errorCode!.codeIsSuccessful) { if (entity.data != null) { @@ -120,19 +119,29 @@ class _MassSendLockGroupListPageState extends State { List lockItemList = itemData.lockList ?? []; return ExpandedListTile( onTap: () { - selectGroupIdList.add(index); - clickIndex = index; + // selectGroupIdList.add(index); + // clickIndex = index; //是否选中组 if (itemData.isChecked) { + var seletList = itemData.lockList; + for(LockListItem lockListItem in seletList!){ + lockListItem.isChecked = true; + selectLockIdList.add(lockListItem.lockId); + } // lockItemList[selectIndex] = + }else{ + var seletList = itemData.lockList; + for(LockListItem lockListItem in seletList!){ + lockListItem.isChecked = false; + selectLockIdList.remove(lockListItem.lockId); + } } + setState(() {}); print('选中了么0'); }, typeImgList: const [], groupItem: itemData, - child: massSendLockGroupCell(index, - currentIndex: index, lockListByGroup: lockItemList, - selectLockAction: (selectIndex, selectLockId) { + child: massSendLockGroupCell(index, currentIndex: index, lockListByGroup: lockItemList, selectLockAction: (selectIndex, selectLockId) { LockListItem lockItem = lockItemList[selectIndex]; setState(() { lockItem.isChecked = !lockItem.isChecked; @@ -143,4 +152,5 @@ class _MassSendLockGroupListPageState extends State { }), ); } + } diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart index ff2d1e9f..74334728 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart @@ -6,6 +6,8 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/translations/trans_lib.dart'; +import '../../../../../../app_settings/app_colors.dart'; + class MassSendReceiverCell extends StatelessWidget { final int currentIndex; LockUserData userData; @@ -28,11 +30,11 @@ class MassSendReceiverCell extends StatelessWidget { children: [ GestureDetector( child: SizedBox( - width: 40.w, + // width: 40.w, child: Row( children: [ SizedBox( - width: 10.w, + width: 20.w, ), Image.asset( 'images/icon_massSend_delete.png', @@ -51,7 +53,7 @@ class MassSendReceiverCell extends StatelessWidget { Expanded( child: Column( children: [ - CommonItem( + massSendReceiverCellWidget( leftTitel: TranslationLoader.lanKeys!.receiver!.tr, rightTitle: userData.userid ?? ' ', isHaveLine: true, @@ -61,7 +63,13 @@ class MassSendReceiverCell extends StatelessWidget { TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, 1, userData)), - CommonItem( + Divider( + color: AppColors.greyLineColor, + indent: 20.w, + endIndent: 20.w, + height: 1, + ), + massSendReceiverCellWidget( leftTitel: TranslationLoader.lanKeys!.name!.tr, rightTitle: userData.nickname ?? ' ', isHaveRightWidget: true, @@ -97,6 +105,52 @@ class MassSendReceiverCell extends StatelessWidget { return controller; } + Widget massSendReceiverCellWidget( + { + String? leftTitel, + String? rightTitle, + bool? isHaveDirection, + bool? isHaveLine, + bool? isHaveRightWidget, + Widget? rightWidget, + Function()? action, + double? allHeight, + }){ + return Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 60.h, + color: Colors.white, + padding: EdgeInsets.only(right: 20.w), // , top: 20.w, bottom: 20.w + child: Row( + children: [ + SizedBox(width: 20.w), + Text(leftTitel!, style: TextStyle(fontSize: 22.sp)), + Expanded(child: SizedBox(width: 10.w)), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + isHaveRightWidget! + ? rightWidget! + : Text( + rightTitle ?? "", + textAlign: TextAlign.end, + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + style: TextStyle( + fontSize: 22.sp, + color: AppColors.darkGrayTextColor), + ) + ], + ) + ], + ), + ) + ], + ); + } + // 接受者信息输入框 Widget getTFWidget( bool isHaveBtn, String tfStr, int lineIndex, LockUserData userData) { diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart index ab6161c0..74c8dad7 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart @@ -9,6 +9,7 @@ import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; +import '../../checkingIn/checkingInSet/checkingInSet_entity.dart'; import 'checkInCreatCompany_logic.dart'; class CheckInCreatCompanyPage extends StatefulWidget { @@ -44,7 +45,13 @@ class _CheckInCreatCompanyPageState extends State { isHaveLine: true, isHaveDirection: true, action: () async { - var data = await Get.toNamed(Routers.checkingInSetWorkTimePage); + var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: { + "getKeyInfosData": state.getKeyInfosData.value, + "companyId": "1", + "pushType": "0", + "checkingInSetInfo": CheckingInSetInfo(), + }); + if(data != null) { setState(() { state.beginTime.value = data["beginTime"]; @@ -61,7 +68,12 @@ class _CheckInCreatCompanyPageState extends State { isHaveLine: true, isHaveDirection: true, action: () async { - var data = await Get.toNamed(Routers.checkingInSetWorkdaySet); + var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: { + "getKeyInfosData": state.getKeyInfosData.value, + "companyId": "0", + "pushType": "0", + "checkingInSetInfo": CheckingInSetInfo(), + }); if(data != null) { setState(() { state.isCustom.value = data["attendanceType"]; diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart index e6186e02..808c4f67 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart @@ -236,12 +236,15 @@ class LockSetLogic extends BaseGetXController { password: state.passwordTF.text, ); if (entity.errorCode!.codeIsSuccessful) { + // deletLockInfoData(); + blockDeletNumberCheckPasswordCallback(); // if(state.currentDeviceUUid.value.isEmpty){ // Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接"); // return; // } // if(state.currentDeviceUUid.value[31] == "1"){ + // 已配对 if(state.getKeyInfosData.value.isLockOwner == 1){ // 调用删除锁协议 @@ -250,6 +253,7 @@ class LockSetLogic extends BaseGetXController { // 调用删除钥匙协议 deletUserAction(); } + // }else if(state.currentDeviceUUid.value[31] == "0"){ // // 未配对 // if(state.getKeyInfosData.value.isLockOwner == 1){ diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index 6cf1a132..c41ac5b7 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -414,17 +414,17 @@ class _LockSetPageState extends State with RouteAware { })), // ), // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: TranslationLoader - .lanKeys!.importOtherLockData!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.importOtherLockDataPage); - })), + // Visibility( + // visible: true, + // child: CommonItem( + // leftTitel: TranslationLoader + // .lanKeys!.importOtherLockData!.tr, + // rightTitle: "", + // isHaveLine: true, + // isHaveDirection: true, + // action: () { + // Get.toNamed(Routers.importOtherLockDataPage); + // })), // ), // Obx(() => Visibility( diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 3570b168..cc968526 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -357,7 +357,7 @@ class LockDetailLogic extends BaseGetXController{ }else{ getTokenList = [0,0,0,0]; } - print("openDoorTokenPubToken:$getTokenList"); + print("openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList"); print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}"); IoSenderManage.senderOpenLock( @@ -440,7 +440,7 @@ class LockDetailLogic extends BaseGetXController{ BlueManage().connectDeviceMacAddress = v[knownDeviceIndex].id; connectBlue(v[knownDeviceIndex].id, state.keyInfos.value.bluetooth!.bluetoothDeviceName!); eventBus.fire(ScanAllDeviceFindCurrentDeviceConnectedEvent(v[knownDeviceIndex].serviceUuids[0].toString())); - BlueManage().stopScan(); + // BlueManage().stopScan(); } }); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 158a5457..f61f643d 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -93,33 +93,61 @@ class _LockDetailPageState extends State return Column( children: [ SizedBox(height: 50.h), + // Stack( + // alignment: Alignment.center, + // children: [ + // Align( + // alignment: Alignment.center, + // child: Text( + // widget.keyInfo!.lockAlias!, + // style: + // TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400), + // )), + // Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Text( + // "100%", + // style: TextStyle( + // fontSize: 18.sp, color: AppColors.darkGrayTextColor), + // ), + // SizedBox(width: 2.w), + // Image.asset( + // 'images/main/icon_main_cell.png', + // width: 30.w, + // height: 24.w, + // ), + // SizedBox(width: 30.w), + // ], + // ), + // ], + // ), Stack( - alignment: Alignment.centerRight, + alignment: Alignment.center, children: [ - Align( - alignment: Alignment.center, - child: Text( - widget.keyInfo!.lockAlias!, - style: - TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400), - )), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - "100%", - style: TextStyle( - fontSize: 18.sp, color: AppColors.darkGrayTextColor), - ), - SizedBox(width: 2.w), - Image.asset( - 'images/main/icon_main_cell.png', - width: 30.w, - height: 24.w, - ), - SizedBox(width: 30.w), - ], + Container( + width: 1.sw - 120.w*2, + child: Center(child: Text(widget.keyInfo!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),)) ), + Positioned( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + "100%", + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + SizedBox(width: 2.w), + Image.asset( + 'images/main/icon_main_cell.png', + width: 30.w, + height: 24.w, + ), + SizedBox(width: 30.w), + ], + ) + ) ], ), SizedBox(height: 30.h), diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart index 7be310e9..8214a645 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart @@ -129,10 +129,7 @@ class _LockOperatingRecordPageState extends State { DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!); String operateDateStr = '${dateStr.toLocal().toString().substring(0, 16)} '; - // return _operatingRecordItem('images/controls_user.png', dataItem.username ?? "未知", '$operateDateStr用${dataItem.recordTypeName}', () { - // - // }); - return _operatingRecordItem('images/controls_user.png', dataItem.recordTypeName!, operateDateStr, () { + return _operatingRecordItem(getTypeIcon(dataItem.recordType!), dataItem.recordTypeName!, operateDateStr, () { }); }, @@ -161,8 +158,32 @@ class _LockOperatingRecordPageState extends State { ); } - Widget _operatingRecordItem(String userAvatarStr, String userNameStr, - String unlockDescStr, Function() action) { + String getTypeIcon(int type) { + String title = 'images/controls_user.png'; + switch (type) { + case 1: + // 蓝牙开锁 + title = 'images/controls_user.png'; + break; + case 4: + // 密码开锁 + title = 'images/icon_password.png'; + break; + case 7: + // ic卡 + title = 'images/icon_card.png'; + break; + case 8: + // 指纹开锁 + title = 'images/icon_fingerprint.png'; + break; + default: + break; + } + return title; + } + + Widget _operatingRecordItem(String userAvatarStr, String userNameStr, String unlockDescStr, Function() action) { return GestureDetector( onTap: action, child: Container( diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart index 38b89b6b..d29f967a 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart @@ -7,6 +7,7 @@ import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/dateTool.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showTFView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -200,21 +201,7 @@ class _OtherTypeKeyDetailPageState extends State { margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () { - switch (state.type.value) { - case 0: - // 卡 - logic.deletICCardData(); - break; - case 1: - // 指纹 - logic.deletFingerprintsData(); - break; - case 2: - - break; - default: - break; - } + showIosTipViewDialog(context); }), ], ), @@ -393,4 +380,38 @@ class _OtherTypeKeyDetailPageState extends State { },); }); } + + void showIosTipViewDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + switch (state.type.value) { + case 0: + // 卡 + logic.deletICCardData(); + break; + case 1: + // 指纹 + logic.deletFingerprintsData(); + break; + case 2: + + break; + default: + break; + } + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } + } diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_logic.dart index 404d5c39..94ddf04f 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_logic.dart @@ -30,12 +30,14 @@ class OtherTypeKeyListLogic extends BaseGetXController{ void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) { // 添加指纹开始(重置锁里面所有指纹) - if((reply is SenderAddFingerprintReply) && (state.isDeletFingerprintData.value == true)) { + print("111111111111111 isDeletFingerprintData:${state.isDeletFingerprintData} isDeletICCardData:${state.isDeletICCardData}"); + if((reply is SenderAddFingerprintReply) && (state.isDeletFingerprintData == true)) { + print("111111111111111"); _replyAddFingerprintBegin(reply); } // 添加卡片开始(重置锁里面所有卡) - if((reply is SenderAddICCardReply) && (state.isDeletICCardData.value == true)) { + if((reply is SenderAddICCardReply) && (state.isDeletICCardData == true)) { _replyAddICCardBegin(reply); } @@ -62,7 +64,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{ case 0x00: //成功 print("${reply.commandType!.typeValue} 数据解析成功"); - state.isDeletFingerprintData.value = false; + state.isDeletICCardData = false; deletICCardData(); break; case 0x06: @@ -118,7 +120,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{ case 0x00: //成功 print("${reply.commandType!.typeValue} 数据解析成功"); - state.isDeletFingerprintData.value = false; + state.isDeletFingerprintData = false; deletAllFingerprintsData(); break; case 0x06: @@ -387,7 +389,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{ } // 重置所有指纹 - Future senderAddFingerprint() async { + Future senderAddFingerprint(String keyId, String userID, int cardNo) async { BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async { if (deviceConnectionState == DeviceConnectionState.connected){ var publicKey = await Storage.getStringList(saveBluePublicKey); @@ -400,9 +402,12 @@ class OtherTypeKeyListLogic extends BaseGetXController{ List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderAddFingerprintCommand( - keyID:"1", - userID:"DeleteAll!@#", - fingerNo:255, + // keyID:"1", + // userID:"DeleteAll!@#", + // fingerNo:255, + keyID:keyId, + userID:userID, + fingerNo:cardNo, useCountLimit:0, startTime:0x11223344, endTime:0x11223344, @@ -415,8 +420,8 @@ class OtherTypeKeyListLogic extends BaseGetXController{ }); } - // 重置所有卡片 - Future senderAddICCard() async { + // 删除卡片 + Future senderAddICCard(String keyId, String userID, int cardNo) async { BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ var publicKey = await Storage.getStringList(saveBluePublicKey); @@ -430,9 +435,12 @@ class OtherTypeKeyListLogic extends BaseGetXController{ print("openDoorTokenPubToken:$getTokenList"); IoSenderManage.senderAddICCardCommand( - keyID:"1", - userID:"DeleteAll!@#", - cardNo:255, + // keyID:"1", + // userID:"DeleteAll!@#", + // cardNo:255, + keyID:keyId, + userID:userID, + cardNo:cardNo, useCountLimit:0, startTime:0x11223344, endTime:0x11223344, @@ -468,7 +476,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{ ); if(entity.errorCode!.codeIsSuccessful){ Toast.show(msg: "重置成功"); - state.isDeletFingerprintData.value = false; + state.isDeletFingerprintData = false; getFingerprintsListData(); } } @@ -531,6 +539,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{ // 获取是否是演示模式 演示模式不获取接口 var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + // print("aaaaaaa:$isDemoMode"); if(isDemoMode == false){ _initReplySubscription(); diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart index 39541300..024a9b2c 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_page.dart @@ -6,7 +6,9 @@ import 'package:get/get.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/dateTool.dart'; +import '../../../../tools/left_slide_actions.dart'; import '../../../../tools/noData.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/storage.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -191,6 +193,29 @@ class _OtherTypeKeyListPageState extends State { switch (state.fromType.value) { case 0: // 卡 + if (index < state.fingerprintItemListData.value.length) { + return LeftSlideActions( + key: Key(fingerprintItemData.cardName!), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(fingerprintItemData.cardId.toString()), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _keyItem('images/icon_card.png', fingerprintItemData.cardName!, fingerprintItemData.cardType! == 1 ? "永久" : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", () async { + var data = await Get.toNamed(Routers.otherTypeKeyDetailPage, arguments: { + "fingerprintItemData": fingerprintItemData, + "type": type, + }); + if(data != null) { + logic.getICCardListData(); + } + }), + ); + } + return const SizedBox.shrink(); + return _keyItem('images/icon_card.png', fingerprintItemData.cardName!, fingerprintItemData.cardType! == 1 ? "永久" : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", () async { var data = await Get.toNamed(Routers.otherTypeKeyDetailPage, arguments: { "fingerprintItemData": fingerprintItemData, @@ -203,6 +228,29 @@ class _OtherTypeKeyListPageState extends State { break; case 1: // 指纹 + if (index < state.fingerprintItemListData.value.length) { + return LeftSlideActions( + key: Key(fingerprintItemData.fingerprintName!), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(fingerprintItemData.fingerprintId.toString()), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _keyItem('images/icon_fingerprint.png', fingerprintItemData.fingerprintName!, fingerprintItemData.fingerprintType! == 1 ? "永久" : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", () async { + var data = await Get.toNamed(Routers.otherTypeKeyDetailPage, arguments: { + "fingerprintItemData": fingerprintItemData, + "type": type, + }); + if(data != null) { + logic.getFingerprintsListData(); + } + }), + ); + } + return const SizedBox.shrink(); + return _keyItem('images/icon_fingerprint.png', fingerprintItemData.fingerprintName!, fingerprintItemData.fingerprintType! == 1 ? "永久" : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}", () async { var data = await Get.toNamed(Routers.otherTypeKeyDetailPage, arguments: { "fingerprintItemData": fingerprintItemData, @@ -230,16 +278,77 @@ class _OtherTypeKeyListPageState extends State { ) :const NoData()); } + Widget _buildDeleteBtn(String idStr) { + return GestureDetector( + onTap: () { + // 省略: 弹出是否删除的确认对话框。 + showIosTipViewDialog(context, idStr); + }, + child: Container( + width: 60, + color: const Color(0xFFF20101), + alignment: Alignment.center, + child: const Text( + '删除', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.white, + height: 1, + ), + ), + ), + ); + } + + void showIosTipViewDialog(BuildContext context, String keyId) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () async { + Get.back(); + String? idStr = await Storage.getUid(); + switch (state.fromType.value) { + case 0: + // 卡 + state.isDeletICCardData = true; + logic.senderAddICCard(keyId, idStr ?? "", 0); + break; + case 1: + // 指纹 + state.isDeletFingerprintData = true; + logic.senderAddFingerprint(keyId, idStr ?? "", 0); + break; + case 2: + // 遥控 + + break; + default: + break; + } + }, + cancelClick: () { + Get.back(); + }, + ); + }, + ); + } + Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String showTime, Function() action) { return GestureDetector( onTap: action, child: Container( height: 90.h, // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10.w), - ), + color: Colors.white, + // decoration: BoxDecoration( + // color: Colors.white, + // // borderRadius: BorderRadius.circular(10.w), + // ), child: Row( children: [ SizedBox(width: 30.w), @@ -298,14 +407,14 @@ class _OtherTypeKeyListPageState extends State { switch (state.fromType.value) { case 0: // 卡 - state.isDeletICCardData.value = true; - logic.senderAddICCard(); + state.isDeletICCardData = true; + logic.senderAddICCard("1", "DeleteAll!@#", 255); break; case 1: // 指纹 // logic.deletAllFingerprintsData(); - state.isDeletFingerprintData.value = true; - logic.senderAddFingerprint(); + state.isDeletFingerprintData = true; + logic.senderAddFingerprint("1", "DeleteAll!@#", 255); break; case 2: // 遥控 diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_state.dart index 0e9b1e66..5e9b71ed 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyList/otherTypeKeyList_state.dart @@ -8,8 +8,8 @@ class OtherTypeKeyListState{ final lockId = 0.obs; final fromType = 0.obs; - var isDeletFingerprintData = false.obs; - var isDeletICCardData = false.obs; + var isDeletFingerprintData = false; + var isDeletICCardData = false; final fingerprintItemListData = [].obs; final TextEditingController searchController = TextEditingController(); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 195892fb..fad7aa13 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -12,6 +12,7 @@ import 'package:star_lock/tools/toast.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/commonItem.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -191,7 +192,7 @@ class _PasswordKeyDetailPageState extends State { left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () { - deletePwdRequest(); + showIosTipViewDialog(context); }), ], ), @@ -447,4 +448,23 @@ class _PasswordKeyDetailPageState extends State { return await methodChannel.invokeMethod(method, arguments); } } + + void showIosTipViewDialog(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + deletePwdRequest(); + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 0b21808c..4b920eb8 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -4,6 +4,8 @@ import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; +import '../passwordKey_perpetual/passwordKeyEntity.dart'; + class PasswordKeyListLogic extends BaseGetXController { final PasswordKeyListState state = PasswordKeyListState(); @@ -32,6 +34,16 @@ class PasswordKeyListLogic extends BaseGetXController { } } + //删除密码请求 deleteType:1-蓝牙 2-网关 + Future deletePwdRequest(String lockId, String keyboardPwdId, int deleteType) async { + PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd( + lockId, keyboardPwdId, deleteType); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "删除成功"); + mockNetworkDataRequest(); + } + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index 33a65103..ede3e2ca 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -10,6 +10,8 @@ import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/toast.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/left_slide_actions.dart'; +import '../../../../tools/showIosTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -167,22 +169,34 @@ class _PasswordKeyListPageState extends State { return ListView.separated( itemCount: getItemData.length, itemBuilder: (c, index) { - PasswordKeyListItem indexEntity = getItemData[index]; + PasswordKeyListItem passwordKeyListItem = getItemData[index]; String useDateStr = ''; //使用期限 //使用期限 - useDateStr = getUseDateStr(indexEntity); + useDateStr = getUseDateStr(passwordKeyListItem); - return _electronicKeyItem('images/controls_user.png', - indexEntity.keyboardPwdName!, useDateStr, () { - Navigator.pushNamed(context, Routers.passwordKeyDetailPage, - arguments: {"itemData": indexEntity}).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - } - }); - ; - }); + if (index < getItemData.length) { + return LeftSlideActions( + key: Key(passwordKeyListItem.keyboardPwdName!), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(passwordKeyListItem), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _electronicKeyItem('images/icon_password.png', + passwordKeyListItem.keyboardPwdName!, useDateStr, () { + Navigator.pushNamed(context, Routers.passwordKeyDetailPage, + arguments: {"itemData": passwordKeyListItem}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + } + }); + }), + ); + } + return const SizedBox.shrink(); }, separatorBuilder: (BuildContext context, int index) { return const Divider( @@ -193,6 +207,48 @@ class _PasswordKeyListPageState extends State { ); } + Widget _buildDeleteBtn(PasswordKeyListItem passwordKeyListItem) { + return GestureDetector( + onTap: () { + // 省略: 弹出是否删除的确认对话框。 + showIosTipViewDialog(context, passwordKeyListItem); + }, + child: Container( + width: 60, + color: const Color(0xFFF20101), + alignment: Alignment.center, + child: const Text( + '删除', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.white, + height: 1, + ), + ), + ), + ); + } + + void showIosTipViewDialog(BuildContext context, PasswordKeyListItem passwordKeyListItem) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + logic.deletePwdRequest(passwordKeyListItem.lockId.toString(), passwordKeyListItem.keyboardPwdId.toString(), 1); + }, + cancelClick: () { + Get.back(); + }, + ); + } + ); + } + //使用期限 /** 单次 1 只能在开始时间后6小时内使用一次 diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 3c8ebc22..10561193 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -188,7 +188,7 @@ class _PasswordKeyPerpetualPageState extends State { children: [ SizedBox(height: 10.h), Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w), + // margin: EdgeInsets.only(left: 20.w, right: 20.w), child: CommonItem( leftTitel: titleStr, rightTitle: "", @@ -203,7 +203,7 @@ class _PasswordKeyPerpetualPageState extends State { // 限时顶部选择日期 Widget keyTimeLimitWidget() { return Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w), + // margin: EdgeInsets.only(left: 20.w, right: 20.w), child: Column( children: [ CommonItem( diff --git a/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart b/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart index fccb21a8..ba176939 100644 --- a/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart +++ b/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart @@ -221,7 +221,7 @@ class KeyInfos { int? resetButton; int? endDate; int? keyRight; - int? electricQuantity; + // int? electricQuantity; int? lockSound; int? volume; int? specialValue; @@ -277,7 +277,7 @@ class KeyInfos { this.resetButton, this.endDate, this.keyRight, - this.electricQuantity, + // this.electricQuantity, this.lockSound, this.volume, this.specialValue, @@ -334,7 +334,7 @@ class KeyInfos { resetButton = json['resetButton']; endDate = json['endDate']; keyRight = json['keyRight']; - electricQuantity = json['electricQuantity']; + // electricQuantity = json['electricQuantity']; lockSound = json['lockSound']; volume = json['volume']; specialValue = json['specialValue']; @@ -397,7 +397,7 @@ class KeyInfos { data['resetButton'] = resetButton; data['endDate'] = endDate; data['keyRight'] = keyRight; - data['electricQuantity'] = electricQuantity; + // data['electricQuantity'] = electricQuantity; data['lockSound'] = lockSound; data['volume'] = volume; data['specialValue'] = specialValue; diff --git a/star_lock/lib/main/lockMian/lockList/lockList_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_page.dart index f22310d3..7ef1d959 100644 --- a/star_lock/lib/main/lockMian/lockList/lockList_page.dart +++ b/star_lock/lib/main/lockMian/lockList/lockList_page.dart @@ -45,7 +45,7 @@ class _LockListPageState extends State { return GestureDetector( onTap: action, child: Container( - height: 122.h, + // height: 122.h, margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), decoration: BoxDecoration( color: Colors.white, @@ -101,6 +101,9 @@ class _LockListPageState extends State { ), ], ), + SizedBox( + height: 20.h, + ), ], ), ), diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index a14db939..90cc1b32 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -98,61 +98,68 @@ class _StarLockMainPageState extends State with BaseWidget { } Widget unHaveData() { - return Column( - mainAxisAlignment: MainAxisAlignment.center, + return ListView( children: [ - Row( + Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( - width: 330.w, - // height: 330.w, - // margin: EdgeInsets.only(top: 180.h), - // decoration: BoxDecoration( - // border: Border.all(width: 4.w, color: AppColors.mainColor), - // borderRadius: BorderRadius.circular(110.w), - // ), - child: InkWell( - child: Padding( - padding: const EdgeInsets.all(30.0), - child: Image.asset( - 'images/main/icon_main_unHaveLockData.png', - width: 260.w, - height: 260.w, - ), - ), - onTap: () { - //实现回调函数 - Navigator.pushNamed( - context, Routers.seletLockTypePage, - // arguments: { - // "url": ConstConfig.privacAgreementUrl, - // "title": '隐私政策' - // } - ); - }, + height: 160.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: 330.w, + // height: 330.w, + // margin: EdgeInsets.only(top: 180.h), + // decoration: BoxDecoration( + // border: Border.all(width: 4.w, color: AppColors.mainColor), + // borderRadius: BorderRadius.circular(110.w), + // ), + child: InkWell( + child: Padding( + padding: const EdgeInsets.all(30.0), + child: Image.asset( + 'images/main/icon_main_unHaveLockData.png', + width: 260.w, + height: 260.w, + ), + ), + onTap: () { + //实现回调函数 + Navigator.pushNamed( + context, Routers.seletLockTypePage, + // arguments: { + // "url": ConstConfig.privacAgreementUrl, + // "title": '隐私政策' + // } + ); + }, + )), + ], + ), + Container( + // padding: EdgeInsets.all(30.w), + child: Text( + TranslationLoader + .lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr, + style: TextStyle( + fontSize: 26.sp, + // fontWeight: FontWeight.w800, + color: Colors.black), )), + SizedBox( + height: 160.h, + ), + SubmitBtn( + btnName: '演示模式', + onClick: () { + Get.toNamed(Routers.demoModeLockDetailPage); + }, + ) ], ), - Container( - padding: EdgeInsets.all(30.w), - child: Text( - TranslationLoader - .lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr, - style: TextStyle( - fontSize: 26.sp, - // fontWeight: FontWeight.w800, - color: Colors.black), - )), - SizedBox( - height: 160.h, - ), - SubmitBtn( - btnName: '演示模式', - onClick: () { - Get.toNamed(Routers.demoModeLockDetailPage); - }, - ) ], ); } diff --git a/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart b/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart index 0b3fa821..ffb0c30e 100644 --- a/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart +++ b/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart @@ -4,6 +4,7 @@ import 'package:get/get.dart'; import '../../app_settings/app_colors.dart'; import '../../tools/commonItem.dart'; +import '../../tools/eventBusEventManage.dart'; import '../../tools/titleAppBar.dart'; import '../../translations/app_dept.dart'; import '../../translations/trans_lib.dart'; @@ -32,7 +33,8 @@ class _MineMultiLanguagePageState extends State { mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: _children(), - )); + ) + ); } List _children() { @@ -71,6 +73,7 @@ class _MineMultiLanguagePageState extends State { : Container()), action: () { logic.changeLanguage(e); + eventBus.fire(ChangeLanguageBlockLastLanguageEvent(lanType.lanTitle)); }), ); } diff --git a/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_state.dart b/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_state.dart index 98d98fe0..556c67ab 100644 --- a/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_state.dart +++ b/star_lock/lib/mine/mineMultiLanguage/mineMultiLanguage_state.dart @@ -13,12 +13,13 @@ class MineMultiLanguageState { var currentLanguageType = ExtensionLanguageType.fromLanguageCode(Get.locale!.languageCode).obs; - AppLanuageConfigState() { + MineMultiLanguageState() { resetLan(); } void resetLan() { currentLanguageType.value = ExtensionLanguageType.fromLanguageCode(Get.locale!.languageCode); + print("currentLanguageType.value:${currentLanguageType.value}"); // StoreService.to.saveLanguageCode(Get.locale!.languageCode); } } \ No newline at end of file diff --git a/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart b/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart new file mode 100644 index 00000000..f5894792 --- /dev/null +++ b/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart @@ -0,0 +1,56 @@ + + +import '../../../network/api_repository.dart'; +import '../../../tools/baseGetXController.dart'; +import '../../../tools/toast.dart'; +import 'appUnlockNeedMobileNetworkingLock_state.dart'; +import 'selectLockListEntity.dart'; + +class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{ + final AppUnlockNeedMobileNetworkingLockState state = AppUnlockNeedMobileNetworkingLockState(); + + //请求锁列表 + Future> mockNetworkDataRequest() async { + SelectLockListEntity entity = await ApiRepository.to.selectLockList(); + List dataList = []; + if (entity.errorCode!.codeIsSuccessful) { + dataList = entity.data!.list!; + state.lockItemList.value = dataList; + } + return dataList; + } + + //APP开锁时需手机联网的锁 + Future setAppUnlockMustOnlineRequest() async { + SelectLockListEntity entity = + await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: '操作成功'); + } + } + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + print("onReady()"); + + mockNetworkDataRequest(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + print("lockDetail_onInit()"); + + } + + + @override + void onClose() { + // TODO: implement onClose + + } + +} \ No newline at end of file diff --git a/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart b/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart index 656e1c67..7b470215 100644 --- a/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart +++ b/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart'; -import 'package:star_lock/network/api_repository.dart'; -import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; import '../../../app_settings/app_colors.dart'; @@ -11,6 +9,7 @@ import '../../../tools/commonItem.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; +import 'appUnlockNeedMobileNetworkingLock_logic.dart'; class APPUnlockNeedMobileNetworkingLockPage extends StatefulWidget { const APPUnlockNeedMobileNetworkingLockPage({Key? key}) : super(key: key); @@ -20,16 +19,14 @@ class APPUnlockNeedMobileNetworkingLockPage extends StatefulWidget { _APPUnlockNeedMobileNetworkingLockPageState(); } -class _APPUnlockNeedMobileNetworkingLockPageState - extends State { - List lockItemList = []; - List selectLockIdList = []; +class _APPUnlockNeedMobileNetworkingLockPageState extends State { + final logic = Get.put(AppUnlockNeedMobileNetworkingLockLogic()); + final state = Get.find().state; @override void initState() { super.initState(); - mockNetworkDataRequest(); } @override @@ -73,32 +70,48 @@ class _APPUnlockNeedMobileNetworkingLockPageState isHaveLine: false, isHaveRightWidget: true, rightWidget: GestureDetector( - onTap: () {}, - child: Row( - children: [ - Image.asset( - 'images/icon_round_unSelet.png', - width: 26.w, - height: 26.w, - ), - ], + onTap: () { + state.isCheckAll.value = !state.isCheckAll.value; + for(LockItemData lockItemData in state.lockItemList.value){ + if(state.isCheckAll.value == true){ + lockItemData.isCheck = true; + state.selectLockIdList.add(lockItemData.lockId); + }else{ + lockItemData.isCheck = false; + state.selectLockIdList = []; + } + } + setState(() {}); + }, + child: Obx(() => Row( + children: [ + Image.asset( + state.isCheckAll.value ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', + width: 30.w, + height: 30.w, + ), + ]), ), )), SizedBox(height: 15.h), Expanded( - child: ListView.builder( - itemCount: lockItemList.length, + child: Obx(() => ListView.builder( + itemCount: state.lockItemList.value.length, itemBuilder: (c, index) { - LockItemData itemData = lockItemList[index]; - // itemData.isCheck = false; + LockItemData itemData = state.lockItemList.value[index]; + if(state.isCheckAll.value == true){ + itemData.isCheck = true; + }else{ + itemData.isCheck = false; + } return _gatewatListItem(itemData); - }), + })), ), SubmitBtn( btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () { - if (selectLockIdList.isNotEmpty) { - setAppUnlockMustOnlineRequest(); + if (state.selectLockIdList.isNotEmpty) { + logic.setAppUnlockMustOnlineRequest(); } else { Toast.show(msg: '请选择需设置的锁'); } @@ -116,9 +129,9 @@ class _APPUnlockNeedMobileNetworkingLockPageState setState(() { itemData.isCheck = !itemData.isCheck; if (itemData.isCheck == true) { - selectLockIdList.add(itemData.lockId); + state.selectLockIdList.add(itemData.lockId); } else { - selectLockIdList.remove(itemData.lockId); + state.selectLockIdList.remove(itemData.lockId); } }); }, @@ -155,26 +168,4 @@ class _APPUnlockNeedMobileNetworkingLockPageState ), ); } - - //请求锁列表 - Future> mockNetworkDataRequest() async { - SelectLockListEntity entity = await ApiRepository.to.selectLockList(); - List dataList = []; - if (entity.errorCode!.codeIsSuccessful) { - dataList = entity.data!.list!; - setState(() { - lockItemList = dataList; - }); - } - return dataList; - } - - //APP开锁时需手机联网的锁 - Future setAppUnlockMustOnlineRequest() async { - SelectLockListEntity entity = - await ApiRepository.to.setAppUnlockMustOnline(selectLockIdList); - if (entity.errorCode!.codeIsSuccessful) { - Toast.show(msg: '操作成功'); - } - } } diff --git a/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_state.dart b/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_state.dart new file mode 100644 index 00000000..7170277d --- /dev/null +++ b/star_lock/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_state.dart @@ -0,0 +1,11 @@ + + +import 'package:get/get.dart'; + +import 'selectLockListEntity.dart'; + +class AppUnlockNeedMobileNetworkingLockState { + var lockItemList = [].obs; + var selectLockIdList = []; + var isCheckAll = false.obs; +} \ No newline at end of file diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart index 88179e3b..00c540f4 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart @@ -145,11 +145,11 @@ class _AdministratorDetailsPageState extends State { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; + useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart index cb258b47..9ce84f9c 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart @@ -11,6 +11,9 @@ import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; +import '../../../tools/left_slide_actions.dart'; +import '../../../tools/showIosTipView.dart'; +import '../../../tools/toast.dart'; class AuthorizedAdministratorListPage extends StatefulWidget { const AuthorizedAdministratorListPage({Key? key}) : super(key: key); @@ -92,11 +95,22 @@ class _AuthorizedAdministratorListPageState print("授权管理员列表成功:${entity.data?.itemList}"); if (entity.data != null) { dataList = entity.data!.itemList!; + // setState(() {}); } } return dataList; } + //删除授权管理员请求 是否删除授权管理员发送的钥匙。 1是,0否 + Future deleteAdministratorRequest(String uid) async { + AuthorizedAdminListEntity entity = await ApiRepository.to + .deleteAuthorizedAdmin(uid, '0'); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "删除成功"); + mockNetworkDataRequest(); + } + } + Widget _searchWidget() { return Container( height: 60.h, @@ -139,6 +153,20 @@ class _AuthorizedAdministratorListPageState itemCount: itemList.length, itemBuilder: (c, index) { AuthorizedAdminListItem itemData = itemList[index]; + if (index < itemList.length) { + return LeftSlideActions( + key: Key(itemData.name!), + actionsWidth: 60, + actions: [ + _buildDeleteBtn(itemData.uid.toString()), + ], + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(1)), + ), + child: _electronicKeyItem(itemData), + ); + } + return const SizedBox.shrink(); return _electronicKeyItem(itemData); }); } @@ -155,10 +183,10 @@ class _AuthorizedAdministratorListPageState }, child: Container( height: 100.h, - margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(10.w), + // borderRadius: BorderRadius.circular(10.w), ), child: Row( children: [ @@ -238,4 +266,46 @@ class _AuthorizedAdministratorListPageState return useDateStr; } + + void showIosTipViewDialog(BuildContext context, String keyId) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowIosTipView( + title: "提示", + tipTitle: "确定要删除吗?", + sureClick: () { + Get.back(); + deleteAdministratorRequest(keyId); + }, + cancelClick: () { + Get.back(); + }, + ); + }, + ); + } + + Widget _buildDeleteBtn(String keyId) { + return GestureDetector( + onTap: () { + // 省略: 弹出是否删除的确认对话框。 + showIosTipViewDialog(context, keyId); + }, + child: Container( + width: 60, + color: const Color(0xFFF20101), + alignment: Alignment.center, + child: const Text( + '删除', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Colors.white, + height: 1, + ), + ), + ), + ); + } } diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart index 056922d9..b881f792 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart @@ -7,6 +7,7 @@ import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart'; import 'package:star_lock/tools/storage.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; +import '../../../tools/eventBusEventManage.dart'; class MineSetLogic extends BaseGetXController { final MineSetState state = MineSetState(); @@ -67,10 +68,22 @@ class MineSetLogic extends BaseGetXController { } } + // 下级界面修改成功后传递数据 + StreamSubscription? _getNumberEvent; + void _initLoadDataAction() { + // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus + _getNumberEvent = + eventBus.on().listen((event) { + state.currentLanguage.value = event.languageTitle; + }); + } + @override void onReady() { // TODO: implement onReady super.onReady(); + + _initLoadDataAction(); } @override @@ -82,5 +95,8 @@ class MineSetLogic extends BaseGetXController { @override void onClose() { // TODO: implement onClose + super.onClose(); + + _getNumberEvent!.cancel(); } } diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart index be9dea06..a7d45a91 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -82,7 +82,7 @@ class _MineSetPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.lockUserManageLisPage); + Get.toNamed(Routers.lockUserManageLisPage); }), CommonItem( leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr, @@ -90,8 +90,7 @@ class _MineSetPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Navigator.pushNamed( - context, Routers.authorizedAdministratorListPage); + Get.toNamed(Routers.authorizedAdministratorListPage); }), //by DaisyWu 新增--批量授权 CommonItem( @@ -100,7 +99,7 @@ class _MineSetPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.authorityManagementPage); + Get.toNamed(Routers.authorityManagementPage); // Toast.show(msg: "功能暂未开放"); }), CommonItem( @@ -109,7 +108,7 @@ class _MineSetPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.lockGroupListPage); + Get.toNamed(Routers.lockGroupListPage); }), CommonItem( leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr, @@ -117,26 +116,31 @@ class _MineSetPageState extends State { isHaveLine: true, isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.transferSmartLockPage); + Get.toNamed(Routers.transferSmartLockPage); }), CommonItem( leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr, rightTitle: "", isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.selectGetewayListPage); + Get.toNamed(Routers.selectGetewayListPage); }), SizedBox( height: 10.h, ), - CommonItem( + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.multiLanguage!.tr, - rightTitle: "简体中文", + rightTitle: state.currentLanguage.value, isHaveLine: true, isHaveDirection: true, - action: () { - Navigator.pushNamed(context, Routers.mineMultiLanguagePage); - }), + action: () async { + // Get.toNamed(Routers.mineMultiLanguagePage); + var result = await Get.toNamed(Routers.mineMultiLanguagePage); + if (result != null) { + result as Map; + state.currentLanguage.value = result['currentLanguage']; + } + })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr, rightTitle: (state.lockScreen.value == 1 @@ -170,6 +174,7 @@ class _MineSetPageState extends State { leftTitel: TranslationLoader .lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr, rightTitle: "", + // allHeight: 100.h, isHaveLine: true, isHaveDirection: true, action: () { diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_state.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_state.dart index 76d6832b..7c738b38 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_state.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_state.dart @@ -11,4 +11,6 @@ class MineSetState { var lockScreen = 2.obs; //锁屏 var hideExpiredAccessFlag = 2.obs; //隐藏无效开锁 + var currentLanguage = "".obs; //隐藏无效开锁 + } diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 8898310b..10d55aca 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -1089,12 +1089,11 @@ class ApiProvider extends BaseProvider { post(userSettingsInfoURL.toUrl, jsonEncode({})); Future canSendKey( - String endDate, List keyGroupIdList, List lockIdList) => + String endDate, List lockIdList) => post( canSendKeyURL.toUrl, jsonEncode({ 'endDate': endDate, - 'keyGroupIdList': keyGroupIdList, 'lockIdList': lockIdList })); diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index d4120f3d..2a34d280 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -641,9 +641,9 @@ class ApiRepository { //群发电子钥匙检查 Future canSendKey( - String endDate, List keyGroupIdList, List lockIdList) async { + String endDate, List lockIdList) async { final res = - await apiProvider.canSendKey(endDate, keyGroupIdList, lockIdList); + await apiProvider.canSendKey(endDate, lockIdList); return KeyDetailEntity.fromJson(res.body); } diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index bb2a8c5f..f57da1a8 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -41,10 +41,11 @@ class CommonItem extends StatelessWidget { child: Row( children: [ SizedBox(width: 20.w), - Text(leftTitel!, style: TextStyle(fontSize: 22.sp)), SizedBox( - width: 6.w, + width: isHaveRightWidget! ? 100.w : 300.w, + child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp)) ), + SizedBox(width: 6.w), isTipsImg == true ? Image.asset( 'images/icon_tips_Q.png', @@ -52,7 +53,7 @@ class CommonItem extends StatelessWidget { height: 20.w, ) : Container(), - Expanded(child: SizedBox(width: 20.w)), + Expanded(child: SizedBox(width: 10.w)), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index d531c92e..5dfb4b3e 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -32,9 +32,14 @@ class ChickInAddStaffCardAndFingerprintBlockNumberEvent{ ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number); } - /// Uuid删除当前锁时 有可能锁被初始化了 但后台没被初始化 当打开APP的时候扫描如果未被连接就传uuid过去 判断直接删除数据 class ScanAllDeviceFindCurrentDeviceConnectedEvent{ String uuid; ScanAllDeviceFindCurrentDeviceConnectedEvent(this.uuid); +} + +/// 多语言 切换之后传值到上一级界面 +class ChangeLanguageBlockLastLanguageEvent{ + String languageTitle; + ChangeLanguageBlockLastLanguageEvent(this.languageTitle); } \ No newline at end of file diff --git a/star_lock/lib/tools/left_slide_actions.dart b/star_lock/lib/tools/left_slide_actions.dart new file mode 100644 index 00000000..faa250cb --- /dev/null +++ b/star_lock/lib/tools/left_slide_actions.dart @@ -0,0 +1,125 @@ +import 'package:flutter/material.dart'; + +typedef _BaseFunction = void Function(T o); + +/// 来源: https://blog.csdn.net/zhuowalun8427/article/details/121285947 。 +class LeftSlideActions extends StatefulWidget { + final double actionsWidth; + final List actions; + final Widget child; + final Decoration? decoration; + final VoidCallback? actionsWillShow; + final _BaseFunction? exportHideActions; + + const LeftSlideActions({ + Key? key, + required this.actionsWidth, + required this.actions, + required this.child, + this.decoration, + this.actionsWillShow, + this.exportHideActions, + }) : super(key: key); + + @override + _LeftSlideActionsState createState() => _LeftSlideActionsState(); +} + +class _LeftSlideActionsState extends State + with TickerProviderStateMixin { + double _translateX = 0; + late AnimationController _controller; + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + void initState() { + super.initState(); + _controller = AnimationController( + lowerBound: -widget.actionsWidth, + upperBound: 0, + vsync: this, + duration: const Duration(milliseconds: 300), + )..addListener(() { + _translateX = _controller.value; + setState(() {}); + }); + if (widget.exportHideActions != null) { + widget.exportHideActions!(_hide); + } + } + + @override + Widget build(BuildContext context) { + return Container( + decoration: widget.decoration, + clipBehavior: Clip.hardEdge, + child: Stack( + children: [ + Positioned.fill( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: widget.actions, + ), + ), + GestureDetector( + onHorizontalDragUpdate: (v) { + _onHorizontalDragUpdate(v); + }, + onHorizontalDragEnd: (v) { + _onHorizontalDragEnd(v); + }, + child: Transform.translate( + offset: Offset(_translateX, 0), + child: Row( + children: [ + Expanded(flex: 1, child: widget.child), + ], + ), + ), + ), + ], + ), + ); + } + + void _onHorizontalDragUpdate(DragUpdateDetails details) { + _translateX = + (_translateX + details.delta.dx).clamp(-widget.actionsWidth, 0.0); + setState(() {}); + } + + void _onHorizontalDragEnd(DragEndDetails details) { + _controller.value = _translateX; + if (details.velocity.pixelsPerSecond.dx > 200) { + _hide(); + } else if (details.velocity.pixelsPerSecond.dx < -200) { + _show(); + } else { + if (_translateX.abs() > widget.actionsWidth / 2) { + _show(); + } else { + _hide(); + } + } + } + + void _show() { + if (widget.actionsWillShow != null) { + widget.actionsWillShow!(); + } + if (_translateX != -widget.actionsWidth) { + _controller.animateTo(-widget.actionsWidth); + } + } + + void _hide() { + if (_translateX != 0) { + _controller.animateTo(0); + } + } +} diff --git a/star_lock/lib/tools/showIosTipView.dart b/star_lock/lib/tools/showIosTipView.dart index 72b470f0..03bd5310 100644 --- a/star_lock/lib/tools/showIosTipView.dart +++ b/star_lock/lib/tools/showIosTipView.dart @@ -21,54 +21,78 @@ class ShowIosTipView extends StatelessWidget { @override Widget build(BuildContext context) { + return CupertinoAlertDialog( + title: Text(title!), + content: Text(tipTitle!), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.cancel!.tr), + onPressed: () { + if (cancelClick != null) { + cancelClick!(); + } + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.sure!.tr), + onPressed: () { + if (sureClick != null) { + sureClick!(); + } + }, + ), + ], + ); + return Card( color: const Color(0x00FFFFFF), child: Builder( builder: (context) { - return Theme( - data: ThemeData.light(), - child: CupertinoAlertDialog( - title: Text(title!), - content: Column( - children: [ - const SizedBox( - height: 10, - ), - Column( - children: [ - Text(tipTitle!, style: TextStyle(fontSize: 24.sp)) - ], - ) - ], - ), - actions: [ - CupertinoDialogAction( - child: Text( - TranslationLoader.lanKeys!.cancel!.tr, - style: const TextStyle(color: Colors.black), - ), - onPressed: () { - // Navigator.pop(context); - // print("取消"); - if (cancelClick != null) { - cancelClick!(); - } - }, - ), - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.sure!.tr, - style: const TextStyle(color: Colors.black)), - onPressed: () { - if (sureClick != null) { - sureClick!(); - } - // Navigator.pop(context); - // print("确定"); - }, - ), - ], - ), - ); + + // return Theme( + // data: ThemeData.light(), + // child: CupertinoAlertDialog( + // title: Text(title!), + // content: Column( + // children: [ + // const SizedBox( + // height: 10, + // ), + // Column( + // children: [ + // Text(tipTitle!, style: TextStyle(fontSize: 24.sp)) + // ], + // ) + // ], + // ), + // actions: [ + // CupertinoDialogAction( + // child: Text( + // TranslationLoader.lanKeys!.cancel!.tr, + // style: const TextStyle(color: Colors.black), + // ), + // onPressed: () { + // // Navigator.pop(context); + // // print("取消"); + // if (cancelClick != null) { + // cancelClick!(); + // } + // }, + // ), + // CupertinoDialogAction( + // child: Text(TranslationLoader.lanKeys!.sure!.tr, + // style: const TextStyle(color: Colors.black)), + // onPressed: () { + // if (sureClick != null) { + // sureClick!(); + // } + // // Navigator.pop(context); + // // print("确定"); + // }, + // ), + // ], + // ), + // ); } ), );