修改提出的13个bug
This commit is contained in:
parent
725e3ff9d2
commit
58074e7786
@ -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;
|
||||
|
||||
@ -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<AuthorizedAdminDetailPage> {
|
||||
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<AuthorizedAdminDetailPage> {
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "确定要删除吗?",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
// deleteKeyRequest();
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> deleteKeyRequest(String keyId) async {
|
||||
ElectronicKeyListEntity entity =
|
||||
await ApiRepository.to.deleteElectronicKey(keyId);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: "删除成功");
|
||||
setState(() {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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<void> 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
|
||||
|
||||
@ -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<AuthorizedAdminListPage> {
|
||||
} 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<AuthorizedAdminListPage> {
|
||||
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<AuthorizedAdminListPage> {
|
||||
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<AuthorizedAdminListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 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),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<ElectronicKeyDetailPage> {
|
||||
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<ElectronicKeyDetailPage> {
|
||||
} 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<ElectronicKeyDetailPage> {
|
||||
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<ElectronicKeyDetailPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "确定要删除吗?",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
deleteKeyRequest();
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,6 +42,17 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> 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
|
||||
|
||||
@ -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<ElectronicKeyListPage> {
|
||||
} 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<ElectronicKeyListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
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 = '';
|
||||
|
||||
@ -165,7 +165,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
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<MassSendElectronicKeyPage> {
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
_lockIdList = value['selectLockIdList'];
|
||||
|
||||
print("_lockIdList:$_lockIdList");
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
|
||||
@ -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<MassSendLockGroupListPage> {
|
||||
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<MassSendLockGroupListPage> {
|
||||
|
||||
//分组列表请求
|
||||
Future<List<GroupListItem>> mockNetworkDataRequest() async {
|
||||
MassSendLockGroupListEntity entity =
|
||||
await ApiRepository.to.lockGroupList('1');
|
||||
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||
List<GroupListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
@ -120,19 +119,29 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
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<MassSendLockGroupListPage> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 {
|
||||
@ -46,10 +47,11 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": "",
|
||||
"pushType": "",
|
||||
"checkingInSetInfo": "",
|
||||
"companyId": "1",
|
||||
"pushType": "0",
|
||||
"checkingInSetInfo": CheckingInSetInfo(),
|
||||
});
|
||||
|
||||
if(data != null) {
|
||||
setState(() {
|
||||
state.beginTime.value = data["beginTime"];
|
||||
@ -66,7 +68,12 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
|
||||
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"];
|
||||
|
||||
@ -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){
|
||||
|
||||
@ -414,17 +414,17 @@ class _LockSetPageState extends State<LockSetPage> 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(
|
||||
|
||||
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -129,10 +129,7 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
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<LockOperatingRecordPage> {
|
||||
);
|
||||
}
|
||||
|
||||
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(
|
||||
|
||||
@ -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<OtherTypeKeyDetailPage> {
|
||||
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<OtherTypeKeyDetailPage> {
|
||||
},);
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,12 +30,14 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().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<void> senderAddFingerprint() async {
|
||||
Future<void> 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<int> 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<void> senderAddICCard() async {
|
||||
// 删除卡片
|
||||
Future<void> 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();
|
||||
|
||||
|
||||
@ -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<OtherTypeKeyListPage> {
|
||||
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<OtherTypeKeyListPage> {
|
||||
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<OtherTypeKeyListPage> {
|
||||
) :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<OtherTypeKeyListPage> {
|
||||
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:
|
||||
// 遥控
|
||||
|
||||
@ -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 = <FingerprintItemData>[].obs;
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
@ -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<PasswordKeyDetailPage> {
|
||||
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<PasswordKeyDetailPage> {
|
||||
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();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<void> 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
|
||||
|
||||
@ -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<PasswordKeyListPage> {
|
||||
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<PasswordKeyListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
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小时内使用一次
|
||||
|
||||
@ -188,7 +188,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
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<PasswordKeyPerpetualPage> {
|
||||
// 限时顶部选择日期
|
||||
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(
|
||||
|
||||
@ -98,61 +98,68 @@ class _StarLockMainPageState extends State<StarLockMainPage> 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);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -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<MineMultiLanguagePage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _children(),
|
||||
));
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _children() {
|
||||
@ -71,6 +73,7 @@ class _MineMultiLanguagePageState extends State<MineMultiLanguagePage> {
|
||||
: Container()),
|
||||
action: () {
|
||||
logic.changeLanguage(e);
|
||||
eventBus.fire(ChangeLanguageBlockLastLanguageEvent(lanType.lanTitle));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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<List<LockItemData>> mockNetworkDataRequest() async {
|
||||
SelectLockListEntity entity = await ApiRepository.to.selectLockList();
|
||||
List<LockItemData> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
dataList = entity.data!.list!;
|
||||
state.lockItemList.value = dataList;
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
//APP开锁时需手机联网的锁
|
||||
Future<void> 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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<APPUnlockNeedMobileNetworkingLockPage> {
|
||||
List<LockItemData> lockItemList = [];
|
||||
List selectLockIdList = [];
|
||||
class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMobileNetworkingLockPage> {
|
||||
final logic = Get.put(AppUnlockNeedMobileNetworkingLockLogic());
|
||||
final state = Get.find<AppUnlockNeedMobileNetworkingLockLogic>().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<List<LockItemData>> mockNetworkDataRequest() async {
|
||||
SelectLockListEntity entity = await ApiRepository.to.selectLockList();
|
||||
List<LockItemData> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
dataList = entity.data!.list!;
|
||||
setState(() {
|
||||
lockItemList = dataList;
|
||||
});
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
//APP开锁时需手机联网的锁
|
||||
Future<void> setAppUnlockMustOnlineRequest() async {
|
||||
SelectLockListEntity entity =
|
||||
await ApiRepository.to.setAppUnlockMustOnline(selectLockIdList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: '操作成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'selectLockListEntity.dart';
|
||||
|
||||
class AppUnlockNeedMobileNetworkingLockState {
|
||||
var lockItemList = <LockItemData>[].obs;
|
||||
var selectLockIdList = [];
|
||||
var isCheckAll = false.obs;
|
||||
}
|
||||
@ -145,11 +145,11 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
} 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 = '循环';
|
||||
|
||||
@ -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<void> 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<ChangeLanguageBlockLastLanguageEvent>().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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
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<MineSetPage> {
|
||||
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<MineSetPage> {
|
||||
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<MineSetPage> {
|
||||
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<MineSetPage> {
|
||||
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<String, dynamic>;
|
||||
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<MineSetPage> {
|
||||
leftTitel: TranslationLoader
|
||||
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
||||
rightTitle: "",
|
||||
// allHeight: 100.h,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
|
||||
@ -11,4 +11,6 @@ class MineSetState {
|
||||
|
||||
var lockScreen = 2.obs; //锁屏
|
||||
var hideExpiredAccessFlag = 2.obs; //隐藏无效开锁
|
||||
var currentLanguage = "".obs; //隐藏无效开锁
|
||||
|
||||
}
|
||||
|
||||
@ -1089,12 +1089,11 @@ class ApiProvider extends BaseProvider {
|
||||
post(userSettingsInfoURL.toUrl, jsonEncode({}));
|
||||
|
||||
Future<Response> canSendKey(
|
||||
String endDate, List keyGroupIdList, List lockIdList) =>
|
||||
String endDate, List lockIdList) =>
|
||||
post(
|
||||
canSendKeyURL.toUrl,
|
||||
jsonEncode({
|
||||
'endDate': endDate,
|
||||
'keyGroupIdList': keyGroupIdList,
|
||||
'lockIdList': lockIdList
|
||||
}));
|
||||
|
||||
|
||||
@ -641,9 +641,9 @@ class ApiRepository {
|
||||
|
||||
//群发电子钥匙检查
|
||||
Future<KeyDetailEntity> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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: [
|
||||
|
||||
@ -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);
|
||||
}
|
||||
125
star_lock/lib/tools/left_slide_actions.dart
Normal file
125
star_lock/lib/tools/left_slide_actions.dart
Normal file
@ -0,0 +1,125 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef _BaseFunction<T> = void Function(T o);
|
||||
|
||||
/// 来源: https://blog.csdn.net/zhuowalun8427/article/details/121285947 。
|
||||
class LeftSlideActions extends StatefulWidget {
|
||||
final double actionsWidth;
|
||||
final List<Widget> actions;
|
||||
final Widget child;
|
||||
final Decoration? decoration;
|
||||
final VoidCallback? actionsWillShow;
|
||||
final _BaseFunction<VoidCallback>? 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<LeftSlideActions>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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: <Widget>[
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(tipTitle!, style: TextStyle(fontSize: 24.sp))
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
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: <Widget>[
|
||||
// const SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
// Column(
|
||||
// children: [
|
||||
// Text(tipTitle!, style: TextStyle(fontSize: 24.sp))
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// actions: <Widget>[
|
||||
// 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("确定");
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
),
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user