1、修复添加指纹、人脸、遥控轻微左右滑动添加卡类型不同问题。2、添加星锁状态、添加用户协议根据是否是添加用户前流程

This commit is contained in:
魏少阳 2024-04-25 11:56:13 +08:00
parent 39455bf6e9
commit b5f9f91ec5
14 changed files with 477 additions and 211 deletions

View File

@ -76,7 +76,7 @@ import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkin
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart'; import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart'; import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
import 'main/lockDetail/face/addFace/addFace_page.dart'; import 'main/lockDetail/face/addFace/addFace_page.dart';
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart'; import 'main/lockDetail/face/addFaceType/addFaceType_page.dart';
import 'main/lockDetail/face/faceList/faceList_page.dart'; import 'main/lockDetail/face/faceList/faceList_page.dart';
import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart'; import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart';
import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart'; import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart';
@ -117,7 +117,7 @@ import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart'; import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart'; import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart';
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart'; import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControlManage/addRemoteControlManage_page.dart'; import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart';
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart'; import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart'; import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart';
import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart'; import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart';
@ -412,8 +412,7 @@ abstract class Routers {
static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; // static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; //
static const remoteControlListPage = '/RemoteControlListPage'; // static const remoteControlListPage = '/RemoteControlListPage'; //
static const addRemoteControlManagePage = static const addRemoteControlPage = '/AddRemoteControlPage'; //
'/AddRemoteControlManagePage'; //
static const cardListPage = '/CardListPage'; // static const cardListPage = '/CardListPage'; //
// static const addCardTypeManagePage = '/AddCardTypeManagePage'; // // static const addCardTypeManagePage = '/AddCardTypeManagePage'; //
@ -423,7 +422,7 @@ abstract class Routers {
static const addFingerprintTypePage = '/AddFingerprintTypePage'; // static const addFingerprintTypePage = '/AddFingerprintTypePage'; //
static const fingerprintDetailPage = '/FingerprintDetailPage'; // static const fingerprintDetailPage = '/FingerprintDetailPage'; //
static const faceListPage = '/FaceListPage'; // static const faceListPage = '/FaceListPage'; //
static const addFaceTypeManagePage = '/AddFaceTypeManagePage'; // static const addFaceTypePage = '/AddFaceTypePage'; //
static const faceDetailPage = '/faceDetailPage'; // static const faceDetailPage = '/faceDetailPage'; //
static const irisListPage = '/IrisListPage'; // static const irisListPage = '/IrisListPage'; //
@ -1006,8 +1005,8 @@ abstract class AppRouters {
name: Routers.remoteControlListPage, name: Routers.remoteControlListPage,
page: () => const RemoteControlListPage()), page: () => const RemoteControlListPage()),
GetPage( GetPage(
name: Routers.addRemoteControlManagePage, name: Routers.addRemoteControlPage,
page: () => const AddRemoteControlManagePage()), page: () => const AddRemoteControlPage()),
GetPage(name: Routers.cardListPage, page: () => const CardListPage()), GetPage(name: Routers.cardListPage, page: () => const CardListPage()),
// GetPage( // GetPage(
// name: Routers.addCardTypeManagePage, // name: Routers.addCardTypeManagePage,
@ -1027,8 +1026,8 @@ abstract class AppRouters {
page: () => const FingerprintDetailPage()), page: () => const FingerprintDetailPage()),
GetPage(name: Routers.faceListPage, page: () => const FaceListPage()), GetPage(name: Routers.faceListPage, page: () => const FaceListPage()),
GetPage( GetPage(
name: Routers.addFaceTypeManagePage, name: Routers.addFaceTypePage,
page: () => const AddFaceTypeManagePage()), page: () => const AddFaceTypePage()),
GetPage( GetPage(
name: Routers.passwordKeyDetailChangeDatePage, name: Routers.passwordKeyDetailChangeDatePage,
page: () => const PasswordKeyDetailChangeDatePage()), page: () => const PasswordKeyDetailChangeDatePage()),

View File

@ -86,6 +86,7 @@ class IoSenderManage {
List<int>? publicKey, List<int>? publicKey,
List<int>? privateKey, List<int>? privateKey,
List<int>? token, List<int>? token,
bool? isBeforeAddUser,
CommandSendCallBack? callBack}) { CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData( CommandSenderManager().managerSendData(
command: AddUserCommand( command: AddUserCommand(
@ -103,7 +104,7 @@ class IoSenderManage {
publicKey: publicKey, publicKey: publicKey,
privateKey: privateKey, privateKey: privateKey,
token: token), token: token),
isBeforeAddUser: true, isBeforeAddUser: isBeforeAddUser!,
callBack: callBack); callBack: callBack);
} }
@ -214,6 +215,7 @@ class IoSenderManage {
{String? lockID, {String? lockID,
String? userID, String? userID,
List<int>? privateKey, List<int>? privateKey,
bool? isBeforeAddUser,
CommandSendCallBack? callBack}) { CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData( CommandSenderManager().managerSendData(
command: GetStarLockStatuInfoCommand( command: GetStarLockStatuInfoCommand(
@ -221,6 +223,7 @@ class IoSenderManage {
userID: userID, userID: userID,
privateKey: privateKey, privateKey: privateKey,
), ),
isBeforeAddUser: isBeforeAddUser!,
callBack: callBack); callBack: callBack);
} }

View File

@ -180,7 +180,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
} }
break; break;
case 5: case 5:
Get.toNamed(Routers.addFaceTypeManagePage, arguments: { Get.toNamed(Routers.addFaceTypePage, arguments: {
"lockId": state.getKeyInfosData.value.lockId, "lockId": state.getKeyInfosData.value.lockId,
"fromType": 2, // 1 2 "fromType": 2, // 1 2
"fromTypeTwoStaffName": state.staffNameController.text "fromTypeTwoStaffName": state.staffNameController.text

View File

@ -16,16 +16,17 @@ class AddFaceTypeLogic extends BaseGetXController {
var startTime = ""; var startTime = "";
var endTime = ""; var endTime = "";
if (state.selectType.value == "0") { if (state.selectType.value == "0") {
print("永久卡永久卡永久卡");
faceType = 1; faceType = 1;
startDate = "0"; startDate = "0";
endDate = "0"; endDate = "0";
startTime = "0"; startTime = "0";
endTime = "0"; endTime = "0";
} else if (state.selectType.value == "1") { } else if (state.selectType.value == "1") {
print("限时卡限时卡限时卡");
faceType = 2; faceType = 2;
startDate = startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
startTime = "0"; startTime = "0";
endTime = "0"; endTime = "0";
@ -48,16 +49,18 @@ class AddFaceTypeLogic extends BaseGetXController {
return; return;
} }
} else if (state.selectType.value == "2") { } else if (state.selectType.value == "2") {
if (state.beginTime.value.isEmpty) { print("循环卡循环卡循环卡");
if (state.cycleBeginTime.value.isEmpty) {
showToast("请选择有效期".tr); showToast("请选择有效期".tr);
return; return;
} }
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString(); startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString(); endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
faceType = 4; faceType = 4;
} }
// //
Get.toNamed(Routers.addFacePage, arguments: { Get.toNamed(Routers.addFacePage, arguments: {
"lockId": state.lockId.value, "lockId": state.lockId.value,

View File

@ -9,106 +9,111 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'addFaceType_logic.dart'; import 'addFaceType_logic.dart';
class AddFaceTypePage extends StatefulWidget { class AddFaceTypePage extends StatefulWidget {
final String selectType; // const AddFaceTypePage({Key? key}) : super(key: key);
final int lockId;
final int fromType; // // 1 2
final String fromTypeTwoStaffName; //
const AddFaceTypePage(
{Key? key,
required this.selectType,
required this.lockId,
required this.fromType,
required this.fromTypeTwoStaffName})
: super(key: key);
@override @override
State<AddFaceTypePage> createState() => _AddFaceTypePageState(); State<AddFaceTypePage> createState() => _AddFaceTypePageState();
} }
class _AddFaceTypePageState extends State<AddFaceTypePage> { class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProviderStateMixin {
final logic = Get.put(AddFaceTypeLogic()); final logic = Get.put(AddFaceTypeLogic());
final state = Get.find<AddFaceTypeLogic>().state; final state = Get.find<AddFaceTypeLogic>().state;
@override
Widget build(BuildContext context) {
state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId;
if (widget.fromTypeTwoStaffName.isNotEmpty) {
state.nameController.text = widget.fromTypeTwoStaffName;
}
state.fromType.value = widget.fromType;
return indexChangeWidget();
}
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { state.tabController = TabController(
if (state.selectType.value == "1") { vsync: this,
state.beginTime.value = DateTool().dateToYMDHNString( length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
DateTime.now().millisecondsSinceEpoch.toString()); // initialIndex: 0);
state.endTime.value = DateTool().dateToYMDHNString( state.tabController.addListener(() {
DateTime.now().millisecondsSinceEpoch.toString()); // WidgetsBinding.instance.addPostFrameCallback((_) {
} else { state.selectType.value = state.tabController.index.toString();
state.beginTime.value = ""; // });
state.endTime.value = ""; //
if (state.tabController.animation!.value == state.tabController.index) {
FocusScope.of(context).requestFocus(FocusNode());
} }
}); });
} }
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
_tabBar(),
_pageWidget(),
],
),
);
}
Widget indexChangeWidget() { Widget indexChangeWidget() {
switch (int.parse(widget.selectType)) { switch (int.parse(state.selectType.value)) {
case 0: case 0:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyBottomWidget() state.nameController),
], keyBottomWidget()
],
),
); );
} }
case 1: case 1:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyTimeLimitWidget(), state.nameController),
keyBottomWidget() keyTimeLimitWidget(),
], keyBottomWidget()
],
),
); );
} }
case 2: case 2:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyCyclicDate(), state.nameController),
SizedBox(height: 10.h), keyCyclicDate(),
keyBottomWidget() SizedBox(height: 10.h),
], keyBottomWidget()
],
),
); );
} }
default: default:
@ -138,24 +143,24 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value, rightTitle: state.timeLimitBeginTime.value,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1); state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
}); });
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.endTime.value, rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1); state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
}); });
})), })),
Container(height: 10.h), Container(height: 10.h),
], ],
@ -168,47 +173,44 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle: "${state.beginTime.value}\n${state.endTime.value}", rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: { var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value, 'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value, 'starDate': state.cycleBeginTime.value,
'endDate': state.endTime.value, 'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value, 'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value 'endTime': state.failureDateTime.value
}); });
if (result != null && result.isNotEmpty) { if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue']; state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate']; state.cycleBeginTime.value = result['starDate'];
state.endTime.value = result['endDate']; state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
Get.log(
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
} }
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.weekdaysList.isNotEmpty ? true : false, visible: state.weekdaysList.isNotEmpty ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: "有效日", leftTitel: "有效日".tr,
rightTitle: state.weekdaysList.value.join(",").toString(), rightTitle: state.weekdaysList.value.join(",").toString(),
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
arguments: { 'validityValue': state.weekdaysList.value,
'validityValue': state.weekdaysList.value, 'starDate': state.cycleBeginTime.value,
'starDate': state.beginTime.value, 'endDate': state.cycleEndTime.value,
'endDate': state.endTime.value, 'starTime': state.effectiveDateTime.value,
'starTime': state.effectiveDateTime.value, 'endTime': state.failureDateTime.value
'endTime': state.failureDateTime.value });
});
if (result != null && result.isNotEmpty) { if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue']; state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate']; state.cycleBeginTime.value = result['starDate'];
state.endTime.value = result['endDate']; state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
} }
@ -217,25 +219,22 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
visible: state.effectiveDateTime.value.isNotEmpty, visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem( child: CommonItem(
leftTitel: "有效时间".tr, leftTitel: "有效时间".tr,
rightTitle: rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
arguments: { 'validityValue': state.weekdaysList.value,
'validityValue': state.weekdaysList.value, 'starDate': state.cycleBeginTime.value,
'starDate': state.beginTime.value, 'endDate': state.cycleEndTime.value,
'endDate': state.endTime.value, 'starTime': state.effectiveDateTime.value,
'starTime': state.effectiveDateTime.value, 'endTime': state.failureDateTime.value
'endTime': state.failureDateTime.value });
});
if (result != null && result.isNotEmpty) { if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue']; state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate']; state.cycleBeginTime.value = result['starDate'];
state.endTime.value = result['endDate']; state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
Get.back(result: result);
} }
}))), }))),
], ],
@ -338,4 +337,69 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
}, },
); );
} }
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
TabBar _tabBar() {
return TabBar(
controller: state.tabController,
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
unselectedLabelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
),
automaticIndicatorColorAdjustment: true,
labelColor: AppColors.mainColor,
labelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
indicator: CustomUnderlineTabIndicator(
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
strokeCap: StrokeCap.round,
width: 30.w),
);
}
Tab _tab(ItemView item) {
return Tab(
child: SizedBox(
width: 1.sw / 5,
child: Text(item.title, textAlign: TextAlign.center)));
}
Widget _pageWidget() {
return Expanded(
child: TabBarView(
controller: state.tabController,
children:
state.fromType.value == 1
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
),
);
}
}
class ItemView {
const ItemView({required this.title, required this.selectType});
final String title;
final String selectType;
} }

View File

@ -1,30 +1,33 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../tools/dateTool.dart';
class AddFaceTypeState { class AddFaceTypeState {
final lockId = 0.obs; final lockId = 0.obs;
final selectType = "0".obs; // 0 1 2 final selectType = "0".obs; // 0 1 2
final fromType = 1.obs; // // 1 2 final fromType = 1.obs; // // 1 2
var fromTypeTwoStaffName = "".obs; //
final isStressFingerprint = false.obs; final isStressFingerprint = false.obs;
final isAdministrator = false.obs; // final isAdministrator = false.obs; //
var beginTime = "".obs; // var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var endTime = "".obs; // var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var effectiveDateTime = "".obs; // var cycleBeginTime = "".obs;//
var failureDateTime = "".obs; // var cycleEndTime = "".obs;//
var effectiveDateTime = "".obs;//
var failureDateTime = "".obs;//
var weekdaysList = [].obs; var weekdaysList = [].obs;
var fromTypeTwoStaffName = "".obs; //
final TextEditingController nameController = TextEditingController(); final TextEditingController nameController = TextEditingController();
late TabController tabController;
AddFaceTypeState() { AddFaceTypeState() {
// Map map = Get.arguments; Map map = Get.arguments;
// lockId.value = map["lockId"]; lockId.value = map["lockId"];
// fromType.value = map["fromType"]; fromType.value = map["fromType"];
// if(fromType.value == 2){ // 1 2
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // if(fromType.value == 2){
// // nameController.text = fromTypeTwoStaffName.value; fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; //
// } }
// print("lockId:${lockId.value} fromType:${fromType.value}");
} }
} }

View File

@ -79,7 +79,7 @@ class _FaceListPageState extends State<FaceListPage> {
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}', '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
onClick: () async { onClick: () async {
var data = var data =
await Get.toNamed(Routers.addFaceTypeManagePage, arguments: { await Get.toNamed(Routers.addFaceTypePage, arguments: {
"lockId": state.lockId.value, "lockId": state.lockId.value,
"fromType": 1 // 1 2 "fromType": 1 // 1 2
}); });

View File

@ -72,44 +72,50 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
{ {
// //
// return sendElectronicKeySucceed(); // return sendElectronicKeySucceed();
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyBottomWidget() state.nameController),
], keyBottomWidget()
],
),
); );
} }
case 1: case 1:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyTimeLimitWidget(), state.nameController),
SizedBox(height: 10.h), keyTimeLimitWidget(),
keyBottomWidget() SizedBox(height: 10.h),
], keyBottomWidget()
],
),
); );
} }
case 2: case 2:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyCyclicDate(), state.nameController),
SizedBox(height: 10.h), keyCyclicDate(),
keyBottomWidget() SizedBox(height: 10.h),
], keyBottomWidget()
],
),
); );
} }
default: default:

View File

@ -74,10 +74,10 @@ class LockEscalationLogic extends BaseGetXController {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey); var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); List<int> signKeyDataList = changeStringListToIntList(signKey!);
String lockID = CommonDataManage.shareManager() String lockID = CommonDataManage.shareManager()?.currentLockSetInfoData
?.currentLockSetInfoData
.lockId .lockId
?.toString() ?? ?.toString() ??
''; '';

View File

@ -8,34 +8,67 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'addRemoteControl_logic.dart'; import 'addRemoteControl_logic.dart';
class AddRemoteControlPage extends StatefulWidget { class AddRemoteControlPage extends StatefulWidget {
final String selectType; const AddRemoteControlPage({Key? key})
const AddRemoteControlPage({Key? key, required this.selectType})
: super(key: key); : super(key: key);
@override @override
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState(); State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
} }
class _AddRemoteControlPageState extends State<AddRemoteControlPage> { class _AddRemoteControlPageState extends State<AddRemoteControlPage> with SingleTickerProviderStateMixin {
final logic = Get.put(AddRemoteControlLoigc()); final logic = Get.put(AddRemoteControlLoigc());
final state = Get.find<AddRemoteControlLoigc>().state; final state = Get.find<AddRemoteControlLoigc>().state;
@override
void initState() {
// TODO: implement initState
super.initState();
state.tabController = TabController(
vsync: this,
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
state.selectType.value = state.tabController.index.toString();
});
if (state.tabController.animation!.value == state.tabController.index) {
FocusScope.of(context).requestFocus(FocusNode());
}
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return indexChangeWidget(); return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
_tabBar(),
_pageWidget(),
],
),
);
} }
Widget indexChangeWidget() { Widget indexChangeWidget() {
switch (int.parse(widget.selectType)) { switch (int.parse(state.selectType.value)) {
case 0: case 0:
{ {
// //
@ -68,37 +101,18 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
case 2: case 2:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
CommonItem( state.nameController),
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, keyCyclicDate(),
rightTitle: "", SizedBox(height: 10.h),
isHaveDirection: true, keyBottomWidget()
action: () async { ],
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, ),
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate'];
state.endTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
}
}),
SizedBox(height: 10.h),
keyBottomWidget()
],
); );
} }
default: default:
@ -127,29 +141,104 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value, rightTitle: state.timeLimitBeginTime.value,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1); state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
}); });
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.endTime.value, rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { Pickers.showDatePicker(context, mode: DateMode.YMDHM,
state.endTime.value = DateTool().getYMDHNDateString(p, 1); onConfirm: (p) {
}); state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
})), })),
Container(height: 10.h), Container(height: 10.h),
], ],
); );
} }
//
Widget keyCyclicDate() {
return Column(
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
}
})),
Obx(() => Visibility(
visible: state.weekdaysList.isNotEmpty ? true : false,
child: CommonItem(
leftTitel: "有效日".tr,
rightTitle: state.weekdaysList.value.join(",").toString(),
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
}
}))),
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
}
}))),
],
);
}
Widget keyBottomWidget() { Widget keyBottomWidget() {
return Column( return Column(
children: [ children: [
@ -310,4 +399,69 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
}, },
); );
} }
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
TabBar _tabBar() {
return TabBar(
controller: state.tabController,
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
unselectedLabelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
),
automaticIndicatorColorAdjustment: true,
labelColor: AppColors.mainColor,
labelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
indicator: CustomUnderlineTabIndicator(
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
strokeCap: StrokeCap.round,
width: 30.w),
);
}
Tab _tab(ItemView item) {
return Tab(
child: SizedBox(
width: 1.sw / 5,
child: Text(item.title, textAlign: TextAlign.center)));
}
Widget _pageWidget() {
return Expanded(
child: TabBarView(
controller: state.tabController,
children:
state.fromType.value == 1
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
),
);
}
}
class ItemView {
const ItemView({required this.title, required this.selectType});
final String title;
final String selectType;
} }

View File

@ -2,13 +2,39 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
class AddRemoteControlState{ import '../../../../tools/dateTool.dart';
var beginTime = "".obs;// class AddRemoteControlState{
var endTime = "".obs;// final lockId = 0.obs;
final selectType = "0".obs;// 0 1 2
final fromType = 1.obs; // // 1 2
final isStressFingerprint = false.obs;
final isAdministrator = false.obs;//
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var cycleBeginTime = "".obs;//
var cycleEndTime = "".obs;//
var effectiveDateTime = "".obs;// var effectiveDateTime = "".obs;//
var failureDateTime = "".obs;// var failureDateTime = "".obs;//
var weekdaysList = [].obs; var weekdaysList = [].obs;
var fromTypeTwoStaffName = "".obs; //
final TextEditingController nameController = TextEditingController(); final TextEditingController nameController = TextEditingController();
late TabController tabController;
AddRemoteControlState() {
Map map = Get.arguments;
if(map["lockId"]!=null){
lockId.value = map["lockId"];
}
if(map["fromType"]!=null){
fromType.value = map["fromType"];
// 1 2
if(fromType.value == 2){
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; //
}
}
}
} }

View File

@ -6,6 +6,7 @@ import 'package:get/get.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonDataManage.dart';
import '../../../../tools/keySearchWidget.dart'; import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/noData.dart'; import '../../../../tools/noData.dart';
import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showIosTipView.dart';
@ -69,7 +70,10 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}', '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}',
onClick: () async { onClick: () async {
var data = var data =
await Get.toNamed(Routers.addRemoteControlManagePage); await Get.toNamed(Routers.addRemoteControlPage, arguments: {
"lockId": CommonDataManage().currentLockSetInfoData.lockId,
"fromType": 1 // 1 2
});
if (data != null) { if (data != null) {
// //

View File

@ -298,6 +298,7 @@ class NearbyLockLogic extends BaseGetXController {
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
isBeforeAddUser: true,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
@ -343,6 +344,7 @@ class NearbyLockLogic extends BaseGetXController {
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
isBeforeAddUser: true,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
} else if (state == BluetoothConnectionState.disconnected) { } else if (state == BluetoothConnectionState.disconnected) {

View File

@ -86,7 +86,8 @@ class SaveLockLogic extends BaseGetXController {
needAuthor: 1, needAuthor: 1,
publicKey: publicKeyDataList, publicKey: publicKeyDataList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
token: token); token: token,
isBeforeAddUser: true);
break; break;
case 0x07: case 0x07:
// //
@ -234,7 +235,8 @@ class SaveLockLogic extends BaseGetXController {
needAuthor:1, needAuthor:1,
publicKey:publicKeyDataList, publicKey:publicKeyDataList,
privateKey:getPrivateKeyList, privateKey:getPrivateKeyList,
token: getTokenList token: getTokenList,
isBeforeAddUser: true
); );
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();