Merge branch 'master' of gitee.com:starlock-cn/app-starlock

# Conflicts:
#	star_lock/images/lan/lan_en.json
#	star_lock/images/lan/lan_keys.json
#	star_lock/images/lan/lan_zh.json
#	star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart
合并代码
This commit is contained in:
Daisy 2024-04-29 15:09:55 +08:00
commit 5c61f7a705
44 changed files with 1384 additions and 937 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -206,7 +206,7 @@
"gateway":"Gateway", "gateway":"Gateway",
"message":"Message", "message":"Message",
"supportStaff":"Support Staff", "supportStaff":"Support Staff",
"set":"Set", "set":"Setting",
"moreServices":"More Services", "moreServices":"More Services",
"moreSet":"More Set", "moreSet":"More Set",
@ -803,5 +803,6 @@
"不同意":"Disagree", "不同意":"Disagree",
"同意":"agree", "同意":"agree",
"已开通":"Have opened", "已开通":"Have opened",
"该功能是高级功能,请开通后再使用":"This function is an advanced function. Please enable it before using it" "该功能是高级功能,请开通后再使用":"This function is an advanced function. Please enable it before using it",
"常用程序":"Common Programs"
} }

View File

@ -802,5 +802,6 @@
"不同意":"不同意", "不同意":"不同意",
"同意":"同意", "同意":"同意",
"已开通":"已开通", "已开通":"已开通",
"该功能是高级功能,请开通后再使用":"该功能是高级功能,请开通后再使用" "该功能是高级功能,请开通后再使用":"该功能是高级功能,请开通后再使用",
"常用程序":"常用程序"
} }

View File

@ -805,5 +805,6 @@
"不同意":"不同意", "不同意":"不同意",
"同意":"同意", "同意":"同意",
"已开通":"已开通", "已开通":"已开通",
"该功能是高级功能,请开通后再使用":"该功能是高级功能,请开通后再使用" "该功能是高级功能,请开通后再使用":"该功能是高级功能,请开通后再使用",
"常用程序":"常用程序"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@ -41,14 +41,14 @@ PODS:
- ReachabilitySwift - ReachabilitySwift
- device_info_plus (0.0.1): - device_info_plus (0.0.1):
- Flutter - Flutter
- DKImagePickerController/Core (4.3.8): - DKImagePickerController/Core (4.3.7):
- DKImagePickerController/ImageDataManager - DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource - DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.8) - DKImagePickerController/ImageDataManager (4.3.7)
- DKImagePickerController/PhotoGallery (4.3.8): - DKImagePickerController/PhotoGallery (4.3.7):
- DKImagePickerController/Core - DKImagePickerController/Core
- DKPhotoGallery - DKPhotoGallery
- DKImagePickerController/Resource (4.3.8) - DKImagePickerController/Resource (4.3.7)
- DKPhotoGallery (0.0.17): - DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17) - DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17) - DKPhotoGallery/Model (= 0.0.17)
@ -306,7 +306,7 @@ SPEC CHECKSUMS:
camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68 camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
DKImagePickerController: a7836546cfdfe014171694f643a7d575bc8ace7f DKImagePickerController: 0a24ebfe7b48beeb74c27531540aaa2cc1dac6cf
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475 EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
file_picker: ce3938a0df3cc1ef404671531facef740d03f920 file_picker: ce3938a0df3cc1ef404671531facef740d03f920

View File

@ -304,9 +304,7 @@ class BlueManage {
} }
/// List senderData, /// List senderData,
Future<void> bludSendData( Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
String deviceName, ConnectStateCallBack stateCallBack,
{bool isAddEquipment = false}) async {
FlutterBluePlus.isSupported.then((isAvailable) async { FlutterBluePlus.isSupported.then((isAvailable) async {
if (isAvailable) { if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) { if (_adapterState == BluetoothAdapterState.on) {
@ -343,6 +341,7 @@ class BlueManage {
element.device.platformName == connectDeviceName || element.device.platformName == connectDeviceName ||
element.advertisementData.advName == connectDeviceName); element.advertisementData.advName == connectDeviceName);
if (isAddEquipment == false && isExistDevice == false) { if (isAddEquipment == false && isExistDevice == false) {
// AppLog.log("需要开启扫描");
// startScan(10, (scanDevices){ // startScan(10, (scanDevices){
startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) { startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
// AppLog.log("扫描到的设备:$scanDevices"); // AppLog.log("扫描到的设备:$scanDevices");
@ -351,6 +350,7 @@ class BlueManage {
isAddEquipment: isAddEquipment); isAddEquipment: isAddEquipment);
}); });
} else { } else {
// AppLog.log("不需要开启扫描");
_connectDevice(devicesList, deviceName, connectStateCallBack, _connectDevice(devicesList, deviceName, connectStateCallBack,
isAddEquipment: isAddEquipment); isAddEquipment: isAddEquipment);
} }
@ -576,12 +576,26 @@ class BlueManage {
List subData = splitList(valueList, _mtuSize!); List subData = splitList(valueList, _mtuSize!);
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData'); // AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
for (int i = 0; i < subData.length; i++) { for (int i = 0; i < subData.length; i++) {
await characteristic.write(subData[i],withoutResponse: true).then((value) async { if (characteristic.properties.writeWithoutResponse) {
// await Future.delayed(const Duration(milliseconds: 1)).then(( // 使WRITE_NO_RESPONSE属性写入值
// value) async { await characteristic.write(subData[i],withoutResponse: true).then((value) async {
// AppLog.log('分包发送成功了'); // await Future.delayed(const Duration(milliseconds: 1)).then((
// }); // value) async {
}); // AppLog.log('分包发送成功了');
// });
});
} else if (characteristic.properties.write) {
// 使WRITE属性写入值
await characteristic.write(subData[i]).then((value) async {
// await Future.delayed(const Duration(milliseconds: 1)).then((
// value) async {
// AppLog.log('分包发送成功了');
// });
});
} else {
//
throw Exception('This characteristic does not support writing.');
}
} }
} on Exception catch (e, s) { } on Exception catch (e, s) {
AppLog.log('APP写入失败: $e'); AppLog.log('APP写入失败: $e');

View File

@ -61,6 +61,7 @@ class OpenLockCommand extends SenderProtocol {
// OpenTime 4 // OpenTime 4
int? d1 = openTime; int? d1 = openTime;
// AppLog.log("开门时间是:$d1");
data.add((d1! & 0xff000000) >> 24); data.add((d1! & 0xff000000) >> 24);
data.add((d1 & 0xff0000) >> 16); data.add((d1 & 0xff0000) >> 16);

View File

@ -100,8 +100,8 @@ class F {
static String get apiPrefix { static String get apiPrefix {
switch (appFlavor) { switch (appFlavor) {
case Flavor.local: case Flavor.local:
// return 'https://ge.lock.star-lock.cn'; // return 'https://ge.lock.star-lock.cn'; //
return 'http://192.168.1.15:8022'; // // return 'http://192.168.1.15:8022'; //
case Flavor.dev: case Flavor.dev:
return 'https://dev.lock.star-lock.cn'; return 'https://dev.lock.star-lock.cn';
case Flavor.pre: case Flavor.pre:

View File

@ -63,7 +63,7 @@ class DoorLockLogLogic extends BaseGetXController {
// } // }
// //
Future<void> _replyReferEventRecordTime(Reply reply) async { Future<void> _replyReferEventRecordTime(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
@ -135,9 +135,13 @@ class DoorLockLogLogic extends BaseGetXController {
// () // ()
Future<void> senderReferEventRecordTime(int time) async { Future<void> senderReferEventRecordTime(int time) async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async { showEasyLoading();
if (state == BluetoothConnectionState.connected) { showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
if (connectionStateState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -159,6 +163,12 @@ class DoorLockLogLogic extends BaseGetXController {
publicKey: getPublicKeyList, publicKey: getPublicKeyList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
} else if (connectionStateState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
if(state.ifCurrentScreen.value == true){
showBlueConnetctToast();
}
} }
}); });
} }

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
@ -10,6 +11,7 @@ import 'package:star_lock/tools/noData.dart';
import 'package:timelines/timelines.dart'; import 'package:timelines/timelines.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
@ -20,7 +22,7 @@ class DoorLockLogPage extends StatefulWidget {
State<DoorLockLogPage> createState() => _DoorLockLogPageState(); State<DoorLockLogPage> createState() => _DoorLockLogPageState();
} }
class _DoorLockLogPageState extends State<DoorLockLogPage> { class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
final logic = Get.put(DoorLockLogLogic()); final logic = Get.put(DoorLockLogLogic());
final state = Get.find<DoorLockLogLogic>().state; final state = Get.find<DoorLockLogLogic>().state;
@ -212,4 +214,54 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
: NoData(), : NoData(),
); );
} }
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
}
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
}
///
@override
void didPush() {
super.didPush();
state.ifCurrentScreen.value = true;
}
///
@override
void didPop() {
super.didPop();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
state.ifCurrentScreen.value = false;
}
///
@override
void didPopNext() {
super.didPopNext();
state.ifCurrentScreen.value = true;
}
///
@override
void didPushNext() {
super.didPushNext();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
state.ifCurrentScreen.value = false;
}
} }

View File

@ -17,15 +17,8 @@ class DoorLockLogState {
DateTime(2024, 10, 10), DateTime(2024, 10, 10),
]; ];
final startDate = final startDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day).millisecondsSinceEpoch.obs;
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day) final endDate = (DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1).subtract(const Duration(milliseconds: 1))).millisecondsSinceEpoch.obs;
.millisecondsSinceEpoch
.obs;
final endDate = (DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
.subtract(const Duration(milliseconds: 1)))
.millisecondsSinceEpoch
.obs;
var dropdownTitle = '全部事件'.obs; var dropdownTitle = '全部事件'.obs;
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs; var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
@ -53,6 +46,8 @@ class DoorLockLogState {
isCheked: false), isCheked: false),
]; ];
var ifCurrentScreen = true.obs; // ,
DoorLockLogState() { DoorLockLogState() {
keyInfos.value = Get.arguments["keyInfo"]; keyInfos.value = Get.arguments["keyInfo"];
} }

View File

@ -34,18 +34,19 @@ class SendElectronicKeyLogic extends BaseGetXController {
switch (typeValue) { switch (typeValue) {
case 0: case 0:
{ {
if (state.beginTime.value.isEmpty) { //
if (state.timeLimitBeginTime.value.isEmpty) {
showToast("请选择开始时间".tr); showToast("请选择开始时间".tr);
return; return;
} }
if (state.beginTime.value.isEmpty) { if (state.timeLimitEndTime.value.isEmpty) {
showToast("请选择结束时间".tr); showToast("请选择结束时间".tr);
return; return;
} }
typeValue = XSConstantMacro.keyTypeTime; typeValue = XSConstantMacro.keyTypeTime;
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
startTime = "0"; startTime = "0";
endTime = "0"; endTime = "0";
@ -68,12 +69,12 @@ class SendElectronicKeyLogic extends BaseGetXController {
break; break;
case 3: case 3:
typeValue = XSConstantMacro.keyTypeLoop; typeValue = XSConstantMacro.keyTypeLoop;
if (state.beginTime.value.isEmpty) { 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();
break; break;
@ -217,13 +218,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
void resetData() { void resetData() {
state.emailOrPhoneController.text = ""; state.emailOrPhoneController.text = "";
state.keyNameController.text = ""; state.keyNameController.text = "";
if(state.seletType.value == 0){
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); // state.timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());// state.timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
}else{ state.cycleBeginTime = "".obs;//
state.beginTime.value = ""; // state.cycleEndTime = "".obs;//
state.endTime.value = "";// state.effectiveDateTime = "".obs;//
} state.failureDateTime = "".obs;//
state.weekdaysList = [].obs;
} }
} }

View File

@ -199,23 +199,23 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
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: () { action: () {
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),
@ -250,22 +250,22 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
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, var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: { 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'];
} }
@ -281,15 +281,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
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.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'];
} }
@ -305,18 +305,17 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
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.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.back(result: result);
} }
}) })
)), )),

View File

@ -18,8 +18,10 @@ class SendElectronicKeyState {
final isRemoteUnlock = false.obs; // final isRemoteUnlock = false.obs; //
final isAuthentication = false.obs; // final isAuthentication = 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 cycleBeginTime = "".obs;//
var cycleEndTime = "".obs;//
var effectiveDateTime = "".obs;// var effectiveDateTime = "".obs;//
var failureDateTime = "".obs;// var failureDateTime = "".obs;//
var weekdaysList = [].obs; var weekdaysList = [].obs;

View File

@ -0,0 +1,65 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/titleAppBar.dart';
import 'package:star_lock/widget/flavors_img.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_tool.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/commonDataManage.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/eventBusEventManage.dart';
import '../../../tools/storage.dart';
import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart';
class LockDetailListPage extends StatefulWidget {
final String title;
final List<Widget> items;
const LockDetailListPage({Key? key, required this.title, required this.items})
: super(key: key);
@override
State<LockDetailListPage> createState() => _LockDetailListPageState();
}
class _LockDetailListPageState extends State<LockDetailListPage>
with TickerProviderStateMixin, RouteAware {
late LockDetailLogic logic;
late LockDetailState state;
@override
void initState() {
super.initState();
logic = Get.find<LockDetailLogic>();
state = Get.find<LockDetailLogic>().state;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: TitleAppBar(
barTitle: widget.title,
haveBack: true,
iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor,
),
body: ListView.builder(
padding: EdgeInsets.only(top: 15.h),
itemCount: widget.items.length,
itemBuilder: (context, index) => widget.items[index]),
);
}
}

View File

@ -108,14 +108,13 @@ class LockDetailLogic extends BaseGetXController {
keyID: BlueManage().connectDeviceName, keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
openMode: state.openDoorModel, openMode: state.openDoorModel,
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000, openTime: state.netTime,
onlineToken: state.lockNetToken, onlineToken: state.lockNetToken,
token: tokenData, token: tokenData,
needAuthor: 1, needAuthor: 1,
signKey: signKeyDataList, signKey: signKeyDataList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
break; break;
case 0x07: case 0x07:
// //
@ -330,7 +329,7 @@ class LockDetailLogic extends BaseGetXController {
keyID: BlueManage().connectDeviceName, keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
openMode: state.openDoorModel, openMode: state.openDoorModel,
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000, openTime: state.netTime,
onlineToken: state.lockNetToken, onlineToken: state.lockNetToken,
token: getTokenList, token: getTokenList,
needAuthor: 1, needAuthor: 1,
@ -381,6 +380,16 @@ class LockDetailLogic extends BaseGetXController {
} }
//
void getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData(
lockId: state.keyInfos.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
state.netTime = entity.data!.date!.toString().length > 10 ? entity.data!.date!~/ 1000 : entity.data!.date!;
}
}
// token // token
void getLockNetToken() async { void getLockNetToken() async {
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString()); LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
@ -432,6 +441,7 @@ class LockDetailLogic extends BaseGetXController {
lockId: state.keyInfos.value.lockId.toString(), records: list); lockId: state.keyInfos.value.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// mockNetworkDataRequest(); // mockNetworkDataRequest();
AppLog.log("state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){ if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){
// //
deletKeyData(); deletKeyData();
@ -520,6 +530,8 @@ class LockDetailLogic extends BaseGetXController {
@override @override
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();
getServerDatetime();
await PermissionDialog.request(Permission.location); await PermissionDialog.request(Permission.location);
await PermissionDialog.requestBluetooth(); await PermissionDialog.requestBluetooth();
} }

View File

@ -18,7 +18,6 @@ class LockDetailMainPage extends StatefulWidget {
class _LockDetailMainPageState extends State<LockDetailMainPage> { class _LockDetailMainPageState extends State<LockDetailMainPage> {
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
} }
@ -26,26 +25,37 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final bool isOnlyOneData; final bool isOnlyOneData;
LockListInfoItemEntity keyInfos = LockListInfoItemEntity(); LockListInfoItemEntity keyInfos = LockListInfoItemEntity();
// LockMainEntity lockEntity = LockMainEntity();
dynamic obj = ModalRoute.of(context)?.settings.arguments; dynamic obj = ModalRoute.of(context)?.settings.arguments;
// if (obj != null && (obj["lockMainEntity"] != null)) {
// lockEntity = obj["lockMainEntity"];
// }
if (obj != null && (obj["keyInfo"] != null)) { if (obj != null && (obj["keyInfo"] != null)) {
keyInfos = obj["keyInfo"]; keyInfos = obj["keyInfo"];
} }
isOnlyOneData = obj["isOnlyOneData"]; isOnlyOneData = obj["isOnlyOneData"];
return Scaffold( return F.sw(
backgroundColor: Colors.white, defaultCall: () => Scaffold(
appBar: TitleAppBar( backgroundColor: Colors.white,
barTitle: F.navTitle, appBar: TitleAppBar(
haveBack: true, barTitle: F.navTitle,
backgroundColor: AppColors.mainColor), haveBack: true,
body: LockDetailPage( backgroundColor: AppColors.mainColor),
isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos), body: LockDetailPage(
// body: Container(), isOnlyOneData: isOnlyOneData,
); lockListInfoItemEntity: keyInfos),
// body: Container(),
),
xhjCall: () => Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: keyInfos.lockAlias,
haveBack: true,
backgroundColor: Colors.white,
titleColor: AppColors.blackColor,
iconColor: AppColors.blackColor,
),
body: LockDetailPage(
isOnlyOneData: isOnlyOneData,
lockListInfoItemEntity: keyInfos),
// body: Container(),
));
} }
} }

View File

@ -5,11 +5,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/widget/flavors_img.dart'; import 'package:star_lock/widget/flavors_img.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../app_settings/app_settings.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_tool.dart'; import '../../../blue/io_tool/io_tool.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../../common/XSConstantMacro/XSConstantMacro.dart';
@ -83,12 +85,6 @@ class _LockDetailPageState extends State<LockDetailPage>
state.lockUserNo = state.keyInfos.value.lockUserNo!; state.lockUserNo = state.keyInfos.value.lockUserNo!;
// if (state.lockUserNo == 0) {
// state.bottomBtnisEable.value = false;
// } else {
// state.bottomBtnisEable.value = true;
// }
if (state.keyInfos.value.keyStatus == if (state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective || XSConstantMacro.keyStatusWaitIneffective ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
@ -136,7 +132,6 @@ class _LockDetailPageState extends State<LockDetailPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
state.widgetContext = context;
loadData(); loadData();
return F.sw(defaultCall: () => skWidget(), xhjCall: () => xhjWidget()); return F.sw(defaultCall: () => skWidget(), xhjCall: () => xhjWidget());
} }
@ -145,43 +140,242 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget xhjWidget() { Widget xhjWidget() {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: SingleChildScrollView( body: Obx(() {
child: Obx(() { return Column(
return Column( children: [
children: [ SizedBox(
SizedBox( height: 35.h,
height: 45.h, ),
xhjInfoView(),
SizedBox(
height: 35.h,
),
labelText('images/icon_slider_horizontal.png', '功能'.tr, () {
Get.to(
LockDetailListPage(title: '功能'.tr, items: getBottomWidget()));
}),
labelText('images/icon_puzzlepiece_extension.png', '配件'.tr, () {
Get.to(LockDetailListPage(
title: '配件'.tr, items: getAttachmentWidget()));
}),
],
);
}),
);
}
Widget labelText(String img, String text, var onTap) {
return GestureDetector(
onTap: onTap,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 15.h),
padding: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 20.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
), ),
infoView(), ]),
SizedBox( child: Row(
height: 35.h, children: [
), Image.asset(
labelGridView('功能'.tr, getBottomWidget()), img,
labelListView('配件'.tr, getAttachmentWidget()), width: 32.r,
SizedBox( height: 32.r,
height: 45.h, ),
), SizedBox(
Padding( width: 15.w,
padding: EdgeInsets.only(left: 52.w, right: 52.w), ),
child: Row( Text(
mainAxisAlignment: MainAxisAlignment.spaceBetween, text,
children: [ style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
buttonView('关锁'.tr, () { ),
if (state.openDoorBtnisUneable.value == true) { const Spacer(),
startUnLock(); Icon(
} Icons.arrow_forward_ios_rounded,
}), size: 18.r,
buttonView('开锁'.tr, () { )
if (state.openDoorBtnisUneable.value == true) { ],
),
),
);
}
Widget xhjInfoView() {
return Container(
width: 0.9.sw,
height: 0.6.sw,
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('images/xhj_main_bg.jpg'),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Spacer(),
Obx(() {
return GestureDetector(
onTap: state.openDoorBtnisUneable.value == true
? () {
setState(() {
startOpenLock(); startOpenLock();
} });
}), }
: null,
onLongPressStart: state.openDoorBtnisUneable.value == true
? (details) {
setState(() {
startUnLock();
});
}
: null,
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.9),
borderRadius: BorderRadius.circular(100.w),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
offset: Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
]),
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
child: Stack(
children: [
FlavorsImg(
child: Image.asset(
state.openDoorBtnisUneable.value == false
? 'images/main/icon_main_openLockBtn_grey.png'
: (state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_center.png'
: 'images/main/icon_main_openLockBtn_center.png'),
width: 96.r,
height: 96.r,
// color: AppColors.primaryTopColor,
),
),
state.openDoorBtnisUneable.value == false
? Positioned(
child: FlavorsImg(
child: Image.asset(
'images/main/icon_main_openLockBtn_grey.png',
width: 96.r,
height: 96.r,
),
),
)
: state.openLockBtnState.value == 1
? buildRotationTransition(
width: 96.r,
height: 96.r,
)
: Positioned(
child: FlavorsImg(
child: Image.asset(
state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_circle.png'
: 'images/main/icon_main_openLockBtn_circle.png',
width: 96.r,
height: 96.r,
),
)),
], ],
), ),
), ),
], );
); }),
}), Padding(
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationLoader
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 20.sp,
),
),
adminInfoView(center: false, max: false),
],
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
SizedBox(width: 2.w),
Text("${state.electricQuantity.value}%",
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
Icon(
Icons.info, // 使 warning
color: AppColors.mainColor, //
size: 25.w, // 30
),
SizedBox(width: 20.w),
],
),
SizedBox(
height: 15.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
SizedBox(width: 2.w),
Text("--%",
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
Icon(
Icons.info, // 使 warning
color: AppColors.mainColor, //
size: 25.w, // 30
),
SizedBox(width: 20.w),
],
)
],
)
],
),
)
],
), ),
); );
} }
@ -271,212 +465,6 @@ class _LockDetailPageState extends State<LockDetailPage>
); );
} }
//
Widget buttonView(String text, VoidCallback? onPressed) {
bool openLockBtnState = state.openLockBtnState.value != 0;
return ElevatedButton(
onPressed: openLockBtnState ? null : onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: openLockBtnState
? AppColors.mainBackgroundColor
: AppColors.mainColor,
shape: RoundedRectangleBorder(
//
borderRadius: BorderRadius.circular(8), //
)),
child: SizedBox(
height: 0.12.sh,
width: 0.12.sh,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
text,
style: TextStyle(
color:
openLockBtnState ? AppColors.mainColor : Colors.white),
),
if (openLockBtnState)
Container(
margin: EdgeInsets.only(left: 15.w),
width: 15.r,
height: 15.r,
child: CircularProgressIndicator(
strokeWidth: 3.5,
color: AppColors.mainColor,
),
)
],
),
),
),
);
}
Widget infoView() {
return Padding(
padding: EdgeInsets.only(left: 35.w, right: 10.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
state.lockAlias.value,
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w400,
color: state.isOpenPassageMode.value == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor),
),
SizedBox(
height: 15.h,
),
adminInfoView(center: false, max: false),
],
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FlavorsImg(
child: Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
),
SizedBox(width: 2.w),
Text("${state.electricQuantity.value}%",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
FlavorsImg(
child: Icon(
Icons.info, // 使 warning
color: AppColors.mainColor, //
size: 25.w, // 30
),
),
SizedBox(width: 20.w),
],
),
SizedBox(
height: 15.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FlavorsImg(
child: Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
),
SizedBox(width: 2.w),
Text("--%",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
FlavorsImg(
child: Icon(
Icons.info, // 使 warning
color: AppColors.mainColor, //
size: 25.w, // 30
),
),
SizedBox(width: 20.w),
],
)
],
)
],
),
);
}
// GridView
Widget labelGridView(String text, List<Widget> children) {
return Column(
children: [
Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.only(
left: 40.w,
top: 20.h,
bottom: 20.h,
),
child: Text(text))),
SizedBox(
height: 200.h,
child: Row(
children: [
Expanded(
child: GridView.count(
padding: EdgeInsets.only(left: 15.w, right: 15.w),
crossAxisCount: 2,
childAspectRatio: 0.7,
crossAxisSpacing: 25.h,
mainAxisSpacing: 25.w,
scrollDirection: Axis.horizontal,
children: children),
),
Padding(
padding: EdgeInsets.only(left: 0.w, right: 4.w),
child: const Icon(Icons.arrow_forward_ios_rounded),
),
],
),
),
],
);
}
// ListView
Widget labelListView(String text, List<Widget> children) {
return Column(
children: [
Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.only(
left: 40.w,
top: 20.h,
bottom: 20.h,
),
child: Text(text))),
SizedBox(
height: 100.h,
child: Row(
children: [
Expanded(
child: GridView.count(
padding: EdgeInsets.only(left: 15.w, right: 15.w),
crossAxisCount: 1,
childAspectRatio: 0.7,
crossAxisSpacing: 25.h,
mainAxisSpacing: 25.w,
scrollDirection: Axis.horizontal,
children: children),
),
Padding(
padding: EdgeInsets.only(left: 0.w, right: 4.w),
child: Icon(Icons.arrow_forward_ios_rounded),
),
],
),
),
],
);
}
Widget topWidget() { Widget topWidget() {
return Column( return Column(
children: [ children: [
@ -510,7 +498,6 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
// logic.getStarLockStatus();
ShowTipView().showSureAlertDialog( ShowTipView().showSureAlertDialog(
"${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}"); "${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
}, },
@ -581,7 +568,8 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [ children: [
Center( Center(
child: GestureDetector( child: GestureDetector(
onTap: state.openDoorBtnisUneable.value == true ? () { onTap: state.openDoorBtnisUneable.value == true
? () {
setState(() { setState(() {
startOpenLock(); startOpenLock();
}); });
@ -619,7 +607,10 @@ class _LockDetailPageState extends State<LockDetailPage>
), ),
) )
: state.openLockBtnState.value == 1 : state.openLockBtnState.value == 1
? buildRotationTransition() ? buildRotationTransition(
width: 330.w,
height: 330.w,
)
: Positioned( : Positioned(
child: FlavorsImg( child: FlavorsImg(
child: Image.asset( child: Image.asset(
@ -690,7 +681,7 @@ class _LockDetailPageState extends State<LockDetailPage>
: TranslationLoader.lanKeys!.normalUser!.tr), : TranslationLoader.lanKeys!.normalUser!.tr),
style: TextStyle(fontSize: 20.sp, color: AppColors.darkGrayTextColor), style: TextStyle(fontSize: 20.sp, color: AppColors.darkGrayTextColor),
), ),
if (add) SizedBox(width: 20.w) else SizedBox(width: 80.w), if (add) SizedBox(width: 20.w) else SizedBox(width: 40.w),
FlavorsImg( FlavorsImg(
child: Image.asset( child: Image.asset(
state.keyInfos.value.remoteEnable == 1 state.keyInfos.value.remoteEnable == 1
@ -742,7 +733,8 @@ class _LockDetailPageState extends State<LockDetailPage>
} }
// //
Widget buildRotationTransition() { Widget buildRotationTransition(
{required double width, required double height}) {
return Positioned( return Positioned(
child: RotationTransition( child: RotationTransition(
// //
@ -755,8 +747,8 @@ class _LockDetailPageState extends State<LockDetailPage>
state.isOpenPassageMode.value == 1 state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_circle.png' ? 'images/main/icon_main_normallyOpenMode_circle.png'
: 'images/main/icon_main_openLockBtn_circle.png', : 'images/main/icon_main_openLockBtn_circle.png',
width: 330.w, width: width,
height: 330.w, height: height,
), ),
), ),
), ),
@ -1080,9 +1072,81 @@ class _LockDetailPageState extends State<LockDetailPage>
return showWidgetArr; return showWidgetArr;
} }
//
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
bool bottomBtnisEable, Function() onClick) { bool bottomBtnisEable, Function() onClick) {
Widget child = F.sw(
defaultCall: () => Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 42.w,
height: 42.h,
child: FlavorsImg(
black: true,
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable)
: AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
),
SizedBox(height: 10.w),
Expanded(
child: Text(name,
style: TextStyle(
fontSize: 20.sp,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable)
: AppColors.lockDetailBottomBtnUneable),
textAlign: TextAlign.center))
],
),
),
xhjCall: () => Container(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 5.h),
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 42.w,
height: 42.h,
child: FlavorsImg(
black: true,
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable)
: AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
),
SizedBox(width: 20.w),
Text(
name,
style: TextStyle(
fontSize: 20.sp,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable)
: AppColors.lockDetailBottomBtnUneable),
),
],
),
));
return GestureDetector( return GestureDetector(
onTap: openDoorBtnisUneable onTap: openDoorBtnisUneable
? (bottomBtnisEable ? (bottomBtnisEable
@ -1091,41 +1155,7 @@ class _LockDetailPageState extends State<LockDetailPage>
logic.showToast("请在锁旁边完成第一次开锁".tr); logic.showToast("请在锁旁边完成第一次开锁".tr);
}) })
: null, : null,
child: Container( child: child,
// height: 300.h,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 42.w,
height: 42.h,
child: FlavorsImg(
black: true,
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable)
: AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
),
SizedBox(height: 10.w),
Expanded(
child: Text(name,
style: TextStyle(
fontSize: 20.sp,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable)
: AppColors.lockDetailBottomBtnUneable),
textAlign: TextAlign.center))
],
)),
); );
} }
@ -1213,13 +1243,16 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1; state.openLockBtnState.value = 1;
// state.animationController!.forward(); // state.animationController!.forward();
AppLog.log("点击开锁");
if (state.isOpenLockNeedOnline.value == 0) { if (state.isOpenLockNeedOnline.value == 0) {
// //
state.openDoorModel = 0; state.openDoorModel = 0;
AppLog.log("点击开锁 state.openDoorModel = 0 不需要联网");
logic.openDoorAction(); logic.openDoorAction();
} else { } else {
// //
state.openDoorModel = 2; state.openDoorModel = 2;
AppLog.log("点击开锁 state.openDoorModel = 2 需要联网");
logic.getLockNetToken(); logic.getLockNetToken();
} }
} }
@ -1233,12 +1266,15 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1; state.openLockBtnState.value = 1;
state.animationController!.forward(); state.animationController!.forward();
AppLog.log("长按闭锁");
if (state.isOpenLockNeedOnline.value == 0) { if (state.isOpenLockNeedOnline.value == 0) {
// //
AppLog.log("长按闭锁 state.openDoorModel = 32 不需要联网");
state.openDoorModel = 32; state.openDoorModel = 32;
logic.openDoorAction(); logic.openDoorAction();
} else { } else {
// //
AppLog.log("长按闭锁 state.openDoorModel = 34 需要联网");
state.openDoorModel = 34; state.openDoorModel = 34;
logic.getLockNetToken(); logic.getLockNetToken();
} }

View File

@ -14,6 +14,7 @@ class LockDetailState {
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent; StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
String lockNetToken = ""; String lockNetToken = "";
int netTime = 0;
int lockUserNo = 0; int lockUserNo = 0;
var senderUserId = 0; var senderUserId = 0;
var isOnlyOneData = false; var isOnlyOneData = false;
@ -45,7 +46,6 @@ class LockDetailState {
final PageController pageController = PageController(); final PageController pageController = PageController();
var currentPage = 0.obs; var currentPage = 0.obs;
late BuildContext widgetContext;
// LockDetailState() { // LockDetailState() {
// Map map = Get.arguments; // Map map = Get.arguments;

View File

@ -245,7 +245,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
IoSenderManage.senderCustomPasswordsCommand( IoSenderManage.senderCustomPasswordsCommand(
keyID: "1", keyID: "1",
userID: await Storage.getUid(), userID: await Storage.getUid(),
pwdNo: state.isAdministrator.value == true ? 254 : 1, pwdNo: state.isAdministrator.value == true ? 254 : 0,
pwd:state.pwdController.text, pwd:state.pwdController.text,
useCountLimit: 0xff, useCountLimit: 0xff,
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000, startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
@ -326,7 +326,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
IoSenderManage.senderCustomPasswordsCommand( IoSenderManage.senderCustomPasswordsCommand(
keyID: "1", keyID: "1",
userID: await Storage.getUid(), userID: await Storage.getUid(),
pwdNo: state.isAdministrator.value == true ? 254 : 1, pwdNo: state.isAdministrator.value == true ? 254 : 0,
pwd: state.pwdController.text, pwd: state.pwdController.text,
useCountLimit: 0xff, useCountLimit: 0xff,
startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0, startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0,

View File

@ -21,6 +21,7 @@ import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../../tools/pickers/time_picker/model/pduration.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
@ -223,7 +224,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH, onConfirm: (p) { Pickers.showDatePicker(
context,
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
// minDate: PDuration.now(),
mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH,
onConfirm: (p) {
if (state.widgetType.value == 3) { if (state.widgetType.value == 3) {
// //
state.beginTime.value = DateTool().getYMDHNDateString(p, 1); state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
@ -238,7 +244,13 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
rightTitle: state.endTime.value, rightTitle: state.endTime.value,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { Pickers.showDatePicker(
context,
// maxDate传入三年以后得今天的时间
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day),
minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
mode: DateMode.YMDH,
onConfirm: (p) {
if (state.widgetType.value == 3) { if (state.widgetType.value == 3) {
// //
state.endTime.value = DateTool().getYMDHNDateString(p, 1); state.endTime.value = DateTool().getYMDHNDateString(p, 1);

View File

@ -139,7 +139,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
Get.toNamed(Routers.valueAddedServicesHighFunctionPage); Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
}, },
child: Container( child: Container(
height: 150.h, // height: 150.h,
margin: EdgeInsets.all(15.w), margin: EdgeInsets.all(15.w),
padding: padding:
EdgeInsets.only(left: 20.w, top: 20.w, bottom: 20.w, right: 10.w), EdgeInsets.only(left: 20.w, top: 20.w, bottom: 20.w, right: 10.w),

View File

@ -1,31 +1,34 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../entity/lockListInfo_entity.dart'; import '../entity/lockListInfo_entity.dart';
class LockListGroupPage extends StatefulWidget { class LockListGroupView extends StatefulWidget {
const LockListGroupPage({Key? key, const LockListGroupView(
this.child, {Key? key,
this.onTap, this.child,
required this.groupItem, this.onTap,
required this.typeImgList}) this.backgroundColor,
this.textStyle,
required this.groupItem,
required this.typeImgList})
: super(key: key); : super(key: key);
final Widget? child; final Widget? child;
final List typeImgList; final List typeImgList;
final Function()? onTap; final Function()? onTap;
final GroupList groupItem; final GroupList groupItem;
final Color? backgroundColor;
final TextStyle? textStyle;
@override @override
State<LockListGroupPage> createState() => _LockListGroupPageState(); State<LockListGroupView> createState() => _LockListGroupViewState();
} }
class _LockListGroupPageState extends State<LockListGroupPage> { class _LockListGroupViewState extends State<LockListGroupView> {
bool _isExpanded = true; bool _isExpanded = true;
final Duration _animationDuration = const Duration(milliseconds: 200); final Duration _animationDuration = const Duration(milliseconds: 200);
bool _isCheck = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,7 +36,7 @@ class _LockListGroupPageState extends State<LockListGroupPage> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
color: Colors.white, color: widget.backgroundColor ?? Colors.white,
height: 80.h, height: 80.h,
child: Row( child: Row(
children: _buildExpandRowList(), children: _buildExpandRowList(),
@ -55,18 +58,19 @@ class _LockListGroupPageState extends State<LockListGroupPage> {
widgetList.add(GestureDetector( widgetList.add(GestureDetector(
child: Container( child: Container(
width: ScreenUtil().screenWidth, width: ScreenUtil().screenWidth,
color: Colors.white, color: widget.backgroundColor ?? Colors.white,
child: Row( child: Row(
children: [ children: [
SizedBox(width: 40.w), SizedBox(width: 40.w),
Text( Text(
widget.groupItem.groupName ?? '', widget.groupItem.groupName ?? '',
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), style: widget.textStyle ??
TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
), ),
Expanded( Expanded(
child: SizedBox( child: SizedBox(
width: 10.w, width: 10.w,
)), )),
AnimatedRotation( AnimatedRotation(
turns: _isExpanded ? -0.5 : 0, turns: _isExpanded ? -0.5 : 0,
duration: _animationDuration, duration: _animationDuration,

View File

@ -10,7 +10,7 @@ import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/appRouteObserver.dart'; import '../../../tools/appRouteObserver.dart';
import '../../../tools/dateTool.dart'; import '../../../tools/dateTool.dart';
import '../entity/lockListInfo_entity.dart'; import '../entity/lockListInfo_entity.dart';
import 'lockListGroup_page.dart'; import 'lockListGroup_view.dart';
import 'lockList_logic.dart'; import 'lockList_logic.dart';
class LockListPage extends StatefulWidget { class LockListPage extends StatefulWidget {
@ -58,7 +58,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
// //
Widget _buildLockExpandedList(context, index, GroupList itemData) { Widget _buildLockExpandedList(context, index, GroupList itemData) {
List lockItemList = itemData.lockList ?? []; List lockItemList = itemData.lockList ?? [];
return LockListGroupPage( return LockListGroupView(
onTap: () { onTap: () {
// //
if (itemData.isChecked) { if (itemData.isChecked) {

View File

@ -10,7 +10,7 @@ import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/appRouteObserver.dart'; import '../../../tools/appRouteObserver.dart';
import '../../../tools/dateTool.dart'; import '../../../tools/dateTool.dart';
import '../entity/lockListInfo_entity.dart'; import '../entity/lockListInfo_entity.dart';
import 'lockListGroup_page.dart'; import 'lockListGroup_view.dart';
import 'lockList_logic.dart'; import 'lockList_logic.dart';
class LockListXHJPage extends StatefulWidget { class LockListXHJPage extends StatefulWidget {
@ -36,259 +36,136 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
} }
groupDataList.addAll( groupDataList.addAll(
widget.lockListInfoGroupEntity.groupList as Iterable<GroupList>); widget.lockListInfoGroupEntity.groupList as Iterable<GroupList>);
return SafeArea(
return Scaffold( bottom: false,
floatingActionButton: FloatingActionButton( child: Column(
shape: const CircleBorder(), crossAxisAlignment: CrossAxisAlignment.start,
onPressed: () { children: [
Get.toNamed(Routers.selectLockTypePage); Align(
}, alignment: Alignment.topRight,
backgroundColor: AppColors.mainColor, child: IconButton(
child: const Icon( onPressed: () {
Icons.add, Get.toNamed(Routers.selectLockTypePage);
color: AppColors.darkGrayTextColor, },
), icon: Icon(
Icons.add_circle,
size: 48.w,
color: AppColors.mainColor,
)),
),
Padding(
padding: EdgeInsets.only(left: 45.w),
child: Text(
'常用程序'.tr,
style: TextStyle(
fontSize: 32.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w600,
),
),
),
Expanded(
child: ListView.separated(
itemCount: groupDataList.length,
itemBuilder: (context, index) {
GroupList itemData = groupDataList[index];
return _buildLockExpandedList(context, index, itemData);
},
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
separatorBuilder: (context, index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
}),
),
],
), ),
body: ListView.separated(
itemCount: groupDataList.length,
itemBuilder: (context, index) {
GroupList itemData = groupDataList[index];
return _buildLockExpandedList(context, index, itemData);
},
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
separatorBuilder: (context, index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
}),
); );
} }
// //
Widget _buildLockExpandedList(context, index, GroupList itemData) { Widget _buildLockExpandedList(context, index, GroupList itemData) {
List lockItemList = itemData.lockList ?? []; List lockItemList = itemData.lockList ?? [];
return LockListGroupPage( return LockListGroupView(
onTap: () { onTap: () {
// setState(() {});
if (itemData.isChecked) { },
} else {} textStyle: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w600),
setState(() {}); backgroundColor: Colors.transparent,
}, typeImgList: const [],
typeImgList: const [], groupItem: itemData,
groupItem: itemData, child: GridView.extent(
child: ListView.separated( padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
itemCount: lockItemList.length, maxCrossAxisExtent: Get.width * .6,
childAspectRatio: 1.2,
crossAxisSpacing: 15.w,
mainAxisSpacing: 15.h,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) { children: forItems(lockItemList),
return const Divider(height: 1, color: AppColors.greyLineColor); ));
}, }
itemBuilder: (c, index) {
LockListInfoItemEntity keyInfo = lockItemList[index];
bool isLast = false;
if (lockItemList.length == index + 1) {
isLast = true;
}
return Slidable( List<Widget> forItems(List lockItemList) {
key: ValueKey(keyInfo.keyId), List<Widget> list = [];
endActionPane: ActionPane( for (int i = 0, j = 0; i < lockItemList.length; i++, j++) {
extentRatio: 0.2, LockListInfoItemEntity keyInfo = lockItemList[i];
motion: const ScrollMotion(), bool isLast = false;
children: [ if (lockItemList.length == i + 1) {
SlidableAction( isLast = true;
onPressed: (BuildContext context) { }
state.lockListInfoItemEntity = keyInfo; list.add(Slidable(
logic.deleyLockLogicOfRoles(); key: ValueKey(keyInfo.keyId),
}, endActionPane: ActionPane(
backgroundColor: Colors.red, extentRatio: 0.2,
foregroundColor: Colors.white, motion: const ScrollMotion(),
label: '删除'.tr, children: [
padding: EdgeInsets.only(left: 5.w, right: 5.w), SlidableAction(
), onPressed: (BuildContext context) {
], state.lockListInfoItemEntity = keyInfo;
), logic.deleyLockLogicOfRoles();
child: lockInfoListItem(keyInfo, isLast, () { },
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || backgroundColor: Colors.red,
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && foregroundColor: Colors.white,
(keyInfo.keyStatus == label: '删除'.tr,
XSConstantMacro.keyStatusWaitIneffective)) { padding: EdgeInsets.only(left: 5.w, right: 5.w),
logic.showToast("您的钥匙未生效".tr); ),
return; ],
} ),
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || child: lockInfoListItem(keyInfo, isLast, () {
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
logic.showToast("您的钥匙已冻结".tr); (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) {
return; logic.showToast("您的钥匙未生效".tr);
} return;
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || }
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
logic.showToast("您的钥匙已过期".tr); (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
return; logic.showToast("您的钥匙已冻结".tr);
} return;
Get.toNamed(Routers.lockDetailMainPage, arguments: { }
// "lockMainEntity": widget.lockMainEntity, if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
"keyInfo": keyInfo, keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
"isOnlyOneData": false, (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
}); logic.showToast("您的钥匙已过期".tr);
}), return;
); }
}), Get.toNamed(Routers.lockDetailMainPage, arguments: {
); "keyInfo": keyInfo,
"isOnlyOneData": false,
});
}),
));
}
return list;
} }
Widget lockInfoListItem( Widget lockInfoListItem(
LockListInfoItemEntity keyInfo, bool isLast, Function() action) { LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
return F.sw( return _xhjLockInfoListItem(keyInfo, isLast, action);
defaultCall: () => _defaultLockInfoListItem(keyInfo, isLast, action),
xhjCall: () => _xhjLockInfoListItem(keyInfo, isLast, action));
}
Widget _defaultLockInfoListItem(
LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 122.h,
margin: isLast
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
decoration: BoxDecoration(
color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective ||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen ||
keyInfo.keyStatus == XSConstantMacro.keyStatusExpired))
? AppColors.greyBackgroundColor
: Colors.white,
borderRadius: BorderRadius.circular(20.w),
),
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 20.h,
),
Row(
children: [
SizedBox(width: 30.w),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
keyInfo.lockAlias!,
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor),
),
],
),
),
SizedBox(width: 20.w),
Image.asset(
logic.showElectricIcon(keyInfo.electricQuantity!),
width: 30.w,
height: 24.w,
),
SizedBox(width: 2.w),
Text(
"${keyInfo.electricQuantity!}%",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(width: 30.w),
],
),
SizedBox(height: 5.h),
Visibility(
visible: keyInfo.passageMode == 1 ? true : false,
child: Row(
children: [
SizedBox(width: 30.w),
Container(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor,
),
child: Text("常开模式开启".tr,
style: TextStyle(
fontSize: 18.sp,
color: AppColors.appBarIconColor)),
),
],
)),
SizedBox(height: 5.h),
Visibility(
visible: keyInfo.lockSetting!.remoteUnlock == 1 ? true : false,
child: Row(
children: [
SizedBox(width: 30.w),
Text(
"远程开锁".tr,
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
],
)),
SizedBox(height: 20.h),
Visibility(
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective ||
keyInfo.keyStatus ==
XSConstantMacro.keyStatusFrozen ||
keyInfo.keyStatus ==
XSConstantMacro.keyStatusExpired))
? true
: false,
// visible: true,
child: Row(
children: [
SizedBox(width: 30.w),
Container(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
color:
DateTool().compareTimeIsOvertime(keyInfo.endDate!)
? AppColors.listTimeYellowColor
: AppColors.mainColor,
),
child: Text(logic.getKeyEffective(keyInfo),
style: TextStyle(fontSize: 18.sp, color: Colors.white)
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}", style: TextStyle(fontSize: 18.sp, color: Colors.white)
),
),
],
)),
SizedBox(height: 5.h),
Row(
children: [
SizedBox(width: 30.w),
Text(
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员'.tr : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr)}",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
],
),
SizedBox(height: 20.h),
],
),
),
);
} }
Widget _xhjLockInfoListItem( Widget _xhjLockInfoListItem(
@ -296,10 +173,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
// height: 122.h,
margin: isLast
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
@ -308,13 +181,14 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen ||
keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) keyInfo.keyStatus == XSConstantMacro.keyStatusExpired))
? AppColors.greyBackgroundColor ? AppColors.greyBackgroundColor
: Colors.white, : Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.circular(20.w), borderRadius: BorderRadius.circular(20.w),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 20.h), padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Row( Row(
children: [ children: [
@ -324,29 +198,21 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
height: 32.r, height: 32.r,
color: AppColors.mainColor, color: AppColors.mainColor,
), ),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(keyInfo.lockAlias!,
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor,
overflow: TextOverflow.ellipsis,
),
maxLines: 1),
),
Text(
logic.getUseKeyTypeStr(
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType),
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
)
], ],
), ),
SizedBox(
height: 15.h,
),
Text(keyInfo.lockAlias!,
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor,
overflow: TextOverflow.ellipsis,
),
maxLines: 1),
Visibility( Visibility(
visible: keyInfo.passageMode == 1 ? true : false, visible: keyInfo.passageMode == 1 ? true : false,
child: Padding( child: Padding(
@ -383,7 +249,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
], ],
), ),
)), )),
SizedBox(height: 20.h),
Visibility( Visibility(
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
@ -443,10 +308,12 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
], ],
), ),
Text( Text(
keyInfo.hwVersion ?? "", Characters(logic.getUseKeyTypeStr(
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType))
.join('\u{200B}'),
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), )
], ],
), ),
), ),

View File

@ -114,6 +114,17 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
body: child, body: child,
); );
} }
child = F.sw(
defaultCall: () => child,
xhjCall: () => Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('images/xhj_main_bg.jpg'),
fit: BoxFit.cover,
),
),
child: child,
));
return child; return child;
} }

View File

@ -10,6 +10,7 @@ import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart'; import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
import 'package:star_lock/mine/mall/lockMall_page.dart'; import 'package:star_lock/mine/mall/lockMall_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_page.dart'; import 'package:star_lock/mine/message/messageList/messageList_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
@ -40,43 +41,49 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
init: LockMainXHJLogic(), init: LockMainXHJLogic(),
builder: (LockMainXHJLogic logic) { builder: (LockMainXHJLogic logic) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFFF5F5F5), backgroundColor: Colors.white,
body: SafeArea( body: Stack(
bottom: false, children: [
child: Stack( pageView(
children: [ widget: StarLockMainPage(
pageView( showAppBar: false,
widget: StarLockMainPage( showDrawer: false,
showAppBar: false,
showDrawer: false,
),
logic: logic,
index: 0,
), ),
pageView( logic: logic,
widget: LockMallPage( index: 0,
),
pageView(
widget: SafeArea(
bottom: false,
child: LockMallPage(
allowReturn: false,
),
),
logic: logic,
index: 1,
),
pageView(
widget: SafeArea(
bottom: false,
child: MessageListXHJPage(
showAppBar: false, showAppBar: false,
), ),
logic: logic,
index: 1,
), ),
pageView( logic: logic,
widget: MessageListPage( index: 2,
showAppBar: false, ),
), pageView(
logic: logic, widget: SafeArea(
index: 2, bottom: false,
), child: MinePersonInfoPage(
pageView(
widget: MinePersonInfoPage(
showAppBar: false, showAppBar: false,
showAbout: true, showAbout: true,
), ),
logic: logic,
index: 3,
), ),
], logic: logic,
), index: 3,
),
],
), ),
bottomNavigationBar: Container( bottomNavigationBar: Container(
padding: EdgeInsets.only(top: 20.h), padding: EdgeInsets.only(top: 20.h),
@ -93,11 +100,8 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
top: false, top: false,
child: Row( child: Row(
children: [ children: [
navigationBarItem( navigationBarItem(Icons.key,
Icons.key, TranslationLoader.lanKeys!.device!.tr, logic, 0, () {
TranslationLoader.lanKeys!.device!.tr,
logic,
0, () {
logic.setIndex(0); logic.setIndex(0);
}), }),
navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 1, navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 1,

View File

@ -23,9 +23,10 @@ class NearbyLockLogic extends BaseGetXController {
// //
void connect(String deviceName) { void connect(String deviceName) {
showEasyLoading(); showEasyLoading();
BlueManage().bludSendData(deviceName, BlueManage().bludSendData(deviceName, (BluetoothConnectionState state) async {
(BluetoothConnectionState state) async { AppLog.log("点击要添加的设备了");
if (state == BluetoothConnectionState.connected) { if (state == BluetoothConnectionState.connected) {
AppLog.log("开始获取公钥");
IoSenderManage.getPublicKey(lockId: deviceName); IoSenderManage.getPublicKey(lockId: deviceName);
} else if (state == BluetoothConnectionState.disconnected) { } else if (state == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
@ -58,12 +59,14 @@ class NearbyLockLogic extends BaseGetXController {
switch (reply.status) { switch (reply.status) {
case 0x00: case 0x00:
// //
AppLog.log("获取公钥成功");
// //
var publicKey = reply.data.sublist(3); var publicKey = reply.data.sublist(3);
var saveStrList = changeIntListToStringList(publicKey); var saveStrList = changeIntListToStringList(publicKey);
Storage.setStringList(saveBluePublicKey, saveStrList); Storage.setStringList(saveBluePublicKey, saveStrList);
// //
AppLog.log("开始获取私钥");
IoSenderManage.getPrivateKey( IoSenderManage.getPrivateKey(
lockId: BlueManage().connectDeviceName, lockId: BlueManage().connectDeviceName,
keyID: "1", keyID: "1",
@ -73,6 +76,7 @@ class NearbyLockLogic extends BaseGetXController {
needAuthor: 1); needAuthor: 1);
break; break;
default: default:
AppLog.log("获取公钥失败");
break; break;
} }
} }
@ -80,6 +84,7 @@ class NearbyLockLogic extends BaseGetXController {
Future<void> _replyGetPrivateKeyKey(Reply reply) async { Future<void> _replyGetPrivateKeyKey(Reply reply) async {
switch (reply.status) { switch (reply.status) {
case 0x00: case 0x00:
AppLog.log("获取私钥成功");
// //
reply.data.removeAt(0); reply.data.removeAt(0);
@ -113,66 +118,66 @@ class NearbyLockLogic extends BaseGetXController {
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
AppLog.log("获取锁状态成功");
// //
var vendor = reply.data.sublist(3, 23); var vendor = reply.data.sublist(3, 23);
var vendorStr = utf8String(vendor); var vendorStr = utf8String(vendor);
state.lockInfo["vendor"] = vendorStr; state.lockInfo["vendor"] = vendorStr;
// state.lockInfo["vendor"] = "XL"; // state.lockInfo["vendor"] = "XL";
AppLog.log("vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}"); AppLog.log("厂商名称 vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}");
// //
var product = reply.data[23]; var product = reply.data[23];
state.lockInfo["product"] = product; state.lockInfo["product"] = product;
// AppLog.log("product:$product"); AppLog.log("锁设备类型 product:$product");
// //
var model = reply.data.sublist(24, 44); var model = reply.data.sublist(24, 44);
var modelStr = utf8String(model); var modelStr = utf8String(model);
state.lockInfo["model"] = modelStr; state.lockInfo["model"] = modelStr;
// state.lockInfo["model"] = "JL-BLE-01"; // state.lockInfo["model"] = "JL-BLE-01";
// AppLog.log("model:$model modelStr:$modelStr modelStr:${modelStr.length}"); AppLog.log("产品名称 mmodelStr:$modelStr");
// //
var fwVersion = reply.data.sublist(44, 64); var fwVersion = reply.data.sublist(44, 64);
var fwVersionStr = utf8String(fwVersion); var fwVersionStr = utf8String(fwVersion);
state.lockInfo["fwVersion"] = fwVersionStr; state.lockInfo["fwVersion"] = fwVersionStr;
// AppLog.log("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}"); AppLog.log("软件版本 fwVersionStr:$fwVersionStr");
// //
var hwVersion = reply.data.sublist(64, 84); var hwVersion = reply.data.sublist(64, 84);
var hwVersionStr = utf8String(hwVersion); var hwVersionStr = utf8String(hwVersion);
state.lockInfo["hwVersion"] = hwVersionStr; state.lockInfo["hwVersion"] = hwVersionStr;
// AppLog.log("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}"); AppLog.log("硬件版本 hwVersionStr:$hwVersionStr");
// //
var serialNum0 = reply.data.sublist(84, 100); var serialNum0 = reply.data.sublist(84, 100);
var serialNum0Str = utf8String(serialNum0); var serialNum0Str = utf8String(serialNum0);
state.lockInfo["serialNum0"] = serialNum0Str; state.lockInfo["serialNum0"] = serialNum0Str;
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}"; // state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
AppLog.log("厂商序列号 serialNum0Str:${serialNum0Str.length}");
// //
var serialNum1 = reply.data.sublist(100, 116); var serialNum1 = reply.data.sublist(100, 116);
var serialNum1Str = utf8String(serialNum1); var serialNum1Str = utf8String(serialNum1);
state.lockInfo["serialNum1"] = serialNum1Str; state.lockInfo["serialNum1"] = serialNum1Str;
// AppLog.log("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}"); AppLog.log("成品商序列号 serialNum1Str:$serialNum1Str");
// //
var btDeviceName = reply.data.sublist(116, 132); var btDeviceName = reply.data.sublist(116, 132);
var btDeviceNameStr = utf8String(btDeviceName); var btDeviceNameStr = utf8String(btDeviceName);
state.lockInfo["btDeviceName"] = btDeviceNameStr; state.lockInfo["btDeviceName"] = btDeviceNameStr;
// AppLog.log("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}"); AppLog.log("蓝牙名称 btDeviceNameStr:$btDeviceNameStr");
// //
var battRemCap = reply.data[132]; var battRemCap = reply.data[132];
state.lockInfo["electricQuantity"] = battRemCap; state.lockInfo["electricQuantity"] = battRemCap;
// AppLog.log("battRemCap:$battRemCap"); AppLog.log("电池剩余电量 battRemCap:$battRemCap");
// //
var restoreCounter = reply.data.sublist(133, 135); var restoreCounter = reply.data.sublist(133, 135);
state.lockInfo["restoreCount"] = state.lockInfo["restoreCount"] = restoreCounter[0] * 256 + restoreCounter[1];
restoreCounter[0] * 256 + restoreCounter[1]; AppLog.log("重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}");
// AppLog.log("restoreCounter:$restoreCounter");
// //
var restoreDate = reply.data.sublist(135, 139); var restoreDate = reply.data.sublist(135, 139);
@ -182,13 +187,13 @@ class NearbyLockLogic extends BaseGetXController {
(0xFF & restoreDate[3])); (0xFF & restoreDate[3]));
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); // String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
state.lockInfo["restoreDate"] = restoreDateValue * 1000; state.lockInfo["restoreDate"] = restoreDateValue * 1000;
// AppLog.log("restoreDate:$restoreDate restoreDateValue:$restoreDateValue"); AppLog.log("重置时间 restoreDateValue:$restoreDateValue");
// //
var icPartNo = reply.data.sublist(139, 149); var icPartNo = reply.data.sublist(139, 149);
var icPartNoStr = utf8String(icPartNo); var icPartNoStr = utf8String(icPartNo);
state.lockInfo["icPartNo"] = icPartNoStr; state.lockInfo["icPartNo"] = icPartNoStr;
// AppLog.log("icPartNo:$icPartNo icPartNoStr:$icPartNoStr"); AppLog.log("主控芯片型号 icPartNoStr:$icPartNoStr");
// //
var indate = reply.data.sublist(149, 153); var indate = reply.data.sublist(149, 153);
@ -198,16 +203,19 @@ class NearbyLockLogic extends BaseGetXController {
(0xFF & indate[3])); (0xFF & indate[3]));
// String indateStr = DateTool().dateToYMDHNSString("$indateValue"); // String indateStr = DateTool().dateToYMDHNSString("$indateValue");
state.lockInfo["indate"] = indateValue * 1000; state.lockInfo["indate"] = indateValue * 1000;
// AppLog.log("indate:$indate indateValue:$indateValue"); AppLog.log("有效时间 indateValue:$indateValue");
// mac地址 // mac地址
var macAddress = reply.data.sublist(153, 173); var macAddress = reply.data.sublist(153, 173);
var macAddressStr = utf8String(macAddress); var macAddressStr = utf8String(macAddress);
state.lockInfo["mac"] = macAddressStr; state.lockInfo["mac"] = macAddressStr;
AppLog.log("mac地址 macAddressStr:$macAddressStr");
var index = 173; var index = 173;
// //
var featureValueLength = reply.data[173]; var featureValueLength = reply.data[173];
AppLog.log("锁特征值字符串长度 featureValueLength:$featureValueLength");
// () // ()
// //
var featureNetxLength = index + featureValueLength + 1; var featureNetxLength = index + featureValueLength + 1;
@ -222,9 +230,12 @@ class NearbyLockLogic extends BaseGetXController {
// List allFeatureValueTwoList = charListChangeIntList(featureValue); // List allFeatureValueTwoList = charListChangeIntList(featureValue);
// AppLog.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr"); // AppLog.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
index = index + featureValueLength + 1; index = index + featureValueLength + 1;
AppLog.log("锁特征值字符串 featureValueStr:$featureValueStr");
// 使 // 使
var featureEnValLength = reply.data[index]; var featureEnValLength = reply.data[index];
AppLog.log("使能特征值字符串长度 featureEnValLength:$featureEnValLength");
// 使() // 使()
var featureEnNextLength = index + featureEnValLength + 1; var featureEnNextLength = index + featureEnValLength + 1;
if (reply.data.length < featureEnNextLength) { if (reply.data.length < featureEnNextLength) {
@ -238,13 +249,14 @@ class NearbyLockLogic extends BaseGetXController {
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal); // List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
// AppLog.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr"); // AppLog.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
index = index + featureEnValLength + 1; index = index + featureEnValLength + 1;
AppLog.log("使能锁特征值说明 featureEnValStr:$featureEnValStr");
// //
// var featureParaTotal = reply.data[index]; // var featureParaTotal = reply.data[index];
var featureParaTotalList = reply.data.sublist(index); var featureParaTotalList = reply.data.sublist(index);
state.featureSettingParams = featureParaTotalList; state.featureSettingParams = featureParaTotalList;
// AppLog.log("featureParaTotalList:$featureParaTotalList"); AppLog.log("featureParaTotalList:$featureParaTotalList");
Get.toNamed(Routers.lockAddressGaoDePage, arguments: { Get.toNamed(Routers.lockAddressGaoDePage, arguments: {
"pwdTimestamp": state.timestampValue * 1000, "pwdTimestamp": state.timestampValue * 1000,
@ -257,8 +269,6 @@ class NearbyLockLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
AppLog.log("${reply.commandType}需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// IoSenderManage.senderGetLockStatu( // IoSenderManage.senderGetLockStatu(
@ -276,7 +286,6 @@ class NearbyLockLogic extends BaseGetXController {
break; break;
default: default:
// //
AppLog.log("${reply.commandType}失败");
break; break;
} }
} }
@ -299,10 +308,11 @@ class NearbyLockLogic extends BaseGetXController {
// //
Future<void> _getStarLockStatus() async { Future<void> _getStarLockStatus() async {
// //
BlueManage().bludSendData(BlueManage().connectDeviceName, // BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
(BluetoothConnectionState state) async { // if (state == BluetoothConnectionState.connected) {
if (state == BluetoothConnectionState.connected) { // dismissEasyLoading();
dismissEasyLoading();
AppLog.log("开始获取锁状态");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// IoSenderManage.senderGetLockStatu( // IoSenderManage.senderGetLockStatu(
@ -316,10 +326,10 @@ class NearbyLockLogic extends BaseGetXController {
isBeforeAddUser: true, isBeforeAddUser: true,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
} else if (state == BluetoothConnectionState.disconnected) { // } else if (state == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); // dismissEasyLoading();
} // }
}, isAddEquipment: true); // }, isAddEquipment: true);
} }
// late StreamSubscription<List<ScanResult>>_scanListDiscoveredDeviceSubscription; // late StreamSubscription<List<ScanResult>>_scanListDiscoveredDeviceSubscription;

View File

@ -0,0 +1,29 @@
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import '../../../network/api_repository.dart';
import 'selectLockType_state.dart';
class SelectLockTypeLogic extends BaseGetXController {
SelectLockTypeState state = SelectLockTypeState();
void getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData(
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
}
}
@override
void onInit() {
super.onInit();
getServerDatetime();
}
@override
void onClose() {
super.onClose();
}
}

View File

@ -1,18 +1,15 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../baseWidget.dart'; import '../../../baseWidget.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
import 'selectLockType_logic.dart';
class SelectLockTypePage extends StatefulWidget { class SelectLockTypePage extends StatefulWidget {
const SelectLockTypePage({Key? key}) : super(key: key); const SelectLockTypePage({Key? key}) : super(key: key);
@ -21,8 +18,10 @@ class SelectLockTypePage extends StatefulWidget {
State<SelectLockTypePage> createState() => _SelectLockTypePageState(); State<SelectLockTypePage> createState() => _SelectLockTypePageState();
} }
class _SelectLockTypePageState extends State<SelectLockTypePage> class _SelectLockTypePageState extends State<SelectLockTypePage> with BaseWidget {
with BaseWidget { final logic = Get.put(SelectLockTypeLogic());
final state = Get.find<SelectLockTypeLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(

View File

@ -0,0 +1,6 @@
class SelectLockTypeState{
}

View File

@ -17,7 +17,7 @@ class LockMallLogic extends BaseGetXController {
late LockMallState state; late LockMallState state;
LockMallLogic({required bool allowReturn}) LockMallLogic({required bool allowReturn})
: state = LockMallState(allowReturn: allowReturn); : state = LockMallState(allowReturn: allowReturn );
// //
Future<void> getMallURLRequest() async { Future<void> getMallURLRequest() async {
@ -35,6 +35,7 @@ class LockMallLogic extends BaseGetXController {
}, },
onPageFinished: (String url) { onPageFinished: (String url) {
state.webProgress.value = 1.0; state.webProgress.value = 1.0;
refreshGoBack();
}, },
onWebResourceError: (WebResourceError error) {}, onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) async { onNavigationRequest: (NavigationRequest request) async {
@ -99,12 +100,25 @@ class LockMallLogic extends BaseGetXController {
bool canGoBack = await state.mallWebView.canGoBack(); bool canGoBack = await state.mallWebView.canGoBack();
if (canGoBack) { if (canGoBack) {
await state.mallWebView.goBack(); await state.mallWebView.goBack();
} else { } else if (state.allowReturn) {
if (state.allowReturn) Get.back(); Get.back();
} }
refreshGoBack();
return false; return false;
} }
//
void refreshGoBack(){
//退
if(state.allowReturn){
return;
}
state.mallWebView.canGoBack().then((value) {
state.canGoBack = value;
update();
});
}
@override @override
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/mall/lockMall_logic.dart'; import 'package:star_lock/mine/mall/lockMall_logic.dart';
import 'package:star_lock/tools/titleAppBar.dart'; import 'package:star_lock/tools/titleAppBar.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
@ -30,36 +31,46 @@ class _LockMallPageState extends State<LockMallPage> {
return GetBuilder<LockMallLogic>( return GetBuilder<LockMallLogic>(
init: LockMallLogic(allowReturn: widget.allowReturn), init: LockMallLogic(allowReturn: widget.allowReturn),
builder: (LockMallLogic logic) { builder: (LockMallLogic logic) {
return PopScope( return Scaffold(
onPopInvoked: logic.canGoBack, resizeToAvoidBottomInset: false,
canPop: false, backgroundColor: const Color(0xFFFFFFFF),
child: Scaffold( appBar: widget.showAppBar
resizeToAvoidBottomInset: false, ? TitleAppBar(
backgroundColor: const Color(0xFFFFFFFF), barTitle: getWebTitle(logic),
appBar: widget.showAppBar haveBack: logic.state.canGoBack || logic.state.allowReturn,
? TitleAppBar( backgroundColor: F.sw(
barTitle: getWebTitle(logic), defaultCall: () => AppColors.mainColor,
haveBack: true, xhjCall: () => Colors.white),
backgroundColor: AppColors.mainColor, titleColor: F.sw(
) defaultCall: () => null,
: null, xhjCall: () => AppColors.blackColor),
body: Obx(() => Column( iconColor: F.sw(
children: <Widget>[ defaultCall: () => null,
Container( xhjCall: () => AppColors.blackColor),
padding: EdgeInsets.only(bottom: 10.w), backAction: () => logic.canGoBack(false),
child: LinearProgressIndicator( )
value: logic.state.webProgress.value, : null,
backgroundColor: Colors.grey, body: Obx(() => Column(
valueColor: AlwaysStoppedAnimation<Color>( children: <Widget>[
AppColors.mainColor), PopScope(
), onPopInvoked: logic.canGoBack,
), canPop: false,
Expanded( child: SizedBox(),
child: WebViewWidget( ),
controller: logic.state.mallWebView), Container(
), padding: EdgeInsets.only(bottom: 10.w),
], child: LinearProgressIndicator(
))), value: logic.state.webProgress.value,
backgroundColor: Colors.grey,
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
),
),
Expanded(
child: WebViewWidget(controller: logic.state.mallWebView),
),
],
)),
); );
}); });
} }

View File

@ -9,6 +9,7 @@ class LockMallState {
var lockMallUrl = "".obs; var lockMallUrl = "".obs;
var webProgress = 0.0.obs; var webProgress = 0.0.obs;
bool allowReturn; bool allowReturn;
bool canGoBack = false;
late WebViewController mallWebView = initWebViewController(); late WebViewController mallWebView = initWebViewController();
//webView控制器 //webView控制器

View File

@ -0,0 +1,235 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/EasyRefreshTool.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/showTipView.dart';
import '../../../tools/storage.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
import 'messageList_entity.dart';
import 'messageList_logic.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class MessageListXHJPage extends StatefulWidget {
MessageListXHJPage({Key? key, this.showAppBar = true}) : super(key: key);
bool showAppBar;
@override
State<MessageListXHJPage> createState() => _MessageListXHJPageState();
}
class _MessageListXHJPageState extends State<MessageListXHJPage>
with TickerProviderStateMixin {
final logic = Get.put(MessageListLogic());
final state = Get.find<MessageListLogic>().state;
void getHttpData() {
logic.messageListDataRequest().then((MessageListEntity value) {
setState(() {});
});
}
@override
void initState() {
super.initState();
getHttpData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: widget.showAppBar
? TitleAppBar(
barTitle: TranslationLoader.lanKeys!.message!.tr,
haveBack: true,
actionsList: [
TextButton(
child: Text(
"清空".tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog("是否清空?".tr,
() async {
logic.deletAllMessageDataRequest();
});
} else {
logic.showToast("演示模式".tr);
}
},
),
],
backgroundColor: AppColors.mainColor)
: null,
body: Column(
children: [
Container(
width: 1.sw,
height: 0.2.sw,
margin: EdgeInsets.symmetric(horizontal: 15.w),
padding: EdgeInsets.symmetric(horizontal: 25.w),
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('images/xhj_main_bg.jpg'),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'智能分析',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 28.sp,
fontWeight: FontWeight.w600,
),
),
Text(
'精准识别设备事件,过滤无效信息',
style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp,
fontWeight: FontWeight.w600,
),
),
],
),
),
Expanded(
child: EasyRefreshTool(onRefresh: () {
logic.pageNo = 1;
getHttpData();
}, onLoad: () {
getHttpData();
}, child: Obx(() {
return state.itemDataList.isEmpty
? NoData()
: SlidableAutoCloseBehavior(
child: ListView.builder(
itemCount: state.itemDataList.length,
padding: EdgeInsets.only(top: 20.h),
itemBuilder: (c, index) {
MessageItemEntity messageItemEntity =
state.itemDataList[index];
return Slidable(
key: ValueKey(messageItemEntity.id),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context) {
logic.deletMessageDataRequest(
messageItemEntity.id!, () {
logic.pageNo = 1;
getHttpData();
});
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除'.tr,
padding:
EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),
child: _messageListItem(messageItemEntity, () {
Get.toNamed(Routers.messageDetailPage,
arguments: {
"messageItemEntity": messageItemEntity
});
}),
);
}),
);
})),
),
],
),
);
}
Widget _messageListItem(
MessageItemEntity messageItemEntity, Function() action) {
bool isNotRead = messageItemEntity.readAt! == 0;
return GestureDetector(
onTap: action,
child: Container(
margin: EdgeInsets.symmetric(vertical: 12.h, horizontal: 15.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20.w),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
isNotRead ? 'images/news_not_read.png' : 'images/news_read.png',
width: 48.r,
height: 48.r),
SizedBox(width: 15.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
messageItemEntity.data!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 22.sp,
color: messageItemEntity.readAt! == 0
? AppColors.blackColor
: AppColors.placeholderTextColor),
),
SizedBox(
height: 5.h,
),
Text(
DateTool().dateToYMDHNString(
messageItemEntity.createdAt!.toString()),
style: TextStyle(
fontSize: 18.sp,
color: messageItemEntity.readAt! == 0
? AppColors.blackColor
: AppColors.placeholderTextColor)),
],
),
),
],
),
),
);
}
}

View File

@ -39,175 +39,215 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
: null, : null,
body: Column( body: Column(
children: [ children: [
Obx(() => CommonItem( Container(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr, width: 1.sw,
rightTitle: "", height: 0.2.sw,
allHeight: 100.h, margin: EdgeInsets.symmetric(horizontal: 15.w),
isHaveLine: true, padding: EdgeInsets.symmetric(horizontal: 25.w),
isHaveDirection: true, decoration: BoxDecoration(
isHaveRightWidget: true, image: const DecorationImage(
rightWidget: ClipRRect( image: AssetImage('images/xhj_main_bg.jpg'),
borderRadius: BorderRadius.circular(36.w), fit: BoxFit.cover,
child: CustomNetworkImage( ),
url: state.headUrl.value, borderRadius: BorderRadius.circular(20.r),
defaultUrl: 'images/controls_user.png', boxShadow: [
width: 72.w, BoxShadow(
height: 72.w), color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
), ),
action: () async { ],
_openModalBottomSheet();
},
)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {'mineInfoData': state.mineInfoData.value})
.then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
rightTitle: state.mineInfoData.value.mobile != null
? state.mineInfoData.value.mobile!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.email!.tr,
rightTitle: state.mineInfoData.value.email != null
? state.mineInfoData.value.email!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
}
})),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
? "去设置".tr
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoViewSafetyProblemPage);
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
isHaveLine: true,
isHaveDirection: false)),
if (F.isLite == false && widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
), ),
if (widget.showAbout) child: Column(
CommonItem( crossAxisAlignment: CrossAxisAlignment.start,
leftTitel: TranslationLoader.lanKeys!.set!.tr, mainAxisAlignment: MainAxisAlignment.center,
isHaveLine: true, children: [
isHaveDirection: true, Text(
action: () { '系统设置',
Get.back(); style: TextStyle(
Get.toNamed(Routers.mineSetPage); color: AppColors.blackColor,
}, fontSize: 28.sp,
fontWeight: FontWeight.w600,
),
),
Text(
'系统的全局配置在此项内进行设置',
style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp,
fontWeight: FontWeight.w600,
),
),
],
), ),
if (widget.showAbout) ),
CommonItem( SizedBox(
leftTitel: TranslationLoader.lanKeys!.about!.tr, height: 20.h,
isHaveLine: false, ),
isHaveDirection: true, Container(
action: () { margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 15.w),
Get.back(); child: ClipRRect(
Get.toNamed(Routers.aboutPage); borderRadius: BorderRadius.circular(20.r),
}, child: Column(
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "",
allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: ClipRRect(
borderRadius: BorderRadius.circular(36.w),
child: CustomNetworkImage(
url: state.headUrl.value,
defaultUrl: 'images/controls_user.png',
width: 72.w,
height: 72.w),
),
action: () async {
_openModalBottomSheet();
},
)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {
'mineInfoData': state.mineInfoData.value
}).then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
rightTitle: state.mineInfoData.value.mobile != null
? state.mineInfoData.value.mobile!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.email!.tr,
rightTitle: state.mineInfoData.value.email != null
? state.mineInfoData.value.email!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
}
})),
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
? "去设置".tr
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(context,
Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(context,
Routers.minePersonInfoViewSafetyProblemPage);
}
})),
Obx(() => CommonItem(
leftTitel:
TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
isHaveLine: true,
isHaveDirection: false)),
if (F.isLite == false && widget.showAbout)
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.set!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.mineSetPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.about!.tr,
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.aboutPage);
},
),
],
),
), ),
),
], ],
)); ));
} }
//
// void showPermissionDeniedDialog() {
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: const Text('权限被拒绝'),
// content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'),
// actions: <Widget>[
// TextButton(
// child: const Text('去设置'),
// onPressed: () {
// Navigator.of(context).pop(); //
// openAppSettings(); //
// },
// ),
// ],
// );
// },
// );
// }
Future _openModalBottomSheet() async { Future _openModalBottomSheet() async {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,

View File

@ -784,7 +784,9 @@ class ApiProvider extends BaseProvider {
getServerDatetimeUrl.toUrl, getServerDatetimeUrl.toUrl,
jsonEncode({ jsonEncode({
'lockId': lockId, 'lockId': lockId,
})); }),
isUnShowLoading: true
);
// //
Future<Response> setLockDiagnoseData( Future<Response> setLockDiagnoseData(

View File

@ -83,7 +83,7 @@ class CommonItem extends StatelessWidget {
), ),
], ],
), ),
isHaveDirection! ? SizedBox(width: 3.w) : Container(), isHaveDirection! ? SizedBox(width: 15.w) : Container(),
isHaveDirection! isHaveDirection!
? Image.asset( ? Image.asset(
'images/icon_right_grey.png', 'images/icon_right_grey.png',

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart';
class TitleAppBar extends AppBar { class TitleAppBar extends AppBar {
@override @override
@ -42,7 +44,7 @@ class _TitleAppBarState extends State<TitleAppBar> {
elevation: 0, elevation: 0,
leading: widget.haveOtherLeftWidget! leading: widget.haveOtherLeftWidget!
? widget.leftWidget ? widget.leftWidget
: (widget.haveBack! : (widget.haveBack ?? false
? IconButton( ? IconButton(
icon: Icon(Icons.arrow_back_ios, icon: Icon(Icons.arrow_back_ios,
color: widget.iconColor ?? Colors.white), color: widget.iconColor ?? Colors.white),
@ -50,13 +52,12 @@ class _TitleAppBarState extends State<TitleAppBar> {
if (widget.backAction != null) { if (widget.backAction != null) {
widget.backAction!(); widget.backAction!();
} else { } else {
if(EasyLoading.isShow){ if (EasyLoading.isShow) {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
Navigator.pop(context); Navigator.pop(context);
} }
} })
)
: Container()), : Container()),
backgroundColor: widget.backgroundColor ?? Colors.white, backgroundColor: widget.backgroundColor ?? Colors.white,
title: widget.haveTitleWidget! title: widget.haveTitleWidget!