升级flutter版本3.19.6

This commit is contained in:
魏少阳 2024-05-30 09:27:29 +08:00
parent 19221dc666
commit 6daf8a45f0
10 changed files with 224 additions and 236 deletions

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import '../../../../tools/commonDataManage.dart';
@ -13,6 +14,7 @@ class AddICCardState{ // 0永久 1显示 2循环
cardNumber.value = map['cardNumber'];
cardType.value = map['cardType'];
isCoerced.value = map['isCoerced'];
AppLog.log('1111-isCoerced.value:${isCoerced.value}');
isAdministrator.value = map['isAdministrator'];
startDate.value = map['startDate'];
weekDay.value = map['weekDay'];

View File

@ -4,6 +4,8 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart';
import 'package:star_lock/main/lockDetail/face/addFace/addFace_state.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
@ -23,7 +25,7 @@ class AddFaceLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
//
if (reply is SenderAddFaceReply && state.ifCurrentScreen.value == true) {
_replyAddFaceBegin(reply);
@ -42,7 +44,7 @@ class AddFaceLogic extends BaseGetXController {
}
Future<void> _replyAddFaceBegin(Reply reply) async {
int status = reply.data[2];
final int status = reply.data[2];
switch (status) {
case 0x00:
//
@ -55,25 +57,25 @@ class AddFaceLogic extends BaseGetXController {
break;
case 0x06:
//
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token);
final List<int> token = reply.data.sublist(5, 9);
final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderAddFaceCommand(
keyID:"1",
keyID:'1',
userID:await Storage.getUid(),
faceNo:0,
useCountLimit:0xffff,
isForce:state.isCoerced.value == "2" ? 1 : 0, //
isAdmin: state.isAdministrator.value == "2" ? 1 : 0,
isForce:state.isCoerced.value == '2' ? 1 : 0, //
isAdmin: state.isAdministrator.value == '2' ? 1 : 0,
operate: 0,
isRound:state.selectType.value == "2" ? 1: 0, //
isRound:state.selectType.value == '2' ? 1: 0, //
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), //
startDate: int.parse(state.startDate.value)~/1000,
endDate: int.parse(state.endDate.value)~/1000,
@ -89,7 +91,7 @@ class AddFaceLogic extends BaseGetXController {
default:
//
state.ifAddState.value = false;
showToast("添加人脸失败", something: (){
showToast('添加人脸失败', something: (){
Get.back();
});
break;
@ -97,38 +99,38 @@ class AddFaceLogic extends BaseGetXController {
}
Future<void> _replyAddFaceProcess(Reply reply) async {
int status = reply.data[2];
final int status = reply.data[2];
switch (status) {
case 0x00:
switch(reply.data[5]){
case 0xff:
//
showToast("退出添加".tr);
showToast('退出添加'.tr);
state.ifAddState.value = false;
Get.close(1);
break;
case 0xFE:
//
showToast("管理员已满".tr);
showToast('管理员已满'.tr);
state.ifAddState.value = false;
Get.close(1);
break;
case 0xFD:
//
showToast("用户已满".tr);
showToast('用户已满'.tr);
state.ifAddState.value = false;
Get.close(1);
break;
case 0xFC:
//
showToast("锁上面添加人脸已满".tr);
showToast('锁上面添加人脸已满'.tr);
state.ifAddState.value = false;
Get.close(1);
break;
case 0xFB:
//
showToast("人脸已存在".tr);
showToast('人脸已存在'.tr);
state.ifAddState.value = false;
break;
default:
@ -159,12 +161,12 @@ class AddFaceLogic extends BaseGetXController {
}
Future<void> _replyAddFaceConfirmation(Reply reply) async {
int status = reply.data[2];
final int status = reply.data[2];
switch (status) {
case 0x00:
//
var faceList = reply.data.sublist(reply.data.length - 2);
var faceNumber = listChangInt(faceList).toString();
final List<int> faceList = reply.data.sublist(reply.data.length - 2);
final String faceNumber = listChangInt(faceList).toString();
// var faceNumber = listChangInt(reply.data.sublist(6, 7)).toString();
// if (state.faceNumber.value == (reply.data[6]).toString()) {
if (state.faceNumber.value == faceNumber) {
@ -192,24 +194,24 @@ class AddFaceLogic extends BaseGetXController {
if (deviceConnectionState == BluetoothConnectionState.connected) {
cancelBlueConnetctToastTimer();
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.senderAddFaceCommand(
keyID:"1",
keyID:'1',
userID:await Storage.getUid(),
faceNo:0,
useCountLimit:0xffff,
isForce:state.isCoerced.value == "2" ? 1 : 0, //
isAdmin: state.isAdministrator.value == "2" ? 1 : 0,
isForce:state.isCoerced.value == '2' ? 1 : 0, //
isAdmin: state.isAdministrator.value == '2' ? 1 : 0,
operate: 0,
isRound:state.selectType.value == "2" ? 1: 0, //
isRound:state.selectType.value == '2' ? 1: 0, //
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), //
startDate: int.parse(state.startDate.value)~/1000,
endDate: int.parse(state.endDate.value)~/1000,
@ -235,17 +237,17 @@ class AddFaceLogic extends BaseGetXController {
Future<void> senderCancelAddFaceCommand() async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.senderCancelAddFaceCommand(
keyID:"1",
keyID:'1',
userID:await Storage.getUid(),
needAuthor:1,
signKey:signKeyDataList,
@ -263,8 +265,8 @@ class AddFaceLogic extends BaseGetXController {
}
//
void addFaceData() async {
var entity = await ApiRepository.to.addFaceData(
Future<void> addFaceData() async {
final AddFaceEntity entity = await ApiRepository.to.addFaceData(
lockId: state.lockId.value,
faceName: state.faceName.value,
faceNumber: state.faceNumber.value,
@ -276,7 +278,7 @@ class AddFaceLogic extends BaseGetXController {
weekDay: state.weekDay.value,
startTime: int.parse(state.effectiveDateTime.value),
endTime: int.parse(state.failureDateTime.value),
faceRight: state.isAdministrator.value == "2" ? 1 : 0,
faceRight: state.isAdministrator.value == '2' ? 1 : 0,
);
if (entity.errorCode!.codeIsSuccessful) {
@ -286,14 +288,14 @@ class AddFaceLogic extends BaseGetXController {
}
//
void updateFaceUserNoLoadData(int faceId) async {
var entity = await ApiRepository.to.updateFaceUserNo(
Future<void> updateFaceUserNoLoadData(int faceId) async {
final LoginEntity entity = await ApiRepository.to.updateFaceUserNo(
faceId: faceId,
lockId: state.lockId.value,
faceUserNo: state.faceNumber.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("添加成功");
showToast('添加成功');
if (state.fromType.value == 2) {
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(
@ -307,7 +309,6 @@ class AddFaceLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initReplySubscription();
@ -315,7 +316,6 @@ class AddFaceLogic extends BaseGetXController {
@override
void onInit() {
// TODO: implement onInit
super.onInit();
//
// senderAddFace();
@ -323,7 +323,6 @@ class AddFaceLogic extends BaseGetXController {
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_replySubscription.cancel();

View File

@ -75,7 +75,7 @@ class AddFingerprintLogic extends BaseGetXController {
userID:await Storage.getUid(),
fingerNo:0,
useCountLimit:0xffff,
isForce:state.isCoerced.value == '2' ? 1 : 0, //
isForce:state.isCoerced.value == '1' ? 1 : 0, //
isAdmin: state.isAdministrator.value == '2' ? 1 : 0,
operate: 0,
isRound:state.selectType.value == '2' ? 1: 0, //
@ -203,7 +203,7 @@ class AddFingerprintLogic extends BaseGetXController {
userID:await Storage.getUid(),
fingerNo:0,
useCountLimit:0xffff,
isForce:state.isCoerced.value == '2' ? 1 : 0, //
isForce:state.isCoerced.value == '1' ? 1 : 0, //
isAdmin: state.isAdministrator.value == '2' ? 1 : 0,
operate: 0,
isRound:state.selectType.value == '2' ? 1: 0, //

View File

@ -3,50 +3,49 @@ import 'package:get/get.dart';
import 'package:star_lock/tools/commonDataManage.dart';
class AddFingerprintState{
var ifCurrentScreen = true.obs; // ,
var ifAddState = false.obs;//
var ifConnectScuess = false.obs;
var maxRegCount = 0.obs;//
var regIndex = 0.obs;//
var fingerprintNumber = "".obs;
final lockId = 0.obs;
final endDate = "".obs;
final addType = "".obs;
final fingerprintName = "".obs;
final fingerprintType = "".obs;
final isCoerced = "".obs;
final isAdministrator = "".obs;
final startDate = "".obs;
final weekDay = [].obs;
final fromType = 1.obs;
final effectiveDateTime = "".obs; //
final failureDateTime = "".obs; //
final selectType = "0".obs; // 0 1 2
AddFingerprintState() {
Map map = Get.arguments;
lockId.value = map["lockId"];
addType.value = map["addType"];
fingerprintName.value = map["fingerprintName"];
fingerprintType.value = map["fingerprintType"];
isCoerced.value = map["isCoerced"];
isAdministrator.value = map["isAdministrator"];
startDate.value = map["startDate"];
lockId.value = map["lockId"];
weekDay.value = map["weekDay"];
fromType.value = map["fromType"];
effectiveDateTime.value = map["effectiveTime"];
failureDateTime.value = map["failureTime"];
selectType.value = map["selectType"];
lockId.value = map['lockId'];
addType.value = map['addType'];
fingerprintName.value = map['fingerprintName'];
fingerprintType.value = map['fingerprintType'];
isCoerced.value = map['isCoerced'];
isAdministrator.value = map['isAdministrator'];
startDate.value = map['startDate'];
lockId.value = map['lockId'];
weekDay.value = map['weekDay'];
fromType.value = map['fromType'];
effectiveDateTime.value = map['effectiveTime'];
failureDateTime.value = map['failureTime'];
selectType.value = map['selectType'];
//
if (selectType.value == '2') {
endDate.value =
"${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}";
} else {
endDate.value = map["endDate"];
endDate.value = map['endDate'];
}
}
RxBool ifCurrentScreen = true.obs; // ,
RxBool ifAddState = false.obs;//
RxBool ifConnectScuess = false.obs;
RxInt maxRegCount = 0.obs;//
RxInt regIndex = 0.obs;//
RxString fingerprintNumber = ''.obs;
final RxInt lockId = 0.obs;
final RxString endDate = ''.obs;
final RxString addType = ''.obs;
final RxString fingerprintName = ''.obs;
final RxString fingerprintType = ''.obs;
final RxString isCoerced = ''.obs;
final RxString isAdministrator = ''.obs;
final RxString startDate = ''.obs;
final RxList weekDay = [].obs;
final RxInt fromType = 1.obs;
final RxString effectiveDateTime = ''.obs; //
final RxString failureDateTime = ''.obs; //
final RxString selectType = '0'.obs;// 0 1 2
}

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../appRouters.dart';
import '../../../../network/api_repository.dart';
@ -10,31 +11,31 @@ class AddFingerprintTypeLogic extends BaseGetXController{
AddFingerprintState state = AddFingerprintState();
//
void addFingerprintsData() async {
var fingerprintType = 0; // :1;23:4
var startDate = "";
var endDate = "";
var startTime = "";
var endTime = "";
if (state.selectType.value == "0") {
Future<void> addFingerprintsData() async {
int fingerprintType = 0; // :1;23:4
String startDate = '';
String endDate = '';
String startTime = '';
String endTime = '';
if (state.selectType.value == '0') {
fingerprintType = 1;
startDate = "0";
endDate = "0";
startTime = "0";
endTime = "0";
} else if (state.selectType.value == "1") {
startDate = '0';
endDate = '0';
startTime = '0';
endTime = '0';
} else if (state.selectType.value == '1') {
fingerprintType = 2;
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
startTime = "0";
endTime = "0";
startTime = '0';
endTime = '0';
if (startDate.isEmpty) {
showToast("请选择开始时间".tr);
showToast('请选择开始时间'.tr);
return;
}
if (endDate.isEmpty) {
showToast("请选择结束时间".tr);
showToast('请选择结束时间'.tr);
return;
}
@ -44,12 +45,12 @@ class AddFingerprintTypeLogic extends BaseGetXController{
// }
if (int.parse(startDate) >= int.parse(endDate)) {
showToast("失效时间要大于生效时间".tr);
showToast('失效时间要大于生效时间'.tr);
return;
}
} else if (state.selectType.value == "2") {
} else if (state.selectType.value == '2') {
if (state.cycleBeginTime.value.isEmpty) {
showToast("请选择有效期".tr);
showToast('请选择有效期'.tr);
return;
}
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
@ -61,27 +62,27 @@ class AddFingerprintTypeLogic extends BaseGetXController{
// var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1: 2:
//
Get.toNamed(Routers.addFingerprintPage, arguments: {
"lockId": state.lockId.value,
"endDate": endDate,
"addType": "1",
"fingerprintName": state.nameController.text,
"fingerprintNumber": "123456",
"fingerprintType": fingerprintType.toString(),
"isCoerced": state.isStressFingerprint.value == false ? "1" : "2", // 1: 2:
"startDate": startDate,
"weekDay": state.weekdaysList.value,
"fromType": state.fromType.value,
"isAdministrator": state.isAdministrator.value == false ? "1" : "2", // 1: 2:
"effectiveTime": startTime,
"failureTime": endTime,
"selectType": state.selectType.value,
Get.toNamed(Routers.addFingerprintPage, arguments: <String, Object>{
'lockId': state.lockId.value,
'endDate': endDate,
'addType': '1',
'fingerprintName': state.nameController.text,
'fingerprintNumber': '123456',
'fingerprintType': fingerprintType.toString(),
'isCoerced': state.isStressFingerprint.value == false ? '1' : '2', // 1: 2:
'startDate': startDate,
'weekDay': state.weekdaysList.value,
'fromType': state.fromType.value,
'isAdministrator': state.isAdministrator.value == false ? '1' : '2', // 1: 2:
'effectiveTime': startTime,
'failureTime': endTime,
'selectType': state.selectType.value,
});
}
//
void checkFingerprintNameDuplicated(String fingerprintName) async{
var entity = await ApiRepository.to.checkFingerprintNameDuplicatedData(
Future<void> checkFingerprintNameDuplicated(String fingerprintName) async{
final LoginEntity entity = await ApiRepository.to.checkFingerprintNameDuplicatedData(
lockId: state.lockId.value.toString(),
fingerprintName: fingerprintName,
);

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_state.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
@ -27,12 +28,11 @@ class AddFingerprintTypePage extends StatefulWidget {
}
class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with SingleTickerProviderStateMixin{
final logic = Get.put(AddFingerprintTypeLogic());
final state = Get.find<AddFingerprintTypeLogic>().state;
final AddFingerprintTypeLogic logic = Get.put(AddFingerprintTypeLogic());
final AddFingerprintState state = Get.find<AddFingerprintTypeLogic>().state;
@override
void initState() {
// TODO: implement initState
super.initState();
state.tabController = TabController(
@ -60,7 +60,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
children: <Widget>[
_tabBar(),
_pageWidget(),
],
@ -76,7 +76,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
// return sendElectronicKeySucceed();
return SingleChildScrollView(
child: Column(
children: [
children: <Widget>[
perpetualKeyWidget(
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseEnter!.tr,
@ -91,7 +91,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
//
return SingleChildScrollView(
child: Column(
children: [
children: <Widget>[
perpetualKeyWidget(
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseEnter!.tr,
@ -107,7 +107,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
//
return SingleChildScrollView(
child: Column(
children: [
children: <Widget>[
perpetualKeyWidget(
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseEnter!.tr,
@ -128,10 +128,10 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
Widget perpetualKeyWidget(
String titleStr, String rightTitle, TextEditingController controller) {
return Column(
children: [
children: <Widget>[
CommonItem(
leftTitel: titleStr,
rightTitle: "",
rightTitle: '',
isHaveRightWidget: true,
rightWidget: getTFWidget(rightTitle)),
Container(height: 10.h),
@ -142,7 +142,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
//
Widget keyTimeLimitWidget() {
return Column(
children: [
children: <Widget>[
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.timeLimitBeginTime.value,
@ -152,7 +152,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitBeginTime.value));
Pickers.showDatePicker(context,selectDate:selectDate, mode: DateMode.YMDHM,
onConfirm: (p) {
onConfirm: (PDuration p) {
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
@ -164,7 +164,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
Pickers.showDatePicker(context,selectDate:selectDate, mode: DateMode.YMDHM,
onConfirm: (p) {
onConfirm: (PDuration p) {
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
@ -176,14 +176,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
//
Widget keyCyclicDate() {
return Column(
children: [
children: <Widget>[
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
rightTitle:'${state.cycleBeginTime.value}\n${state.cycleEndTime.value}',
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
@ -199,14 +199,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
}
})),
Obx(() => Visibility(
visible: state.weekdaysList.isNotEmpty ? true : false,
visible: state.weekdaysList.isNotEmpty,
child: CommonItem(
leftTitel: "有效日".tr,
rightTitle: state.weekdaysList.value.join(",").toString(),
leftTitel: '有效日'.tr,
rightTitle: state.weekdaysList.value.join(',').toString(),
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
@ -224,11 +224,11 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
leftTitel: '有效时间'.tr,
rightTitle: '${state.effectiveDateTime.value}-${state.failureDateTime.value}',
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
@ -249,14 +249,12 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
Widget keyBottomWidget() {
return Column(
children: [
children: <Widget>[
Obx(() => Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
? true
: false,
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
child: CommonItem(
leftTitel: "是否为管理员".tr,
rightTitle: "",
leftTitel: '是否为管理员'.tr,
rightTitle: '',
isTipsImg: false,
isHaveRightWidget: true,
rightWidget:
@ -264,7 +262,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
SizedBox(height: 10.h),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.stressFingerprint!.tr,
rightTitle: "",
rightTitle: '',
isTipsImg: false,
isHaveRightWidget: true,
rightWidget: SizedBox(
@ -282,16 +280,16 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
SubmitBtn(
btnName: TranslationLoader.lanKeys!.next!.tr,
onClick: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
if (state.nameController.text.isEmpty) {
logic.showToast("请输入姓名".tr);
logic.showToast('请输入姓名'.tr);
return;
}
logic.checkFingerprintNameDuplicated(state.nameController.text);
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式".tr);
logic.showToast('演示模式'.tr);
}
}),
],
@ -378,7 +376,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Expanded(
child: TextField(
//
@ -423,7 +421,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isStressFingerprint.value,
onChanged: (value) {
onChanged: (bool value) {
state.isStressFingerprint.value = value;
},
);
@ -436,27 +434,27 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isAdministrator.value,
onChanged: (value) {
onChanged: (bool value) {
state.isAdministrator.value = value;
},
);
}
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"),
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"),
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) {
onTap: (int 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(),

View File

@ -1,38 +1,39 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../tools/dateTool.dart';
class AddFingerprintState {
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 failureDateTime = "".obs; //
var weekdaysList = [].obs;
var fromTypeTwoStaffName = "".obs; //
final TextEditingController nameController = TextEditingController();
late TabController tabController;
AddFingerprintState() {
Map map = Get.arguments;
lockId.value = map["lockId"];
fromType.value = map["fromType"];
lockId.value = map['lockId'];
fromType.value = map['fromType'];
// 1 2
if (fromType.value == 2) {
fromTypeTwoStaffName.value =
map["fromTypeTwoStaffName"]; //
map['fromTypeTwoStaffName']; //
}
}
final RxInt lockId = 0.obs;
final RxString selectType = '0'.obs; // 0 1 2
final RxInt fromType = 1.obs; // // 1 2
final RxBool isStressFingerprint = false.obs;
final RxBool isAdministrator = false.obs; //
RxString timeLimitBeginTime = DateTool()
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
.obs; //
RxString timeLimitEndTime = DateTool()
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
.obs; //
RxString cycleBeginTime = ''.obs; //
RxString cycleEndTime = ''.obs; //
RxString effectiveDateTime = ''.obs; //
RxString failureDateTime = ''.obs; //
RxList weekdaysList = [].obs;
RxString fromTypeTwoStaffName = ''.obs; //
final TextEditingController nameController = TextEditingController();
late TabController tabController;
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart';
import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_state.dart';
import 'package:star_lock/tools/submitBtn.dart';
import '../../../../../appRouters.dart';
@ -21,8 +22,8 @@ class RecipientInformationPage extends StatefulWidget {
}
class _RecipientInformationPageState extends State<RecipientInformationPage> {
final logic = Get.put(RecipientInformationLogic());
final state = Get.find<RecipientInformationLogic>().state;
final RecipientInformationLogic logic = Get.put(RecipientInformationLogic());
final RecipientInformationState state = Get.find<RecipientInformationLogic>().state;
@override
Widget build(BuildContext context) {
@ -35,7 +36,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
children: <Widget>[
SizedBox(height: 150.h, child: _buildMainUI()),
SizedBox(height: 10.h),
_buildAccoutRow(),
@ -43,7 +44,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
_buildNextBtn(context),
SizedBox(height: 64.h),
Visibility(
visible: state.isFromType.value == 1 ? true : false,
visible: state.isFromType.value == 1,
child: _buildRemoveBadLockBtn()),
SizedBox(
height: 64.h,
@ -55,12 +56,12 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
Widget _buildMainUI() {
return Obx(() => Column(
children: [
children: <Widget>[
_electronicKeyItem(
state.type.value == 1
? 'images/select_circle.png'
: 'images/normal_circle.png',
"个人用户", () {
'个人用户', () {
setState(() {
state.type.value = 1;
});
@ -69,7 +70,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
state.type.value == 2
? 'images/select_circle.png'
: 'images/normal_circle.png',
"星寓", () {
'星寓', () {
setState(() {
state.type.value = 2;
});
@ -88,7 +89,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
children: <Widget>[
SizedBox(
width: 40.w,
),
@ -117,9 +118,9 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
// height: 60.h,
color: Colors.white,
child: Column(
children: [
children: <Widget>[
Row(
children: [
children: <Widget>[
SizedBox(
width: 40.w,
),
@ -131,11 +132,11 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
controller: state.numberController,
textAlign: TextAlign.right,
keyboardType: TextInputType.text,
onChanged: (value) {},
onChanged: (String value) {},
decoration: InputDecoration(
border: InputBorder.none,
hintText:
state.type.value == 1 ? "请输入手机号或email" : "请输入星寓管理员的账号",
state.type.value == 1 ? '请输入手机号或email' : '请输入星寓管理员的账号',
hintStyle: TextStyle(
color: AppColors.placeholderTextColor,
fontSize: ScreenUtil().setSp(22),
@ -152,7 +153,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
if (currentContact.phoneNumbers!.isNotEmpty) {
state.numberController.text = currentContact
.phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
.replaceAll(RegExp(r'\s+\b|\b\s'), '');
}
},
child: Image.asset(
@ -174,7 +175,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
@ -185,7 +186,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
var result = await Navigator.pushNamed(
Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
@ -217,17 +218,17 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
btnName: '下一步',
onClick: () {
if (state.numberController.text.isEmpty) {
logic.showToast("请输入手机号或email");
logic.showToast('请输入手机号或email');
return;
}
if (state.isFromType.value == 1) {
//
if (state.type.value == 1) {
logic.transferLockConfirmInfoData((v) {
logic.transferLockConfirmInfoData((RecipientInformationData v) {
showCupertinoAlertDialog(context, v);
});
} else {
logic.showToast("暂不支持跨平台转移,敬请期待");
logic.showToast('暂不支持跨平台转移,敬请期待');
// Get.toNamed(Routers.selectBranchPage, arguments: {
// "idList": state.idList.value,
// "countryCode": state.countryCode.value,
@ -238,11 +239,11 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
} else {
//
if (state.type.value == 1) {
logic.transferGateWayConfirmInfoData((v) {
logic.transferGateWayConfirmInfoData((RecipientInformationData v) {
showCupertinoAlertDialog(context, v);
});
} else {
logic.showToast("暂不支持跨平台转移,敬请期待");
logic.showToast('暂不支持跨平台转移,敬请期待');
// Get.toNamed(Routers.selectBranchPage, arguments: {
// "idList": state.idList.value,
@ -257,12 +258,10 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
Widget _buildRemoveBadLockBtn() {
return Row(
children: [
children: <Widget>[
const Expanded(child: SizedBox()),
TextButton(
onPressed: () {
logic.showDeletAlertDialog();
},
onPressed: logic.showDeletAlertDialog,
child: Text(
'移除坏锁',
style: TextStyle(
@ -298,9 +297,9 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
height: 400.h,
color: Colors.white,
child: Column(
children: [
children: <Widget>[
SizedBox(height: 20.h),
Text("转移确认", style: TextStyle(fontSize: 24.sp)),
Text('转移确认', style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 20.h),
Image.asset('images/icon_lockGroup_item.png',
width: 70.h, height: 70.h, fit: BoxFit.fill),
@ -318,7 +317,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
width: 80.w,
color: Colors.red,
child: Center(
child: Text(state.type.value == 1 ? "个人用户" : "星寓",
child: Text(state.type.value == 1 ? '个人用户' : '星寓',
style: TextStyle(
fontSize: 18.sp, color: Colors.white))),
),
@ -329,19 +328,16 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
Text(recipientInformationData.userid!,
style: TextStyle(fontSize: 22.sp)),
SizedBox(height: 8.h),
Text("本次共转移${state.idList.value.length}把智能锁",
Text('本次共转移${state.idList.value.length}把智能锁',
style: TextStyle(fontSize: 20.sp)),
SizedBox(height: 20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
children: <Widget>[
ElevatedButton(
onPressed: () {
Get.back();
},
onPressed: Get.back,
style: ElevatedButton.styleFrom(
onPrimary: AppColors.appBarIconColor,
backgroundColor: Colors.grey,
foregroundColor: AppColors.appBarIconColor, backgroundColor: Colors.grey,
minimumSize: Size(110.w, 45.h),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(
@ -362,8 +358,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
}
},
style: ElevatedButton.styleFrom(
onPrimary: AppColors.appBarIconColor,
backgroundColor: AppColors.mainColor,
foregroundColor: AppColors.appBarIconColor, backgroundColor: AppColors.mainColor,
minimumSize: Size(110.w, 45.h),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(

View File

@ -189,12 +189,9 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
onPressed: () {
Get.back();
},
onPressed: Get.back,
style: ElevatedButton.styleFrom(
onPrimary: AppColors.appBarIconColor,
backgroundColor: Colors.grey,
foregroundColor: AppColors.appBarIconColor, backgroundColor: Colors.grey,
minimumSize: Size(110.w, 45.h),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(
@ -204,13 +201,9 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
child: Text('取消'.tr, style: TextStyle(fontSize: 22.sp)),
),
ElevatedButton(
onPressed: () {
Get.back();
// logic.transferLockInfoData();
},
onPressed: Get.back,
style: ElevatedButton.styleFrom(
onPrimary: AppColors.appBarIconColor,
backgroundColor: AppColors.mainColor,
foregroundColor: AppColors.appBarIconColor, backgroundColor: AppColors.mainColor,
minimumSize: Size(110.w, 45.h),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(

View File

@ -165,7 +165,7 @@ dependencies:
#网络图片缓存
cached_network_image: ^3.2.0
webview_flutter: 4.5.0
webview_flutter: ^4.4.2
jpush_flutter: ^2.5.1