diff --git a/.DS_Store b/.DS_Store
index ab459319..fce4fcc3 100755
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index afb5fd51..24086c3f 100755
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -22,7 +22,8 @@
-
+
+
diff --git a/images/lan/lan_en.json b/images/lan/lan_en.json
index 2898b9b3..f0754730 100755
--- a/images/lan/lan_en.json
+++ b/images/lan/lan_en.json
@@ -855,5 +855,6 @@
"门铃事件":"Doorbell event",
"视频事件":"Video event",
"请开启蓝牙":"Please turn on Bluetooth",
- "请选择有效日":"Please select the effective day"
+ "请选择有效日":"Please select the effective day",
+ "公司名字长度不能小于 6 ": "The length of the company name cannot be less than 6"
}
diff --git a/images/lan/lan_keys.json b/images/lan/lan_keys.json
index 3f091d55..9e5a1a1d 100755
--- a/images/lan/lan_keys.json
+++ b/images/lan/lan_keys.json
@@ -884,5 +884,6 @@
"门铃事件":"门铃事件",
"视频事件":"视频事件",
"请开启蓝牙":"请开启蓝牙",
- "请选择有效日":"请选择有效日"
+ "请选择有效日":"请选择有效日",
+ "公司名字长度不能小于 6 ": "公司名字长度不能小于 6 "
}
diff --git a/images/lan/lan_zh.json b/images/lan/lan_zh.json
index 2ffd2bb7..73152201 100755
--- a/images/lan/lan_zh.json
+++ b/images/lan/lan_zh.json
@@ -815,7 +815,7 @@
"身份证号": "身份证号",
"请输入真实姓名": "请输入真实姓名",
"请输入身份证号": "请输入身份证号",
- "请输入身份证号和真实姓名":"请输入身份证号和真实姓名",
+ "请输入身份证号和真实姓名": "请输入身份证号和真实姓名",
"点击返回设备配对": "点击返回设备配对",
"无法连接?尝试升级": "无法连接?尝试升级",
"固件升级提示": "固件升级提示",
@@ -845,14 +845,15 @@
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。",
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮",
"正在尝试闭锁……": "正在尝试闭锁……",
- "清空记录":"清空记录",
- "是否要删除操作记录?":"是否要删除操作记录?",
- "被删除的记录不能恢复":"被删除的记录不能恢复",
- "全部事件":"全部事件",
- "开锁事件":"开锁事件",
- "异常事件":"异常事件",
- "门铃事件":"门铃事件",
- "视频事件":"视频事件",
- "请开启蓝牙":"请开启蓝牙",
- "请选择有效日":"请选择有效日"
+ "清空记录": "清空记录",
+ "是否要删除操作记录?": "是否要删除操作记录?",
+ "被删除的记录不能恢复": "被删除的记录不能恢复",
+ "全部事件": "全部事件",
+ "开锁事件": "开锁事件",
+ "异常事件": "异常事件",
+ "门铃事件": "门铃事件",
+ "视频事件": "视频事件",
+ "请开启蓝牙": "请开启蓝牙",
+ "请选择有效日": "请选择有效日",
+ "公司名字长度不能小于 6 ": "公司名字长度不能小于 6 "
}
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 0aeb6030..3ffb1e4d 100755
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -36,6 +36,7 @@ PODS:
- Flutter
- auto_orientation (0.0.1):
- Flutter
+ - Bugly (2.6.1)
- camera_avfoundation (0.0.1):
- Flutter
- connectivity_plus (0.0.1):
@@ -81,6 +82,9 @@ PODS:
- Flutter (1.0.0)
- flutter_blue_plus (0.0.1):
- Flutter
+ - flutter_bugly_plugin (0.0.1):
+ - Bugly
+ - Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_native_contact_picker (0.0.1):
@@ -170,6 +174,7 @@ DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`)
+ - flutter_bugly_plugin (from `.symlinks/plugins/flutter_bugly_plugin/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
- flutter_pcm_sound (from `.symlinks/plugins/flutter_pcm_sound/ios`)
@@ -205,6 +210,7 @@ SPEC REPOS:
- AMap3DMap
- AMapFoundation
- AMapLocation
+ - Bugly
- DKImagePickerController
- DKPhotoGallery
- GoogleMaps
@@ -248,6 +254,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_blue_plus:
:path: ".symlinks/plugins/flutter_blue_plus/ios"
+ flutter_bugly_plugin:
+ :path: ".symlinks/plugins/flutter_bugly_plugin/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_contact_picker:
@@ -309,6 +317,7 @@ SPEC CHECKSUMS:
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
+ Bugly: 217ac2ce5f0f2626d43dbaa4f70764c953a26a31
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
@@ -318,6 +327,7 @@ SPEC CHECKSUMS:
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96
+ flutter_bugly_plugin: d2db6d6641938269fa538575126e8ff530ee02c7
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
diff --git a/lib/app_settings/app_settings.dart b/lib/app_settings/app_settings.dart
index 04bbe53d..f03b8cf1 100755
--- a/lib/app_settings/app_settings.dart
+++ b/lib/app_settings/app_settings.dart
@@ -23,7 +23,8 @@ class AppLog {
// if(!_printLog)return;
// if(_onlyError && !error) return;
if (error) {
- msg = '----->>> $msg $stackTrace';
+ final bool stackTraceIsNull = stackTrace != null;
+ msg = '----->>> $msg ${stackTraceIsNull ? '\n$stackTrace' : ''}';
}
Get.log(msg);
}
diff --git a/lib/blue/blue_manage.dart b/lib/blue/blue_manage.dart
index 223fe584..73a9bdab 100755
--- a/lib/blue/blue_manage.dart
+++ b/lib/blue/blue_manage.dart
@@ -1,13 +1,9 @@
import 'dart:async';
import 'dart:io';
-import 'package:app_settings/app_settings.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
-import 'package:star_lock/tools/showTipView.dart';
-import 'package:star_lock/widget/permission/permission_dialog.dart';
-import 'package:url_launcher/url_launcher.dart';
import 'io_tool/io_model.dart';
import 'io_tool/io_tool.dart';
@@ -21,19 +17,19 @@ typedef ConnectStateCallBack = Function(
typedef ScanDevicesCallBack = Function(List);
class BlueManage {
- final List scanDevices = [];
+ final List scanDevices = [];
// 用来写入的服务id
- final Guid _serviceIdConnect = Guid("fff0");
+ final Guid _serviceIdConnect = Guid('fff0');
// 用来写入的服务id
final Guid _serviceIdWrite = Guid('0000FFF0-0000-1000-8000-00805F9B34FB');
// 用来订阅的特征id
- final Guid _characteristicIdSubscription = Guid("fff1");
+ final Guid _characteristicIdSubscription = Guid('fff1');
// 用来写入的特征id
- final Guid _characteristicIdWrite = Guid("fff2");
+ final Guid _characteristicIdWrite = Guid('fff2');
// 监听发送事件
StreamSubscription? _sendStreamSubscription;
@@ -50,10 +46,10 @@ class BlueManage {
int? _mtuSize = 20;
// 当前连接设备的名字
- String connectDeviceName = "";
+ String connectDeviceName = '';
// 当前连接设备的mac地址
- String connectDeviceMacAddress = "";
+ String connectDeviceMacAddress = '';
// 当前连接的设备
BluetoothDevice? bluetoothConnectDevice;
@@ -93,7 +89,7 @@ class BlueManage {
}
void _initGetMtuSubscription() {
- _mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((value) {
+ _mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((int value) {
_mtuSize = value - 3;
AppLog.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
});
@@ -101,7 +97,7 @@ class BlueManage {
void _initAdapterStateStateSubscription() {
_adapterStateStateSubscription ??=
- FlutterBluePlus.adapterState.listen((state) {
+ FlutterBluePlus.adapterState.listen((BluetoothAdapterState state) {
_adapterState = state;
});
}
@@ -149,8 +145,8 @@ class BlueManage {
_connectionStateSubscription?.cancel();
_connectionStateSubscription = null;
- _connectionStateSubscription =
- bluetoothConnectDevice!.connectionState.listen((state) async {
+ _connectionStateSubscription = bluetoothConnectDevice!.connectionState
+ .listen((BluetoothConnectionState state) async {
bluetoothConnectionState = state;
// AppLog.log("蓝牙连接状态:$state");
});
@@ -162,18 +158,18 @@ class BlueManage {
.on()
.listen((EventSendModel model) {
if (model.sendChannel == DataChannel.ble) {
- FlutterBluePlus.isSupported.then((isAvailable) async {
+ FlutterBluePlus.isSupported.then((bool isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
// 蓝牙已开启,可以进行蓝牙操作
writeCharacteristicWithResponse(model.data);
} else {
try {} catch (e) {
- AppLog.log("蓝牙打开失败");
+ AppLog.log('蓝牙打开失败');
}
}
} else {
- AppLog.log("写入数据 蓝牙不可用,不能进行蓝牙操作");
+ AppLog.log('写入数据 蓝牙不可用,不能进行蓝牙操作');
}
});
}
@@ -183,31 +179,33 @@ class BlueManage {
/// 开始指定设备名称的扫描蓝牙设备
Future startScanSingle(String deviceName, int timeout,
ScanDevicesCallBack scanDevicesCallBack) async {
- FlutterBluePlus.isSupported.then((isAvailable) async {
+ FlutterBluePlus.isSupported.then((bool isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
try {
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
- Completer completer = Completer();
- var subscription = FlutterBluePlus.scanResults.listen((results) {
- // AppLog.log("startScanSingle扫描到的设备:$results");
- bool isExit = results.any((element) =>
+ final Completer completer = Completer();
+ final StreamSubscription> subscription =
+ FlutterBluePlus.scanResults.listen((List results) {
+ final bool isExit = results.any((ScanResult element) =>
(element.device.platformName == deviceName) ||
(element.advertisementData.advName == deviceName));
+ AppLog.log('扫描到的设备数:${results.length} 是否查找到 $isExit');
if (isExit) {
- for (var scanResult in results) {
+ for (final ScanResult scanResult in results) {
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
? scanResult.advertisementData.serviceUuids[0]
- : "")
+ : '')
.toString()
- .contains("758824")) &&
+ .contains('758824')) &&
(scanResult.rssi >= -100)) {
// 查询id相同的元素
- final knownDeviceIndex = scanDevices.indexWhere((d) =>
- (d.device.platformName ==
- scanResult.device.platformName) ||
- (d.advertisementData.advName ==
- scanResult.advertisementData.advName));
+ final int knownDeviceIndex = scanDevices.indexWhere(
+ (ScanResult d) =>
+ (d.device.platformName ==
+ scanResult.device.platformName) ||
+ (d.advertisementData.advName ==
+ scanResult.advertisementData.advName));
// 不存在的时候返回-1
if (knownDeviceIndex >= 0) {
scanDevices[knownDeviceIndex] = scanResult;
@@ -220,7 +218,7 @@ class BlueManage {
}
}, onError: (e) {
AppLog.log(
- "扫描失败:$e",
+ '扫描失败:$e',
);
});
FlutterBluePlus.cancelWhenScanComplete(subscription);
@@ -228,7 +226,7 @@ class BlueManage {
scanDevicesCallBack(scanDevices);
subscription.cancel();
} catch (e) {
- AppLog.log("扫描失败");
+ AppLog.log('扫描失败');
}
} else {
try {
@@ -236,11 +234,11 @@ class BlueManage {
await FlutterBluePlus.turnOn();
}
} catch (e) {
- AppLog.log("蓝牙打开失败");
+ AppLog.log('蓝牙打开失败');
}
}
} else {
- AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
+ AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
}
});
}
@@ -248,15 +246,16 @@ class BlueManage {
/// 开始扫描蓝牙设备
Future startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack,
{List? idList}) async {
- FlutterBluePlus.isSupported.then((isAvailable) async {
+ FlutterBluePlus.isSupported.then((bool isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
try {
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
- var subscription = FlutterBluePlus.scanResults.listen((results) {
+ final StreamSubscription> subscription =
+ FlutterBluePlus.scanResults.listen((List results) {
scanDevices.clear();
- for (var scanResult in results) {
+ for (final ScanResult scanResult in results) {
// 判断名字为空的直接剔除
// if (scanResult.device.advName.isEmpty) {
// return;
@@ -266,16 +265,17 @@ class BlueManage {
// " rssi:${scanResult.rssi}");
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
? scanResult.advertisementData.serviceUuids[0]
- : "")
+ : '')
.toString()
- .contains("758824")) &&
+ .contains('758824')) &&
(scanResult.rssi >= -100)) {
// 查询id相同的元素
- final knownDeviceIndex = scanDevices.indexWhere((d) =>
- (d.device.platformName ==
- scanResult.device.platformName) ||
- (d.advertisementData.advName ==
- scanResult.advertisementData.advName));
+ final int knownDeviceIndex = scanDevices.indexWhere(
+ (ScanResult d) =>
+ (d.device.platformName ==
+ scanResult.device.platformName) ||
+ (d.advertisementData.advName ==
+ scanResult.advertisementData.advName));
// 不存在的时候返回-1
if (knownDeviceIndex >= 0) {
scanDevices[knownDeviceIndex] = scanResult;
@@ -303,13 +303,13 @@ class BlueManage {
// FlutterBluePlus.stopScan();
}, onError: (e) {
AppLog.log(
- "扫描失败:$e",
+ '扫描失败:$e',
);
});
FlutterBluePlus.cancelWhenScanComplete(subscription);
} catch (e) {
- AppLog.log("扫描失败");
+ AppLog.log('扫描失败');
}
} else {
try {
@@ -317,11 +317,11 @@ class BlueManage {
await FlutterBluePlus.turnOn();
}
} catch (e) {
- AppLog.log("蓝牙打开失败");
+ AppLog.log('蓝牙打开失败');
}
}
} else {
- AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
+ AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
}
});
}
@@ -330,12 +330,13 @@ class BlueManage {
Future bludSendData(
String deviceName, ConnectStateCallBack stateCallBack,
{bool isAddEquipment = false}) async {
- FlutterBluePlus.isSupported.then((isAvailable) async {
+ FlutterBluePlus.isSupported.then((bool isAvailable) async {
if (isAvailable) {
+ AppLog.log('蓝牙状态 系统蓝牙状态:$_adapterState 蓝牙连接状态:$bluetoothConnectionState');
if (_adapterState == BluetoothAdapterState.on) {
// 蓝牙已开启,可以进行蓝牙操作
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
- _connect(deviceName, (state) {
+ _connect(deviceName, (BluetoothConnectionState state) {
stateCallBack(bluetoothConnectionState!);
}, isAddEquipment: isAddEquipment);
} else {
@@ -346,11 +347,11 @@ class BlueManage {
stateCallBack(BluetoothConnectionState.disconnected);
openBlue();
} catch (e) {
- AppLog.log("蓝牙打开失败");
+ AppLog.log('蓝牙打开失败');
}
}
} else {
- AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
+ AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
}
});
}
@@ -360,9 +361,9 @@ class BlueManage {
String deviceName, ConnectStateCallBack connectStateCallBack,
{bool isAddEquipment = false}) async {
connectDeviceName = deviceName;
- List devicesList = scanDevices;
+ final List devicesList = scanDevices;
- bool isExistDevice = scanDevices.any((element) =>
+ final bool isExistDevice = scanDevices.any((ScanResult element) =>
element.device.platformName == connectDeviceName ||
element.advertisementData.advName == connectDeviceName);
@@ -383,7 +384,7 @@ class BlueManage {
{bool isAddEquipment = false}) async {
// 判断数组列表里面是否有这个设备
// AppLog.log("devicesList:$devicesList");
- final knownDeviceIndex = devicesList.indexWhere((d) =>
+ final int knownDeviceIndex = devicesList.indexWhere((ScanResult d) =>
(d.device.platformName == deviceName) ||
(d.advertisementData.advName == deviceName));
@@ -412,15 +413,15 @@ class BlueManage {
// AppLog.log("调用了停止扫描的方法");
await stopScan();
- if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == "0") &&
+ if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == '0') &&
isAddEquipment == false) {
connectStateCallBack(BluetoothConnectionState.disconnected);
- EasyLoading.showToast("该锁已被重置".tr, duration: 2000.milliseconds);
+ EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
return;
}
// 重连三次
- int maxAttempts = 3;
+ final int maxAttempts = 3;
int attempt = 0;
while (attempt < maxAttempts) {
try {
@@ -443,14 +444,16 @@ class BlueManage {
// await bluetoothConnectDevice!.connect();
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
try {
- bluetoothConnectDevice!.discoverServices().then((services) {
- for (BluetoothService service in services) {
+ bluetoothConnectDevice!
+ .discoverServices()
+ .then((List services) {
+ for (final BluetoothService service in services) {
// AppLog.log("11111service.remoteId:${service.remoteId}"
// " service.uuid:${service.uuid}"
// " service.characteristics:${service.characteristics}"
// " service.includedServices:${service.includedServices}");
if (service.uuid == _serviceIdConnect) {
- for (BluetoothCharacteristic characteristic
+ for (final BluetoothCharacteristic characteristic
in service.characteristics) {
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
// " characteristic.uuid:${characteristic.uuid}"
@@ -478,14 +481,15 @@ class BlueManage {
}
// 听上报来的数据,参数来自前面扫描到的结果
- var allData = [];
+ List allData = [];
// 保存上一次的数据,用来判断是否收到重复的数据
- var lastTimeData = [];
+ List lastTimeData = [];
int? dataLen;
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
- final subscription = characteristic.onValueReceived.listen((data) {
+ final StreamSubscription> subscription =
+ characteristic.onValueReceived.listen((List data) {
// AppLog.log("订阅获取的数据:$data");
if (data == lastTimeData || data.isEmpty) {
return;
@@ -580,15 +584,15 @@ class BlueManage {
// 写入
Future writeCharacteristicWithResponse(List value) async {
- List services =
+ final List services =
await bluetoothConnectDevice!.discoverServices();
- for (BluetoothService service in services) {
+ for (final BluetoothService service in services) {
// AppLog.log("33333 service.remoteId:${service.remoteId}"
// " service.uuid:${service.uuid}\n\n"
// " service.characteristics:${service.characteristics}\n\n"
// " service.includedServices:${service.includedServices}");
if (service.uuid == _serviceIdConnect) {
- for (BluetoothCharacteristic characteristic
+ for (final BluetoothCharacteristic characteristic
in service.characteristics) {
// AppLog.log("44444 characteristic.remoteId:${characteristic.remoteId}"
// " characteristic.uuid:${characteristic.uuid}\n\n"
@@ -598,8 +602,8 @@ class BlueManage {
// .characteristicUuid}");
if (characteristic.characteristicUuid == _characteristicIdWrite) {
try {
- List valueList = value;
- List subData = splitList(valueList, _mtuSize!);
+ final List valueList = value;
+ final List subData = splitList(valueList, _mtuSize!);
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
for (int i = 0; i < subData.length; i++) {
if (characteristic.properties.writeWithoutResponse) {
@@ -660,15 +664,15 @@ class BlueManage {
// 写入
Future writeNull() async {
- List services =
+ final List services =
await bluetoothConnectDevice!.discoverServices();
- for (BluetoothService service in services) {
+ for (final BluetoothService service in services) {
if (service.uuid == _serviceIdConnect) {
- for (BluetoothCharacteristic characteristic
+ for (final BluetoothCharacteristic characteristic
in service.characteristics) {
if (characteristic.characteristicUuid == _characteristicIdWrite) {
try {
- List valueList = [1];
+ final List valueList = [1];
AppLog.log('APP写入 writeNull ');
await characteristic.write(valueList);
} on Exception catch (e, s) {
@@ -713,7 +717,7 @@ class BlueManage {
try {
await FlutterBluePlus.stopScan();
} catch (e) {
- AppLog.log("停止扫描失败");
+ AppLog.log('停止扫描失败');
}
}
@@ -721,17 +725,17 @@ class BlueManage {
Future disconnect() async {
try {
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
- connectDeviceMacAddress = "";
+ connectDeviceMacAddress = '';
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
// await writeNull();
// await Future.delayed(const Duration(milliseconds: 1000));
//加快蓝牙断连
await bluetoothConnectDevice!.disconnect(timeout: 2);
- AppLog.log("断开连接成功");
+ AppLog.log('断开连接成功');
}
// }
} on Exception catch (e, _) {
- AppLog.log("断开连接失败: $e");
+ AppLog.log('断开连接失败: $e');
} finally {
bluetoothConnectionState = BluetoothConnectionState.disconnected;
}
@@ -742,7 +746,7 @@ class BlueManage {
await FlutterBluePlus.turnOn();
}
if (Platform.isIOS) {
- EasyLoading.showToast("请开启蓝牙".tr, duration: 2000.milliseconds);
+ EasyLoading.showToast('请开启蓝牙'.tr, duration: 2000.milliseconds);
}
}
diff --git a/lib/flavors.dart b/lib/flavors.dart
index 9d350755..2eb513d9 100755
--- a/lib/flavors.dart
+++ b/lib/flavors.dart
@@ -86,7 +86,7 @@ class F {
switch (appFlavor) {
case Flavor.local:
return 'https://ge.lock.star-lock.cn'; // 葛工
- // return 'http://192.168.1.15:8022'; // 谢工
+ // return 'http://192.168.1.15:8022'; // 谢工
case Flavor.dev:
return 'https://dev.lock.star-lock.cn';
case Flavor.pre:
@@ -95,7 +95,7 @@ class F {
return 'https://lock.skychip.top';
case Flavor.xhj:
return 'https://lock.xhjcn.ltd';
- // return 'https://pre.lock.star-lock.cn';
+ // return 'https://pre.lock.star-lock.cn';
default:
throw Exception('flavor[$name] apiPrefix not found');
}
@@ -125,4 +125,19 @@ class F {
throw Exception('flavor[$name] aMapKey not found');
}
}
+
+ // 是否是生产环境
+ static bool get isProductionEnv {
+ switch (appFlavor) {
+ case Flavor.local:
+ case Flavor.dev:
+ case Flavor.pre:
+ return false;
+ case Flavor.sky:
+ case Flavor.xhj:
+ return true;
+ default:
+ return false;
+ }
+ }
}
diff --git a/lib/login/login/starLock_login_logic.dart b/lib/login/login/starLock_login_logic.dart
index 8142990f..508c1f15 100755
--- a/lib/login/login/starLock_login_logic.dart
+++ b/lib/login/login/starLock_login_logic.dart
@@ -1,8 +1,11 @@
import 'dart:io';
import 'package:flutter/material.dart';
+import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
+import 'package:star_lock/login/login/entity/LoginEntity.dart';
+import 'package:star_lock/mine/mine/starLockMine_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/xs_jPhush.dart';
@@ -14,34 +17,15 @@ import 'starLock_login_state.dart';
class StarLockLoginLogic extends BaseGetXController {
final StarLockLoginState state = StarLockLoginState();
- final stateMyLogic = Get.put(StarLockMineLogic()).state;
+ final StarLockMineState stateMyLogic = Get.put(StarLockMineLogic()).state;
int indexFocusNode = noneFocusNode;
static int noneFocusNode = 0;
static int emailOrPhoneFocusNode = 1;
static int pwdFocusNode = 2;
- @override
- void onInit() {
- super.onInit();
- // state.emailOrPhoneFocusNode.addListener(() {
- // if (state.emailOrPhoneFocusNode.hasFocus) {
- // indexFocusNode = emailOrPhoneFocusNode;
- // } else {
- // changeInputFocusNode();
- // }
- // });
- // state.pwdFocusNode.addListener(() {
- // if (state.pwdFocusNode.hasFocus) {
- // indexFocusNode = pwdFocusNode;
- // } else {
- // changeInputFocusNode();
- // }
- // });
- }
-
//检查焦点状态
void changeInputFocusNode() {
- Future.delayed(Duration(milliseconds: 100), () {
+ Future.delayed(const Duration(milliseconds: 100), () {
if (indexFocusNode == noneFocusNode) {
return;
}
@@ -53,9 +37,9 @@ class StarLockLoginLogic extends BaseGetXController {
});
}
- void login() async {
- var entity = await ApiRepository.to.login(
- loginType: "1",
+ Future login() async {
+ final LoginEntity entity = await ApiRepository.to.login(
+ loginType: '1',
password: state.pwd.value,
countryCode: state.countryCode.value,
username: state.emailOrPhone.value);
@@ -67,7 +51,7 @@ class StarLockLoginLogic extends BaseGetXController {
// Get.toNamed(Routers.starLockMain);
XSJPushProvider().initJPushService();
XSJPushProvider().initLocalNotification(false);
- Get.offNamedUntil(Routers.starLockMain, (route) => false);
+ Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
}
}
diff --git a/lib/main.dart b/lib/main.dart
index 8b2c3710..65a67850 100755
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,9 +1,12 @@
import 'dart:async';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
+import 'package:star_lock/tools/bugly/bugly_tool.dart';
import 'package:star_lock/tools/device_info_service.dart';
import 'package:star_lock/tools/platform_info_services.dart';
import 'package:star_lock/translations/trans_lib.dart';
@@ -21,19 +24,10 @@ FutureOr main() async {
// 设置国际化信息
await _initTranslation();
- //错误日志监控
- FlutterError.onError = (FlutterErrorDetails details) async {
- AppLog.log('error:${details.exception.toString()}',
- stackTrace: details.stack, error: true);
- Zone.current.handleUncaughtError(details.exception, details.stack!);
- };
+ // bugly错误日志监控
+ await BuglyTool.init();
- //错误日志监控
- runZonedGuarded>(() async {
- runApp(const MyApp());
- }, (Object error, StackTrace stackTrace) async {
- AppLog.log('error:$error', stackTrace: stackTrace, error: true);
- });
+ runApp(const MyApp());
if (AppPlatform.isAndroid) {
const SystemUiOverlayStyle systemUiOverlayStyle =
diff --git a/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_page.dart b/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_page.dart
index cecd68b0..4cad5ecd 100755
--- a/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_page.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_page.dart
@@ -1,7 +1,9 @@
import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
+import 'package:star_lock/main/lockDetail/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_state.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
@@ -20,8 +22,10 @@ class CheckingInAddHolidaysPage extends StatefulWidget {
}
class _CheckingInAddHolidaysPageState extends State {
- final logic = Get.put(CheckingInAddHolidaysLogic());
- final state = Get.find().state;
+ final CheckingInAddHolidaysLogic logic =
+ Get.put(CheckingInAddHolidaysLogic());
+ final CheckingInAddHolidaysState state =
+ Get.find().state;
@override
Widget build(BuildContext context) {
@@ -32,27 +36,31 @@ class _CheckingInAddHolidaysPageState extends State {
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
- children: [
+ children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
- rightTitle: "",
+ rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
+ setHeight: false,
rightWidget: getTFWidget(
- "(${TranslationLoader.lanKeys!.mustFillIn!.tr})")),
+ '(${TranslationLoader.lanKeys!.mustFillIn!.tr})')),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.startDate!.tr,
- rightTitle: state.beginDate.value.isEmpty ? "(${TranslationLoader.lanKeys!.mustFillIn!.tr})" : state.beginDate.value,
+ rightTitle: state.beginDate.value.isEmpty
+ ? '(${TranslationLoader.lanKeys!.mustFillIn!.tr})'
+ : state.beginDate.value,
isHaveLine: true,
isHaveDirection: false,
action: () async {
await showDialog(
context: context,
- builder: (context) {
+ builder: (BuildContext context) {
return ShowCalendar(
datePickerMode: DatePickerMode.day,
- selectAction: (dateTime) {
- String beginDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
+ selectAction: (DateTime dateTime) {
+ final String beginDate = formatDate(
+ dateTime, [yyyy, '-', mm, '-', dd]);
state.beginDate.value = beginDate;
Get.back();
// Navigator.of(context).pop(true);
@@ -61,17 +69,20 @@ class _CheckingInAddHolidaysPageState extends State {
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.endDate!.tr,
- rightTitle: state.endDate.value.isEmpty ? "(${TranslationLoader.lanKeys!.mustFillIn!.tr})" : state.endDate.value,
+ rightTitle: state.endDate.value.isEmpty
+ ? '(${TranslationLoader.lanKeys!.mustFillIn!.tr})'
+ : state.endDate.value,
isHaveLine: true,
isHaveDirection: false,
action: () async {
await showDialog(
context: context,
- builder: (context) {
+ builder: (BuildContext context) {
return ShowCalendar(
datePickerMode: DatePickerMode.day,
- selectAction: (dateTime) {
- String endDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
+ selectAction: (DateTime dateTime) {
+ final String endDate = formatDate(
+ dateTime, [yyyy, '-', mm, '-', dd]);
state.endDate.value = endDate;
Get.back();
});
@@ -85,11 +96,12 @@ class _CheckingInAddHolidaysPageState extends State {
action: () async {
await showDialog(
context: context,
- builder: (context) {
+ builder: (BuildContext context) {
return ShowCalendar(
datePickerMode: DatePickerMode.day,
- selectAction: (dateTime) {
- String makeUpWorkDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
+ selectAction: (DateTime dateTime) {
+ final String makeUpWorkDate = formatDate(
+ dateTime, [yyyy, '-', mm, '-', dd]);
state.makeUpWorkDate.value = makeUpWorkDate;
Get.back();
});
@@ -112,30 +124,26 @@ class _CheckingInAddHolidaysPageState extends State {
}
Widget getTFWidget(String tfStr) {
- return Container(
- height: 50.h,
- width: 300.w,
- // color: Colors.red,
- child: Row(
- children: [
- Expanded(
- child: TextField(
- //输入框一行
- maxLines: 1,
- controller: state.staffNameController,
- autofocus: false,
- textAlign: TextAlign.end,
- decoration: InputDecoration(
- //输入里面输入文字内边距设置
- contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
- hintText: tfStr,
- hintStyle: TextStyle(
- fontSize: 22.sp, color: AppColors.darkGrayTextColor),
- //不需要输入框下划线
- border: InputBorder.none,
- ),
- ),
- ),
+ return Expanded(
+ child: TextField(
+ //输入框一行
+ maxLines: 2,
+ minLines: 1,
+ controller: state.staffNameController,
+ autofocus: false,
+ textAlign: TextAlign.end,
+ decoration: InputDecoration(
+ //输入里面输入文字内边距设置
+ contentPadding: const EdgeInsets.only(bottom: 3),
+ hintText: tfStr,
+ hintStyle: TextStyle(
+ fontSize: 22.sp, color: AppColors.darkGrayTextColor, height: 1),
+ //不需要输入框下划线
+ border: InputBorder.none,
+ isCollapsed: true,
+ ),
+ inputFormatters: [
+ LengthLimitingTextInputFormatter(30),
],
),
);
@@ -145,7 +153,7 @@ class _CheckingInAddHolidaysPageState extends State {
return GestureDetector(
onTap: () {},
child: Row(
- children: [
+ children: [
Image.asset(
'images/icon_round_unSelect.png',
width: 40.w,
diff --git a/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_page.dart b/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_page.dart
index 76480bc8..eece3717 100755
--- a/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_page.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_page.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
+import 'package:star_lock/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_state.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/style/picker_style.dart';
@@ -25,8 +26,10 @@ class CheckingInSetHolidaysPage extends StatefulWidget {
}
class _CheckingInSetHolidaysPageState extends State {
- final logic = Get.put(CheckingInSetHolidaysLogic());
- final state = Get.find().state;
+ final CheckingInSetHolidaysLogic logic =
+ Get.put(CheckingInSetHolidaysLogic());
+ final CheckingInSetHolidaysState state =
+ Get.find().state;
@override
Widget build(BuildContext context) {
@@ -37,12 +40,14 @@ class _CheckingInSetHolidaysPageState extends State {
titleWidget: titleWidget(),
haveBack: true,
backgroundColor: AppColors.mainColor,
- actionsList: [
+ actionsList: [
GestureDetector(
onTap: () async {
- var data = await Get.toNamed(
+ final dynamic data = await Get.toNamed(
Routers.checkingInAddHolidaysPage,
- arguments: {"companyId": state.companyId.value});
+ arguments: {
+ 'companyId': state.companyId.value
+ });
if (data != null) {
logic.editStaffLoadData();
}
@@ -58,12 +63,12 @@ class _CheckingInSetHolidaysPageState extends State {
],
),
body: Obx(() {
- return state.holidaysListData.value!.isNotEmpty
+ return state.holidaysListData.isNotEmpty
? ListView.builder(
- itemCount: state.holidaysListData.value!.length,
- itemBuilder: (c, index) {
- HolidaysMonthListData holidaysMonthListData =
- state.holidaysListData.value![index];
+ itemCount: state.holidaysListData.length,
+ itemBuilder: (BuildContext c, int index) {
+ final HolidaysMonthListData holidaysMonthListData =
+ state.holidaysListData[index];
return _checkingInListMouthItem(holidaysMonthListData);
})
: NoData();
@@ -71,34 +76,44 @@ class _CheckingInSetHolidaysPageState extends State {
}
Widget _checkingInListMouthItem(HolidaysMonthListData holidaysMonthListData) {
+ final double width = Get.width - 20.w * 2;
+ final double l = width * 0.2;
+ final double r = width * 0.8;
return GestureDetector(
child: Container(
- height: 140.h * holidaysMonthListData.listItem!.length + 20.w,
- padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ colors: [
+ colorWithMonth(int.parse(
+ holidaysMonthListData.listItem![0].month.toString())),
+ Colors.white
+ ],
+ stops: const [0.2, 0.2],
+ ),
+ ),
+ margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
child: Row(
- children: [
+ children: [
Container(
color: colorWithMonth(int.parse(
holidaysMonthListData.listItem![0].month.toString())),
- width: 100.w,
- height: 140.h * holidaysMonthListData.listItem!.length,
+ width: l,
child: Center(
child: Text(
- "${holidaysMonthListData.listItem![0].month}\n${TranslationLoader.lanKeys!.month!.tr}",
+ '${holidaysMonthListData.listItem![0].month}\n${TranslationLoader.lanKeys!.month!.tr}',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 28.sp, color: Colors.white),
))),
SizedBox(
- height: 140.h * holidaysMonthListData.listItem!.length,
- width: 1.sw - 100.w - 20.w * 2,
+ width: r,
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: holidaysMonthListData.listItem!.length,
- itemBuilder: (c, index) {
- ListItem listItem = holidaysMonthListData.listItem![index];
+ itemBuilder: (BuildContext c, int index) {
+ final ListItem listItem =
+ holidaysMonthListData.listItem![index];
return _checkingInListItem(
- index,
listItem.vacationName,
DateTool().dateToYMDString(
listItem.vacationStartDate.toString()),
@@ -107,10 +122,10 @@ class _CheckingInSetHolidaysPageState extends State {
listItem.fillClassDate!.isNotEmpty
? DateTool().dateToYMDString(
listItem.fillClassDate.toString())
- : "", () async {
- var data = await Get.toNamed(
+ : '', () async {
+ final dynamic data = await Get.toNamed(
Routers.checkingInDeletHolidaysPage,
- arguments: {"listItem": listItem});
+ arguments: {'listItem': listItem});
if (data != null) {
logic.editStaffLoadData();
}
@@ -123,83 +138,66 @@ class _CheckingInSetHolidaysPageState extends State {
);
}
- Widget _checkingInListItem(
- int index,
- String? lockTypeTitle,
- String? vacationStartDate,
- String? vacationEndDate,
- String? makeUpClass,
- Function() action) {
+ Widget _checkingInListItem(String? lockTypeTitle, String? vacationStartDate,
+ String? vacationEndDate, String? makeUpClass, Function() action) {
return GestureDetector(
onTap: action,
- child: Column(
- children: [
- Container(
- color: Colors.white,
- height: 140.h,
- padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
- child: Row(
- children: [
- Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- lockTypeTitle!,
- style: TextStyle(fontSize: 24.sp),
- ),
- ],
- ),
- SizedBox(height: 10.h),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Text(
- "${TranslationLoader.lanKeys!.libertyDay!.tr}:$vacationStartDate - $vacationEndDate",
- style: TextStyle(fontSize: 20.sp),
- ),
- ],
- ),
- SizedBox(height: 5.h),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Text(
- "${TranslationLoader.lanKeys!.coverDate!.tr}:$makeUpClass",
- style: TextStyle(fontSize: 20.sp),
- ),
- ],
- ),
- ],
- ),
- ),
- SizedBox(width: 20.h),
- ],
+ child: Container(
+ padding:
+ EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
+ decoration: BoxDecoration(
+ border: Border(
+ bottom: BorderSide(
+ color: AppColors.mainBackgroundColor, width: 1.h, // 设置边框宽度
),
),
- Container(color: AppColors.mainBackgroundColor, height: 1.h)
- ],
+ ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ Characters(lockTypeTitle!).join('\u{200B}'),
+ style: TextStyle(fontSize: 24.sp),
+ ),
+ SizedBox(height: 10.h),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Text(
+ '${TranslationLoader.lanKeys!.libertyDay!.tr}:$vacationStartDate - $vacationEndDate',
+ style: TextStyle(fontSize: 20.sp),
+ ),
+ ],
+ ),
+ SizedBox(height: 5.h),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Text(
+ '${TranslationLoader.lanKeys!.coverDate!.tr}:$makeUpClass',
+ style: TextStyle(fontSize: 20.sp),
+ ),
+ ],
+ ),
+ ],
+ ),
),
);
}
Widget titleWidget() {
return GestureDetector(
- onTap: () {
- showListType();
- },
+ onTap: showListType,
child: Obx(() => Container(
width: 300.w,
height: 50.h,
color: AppColors.mainColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
- children: [
+ children: [
Text(
- "${state.selectYear.value}${TranslationLoader.lanKeys!.year!.tr}",
+ '${state.selectYear.value}${TranslationLoader.lanKeys!.year!.tr}',
style: TextStyle(color: Colors.white, fontSize: 26.sp),
),
SizedBox(
@@ -226,9 +224,7 @@ class _CheckingInSetHolidaysPageState extends State {
// 样式 详见下方样式
pickerStyle: PickerStyle(
cancelButton: GestureDetector(
- onTap: () {
- Get.back();
- },
+ onTap: Get.back,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 22, right: 12),
@@ -237,9 +233,7 @@ class _CheckingInSetHolidaysPageState extends State {
),
),
commitButton: GestureDetector(
- onTap: () {
- Get.back();
- },
+ onTap: Get.back,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 22, right: 12),
@@ -252,7 +246,7 @@ class _CheckingInSetHolidaysPageState extends State {
selectDate: PDuration(year: 2023),
minDate: PDuration(year: 1900),
maxDate: PDuration(year: 2100),
- onConfirm: (p) {
+ onConfirm: (PDuration p) {
state.selectYear.value = p.year!;
logic.editStaffLoadData();
},
diff --git a/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart b/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart
index 20344f94..17e73087 100755
--- a/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart
@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListMonth_entity.dart';
+import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart';
+import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@@ -23,8 +25,8 @@ class CheckingInListPage extends StatefulWidget {
}
class _CheckingInListPageState extends State {
- final logic = Get.put(CheckingInListLogic());
- final state = Get.find().state;
+ final CheckingInListLogic logic = Get.put(CheckingInListLogic());
+ final CheckingInListState state = Get.find().state;
@override
Widget build(BuildContext context) {
@@ -35,26 +37,34 @@ class _CheckingInListPageState extends State {
titleWidget: titleWidget(),
haveBack: true,
backgroundColor: AppColors.mainColor,
- actionsList: [
- (state.getKeyInfosData.value.keyRight == 1) ?
- GestureDetector(
- onTap: () async {
- var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
- if(isDemoMode == false){
- Get.toNamed(Routers.checkingInSetPage, arguments: {
- "getKeyInfosData": state.getKeyInfosData.value,
- });
- }else{
- // Get.toNamed(Routers.selectLockTypePage);
- logic.showToast("演示模式");
- }
- },
- child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)) : Container(),
+ actionsList: [
+ if (state.getKeyInfosData.value.keyRight == 1)
+ GestureDetector(
+ onTap: () async {
+ final bool? isDemoMode =
+ await Storage.getBool(ifIsDemoModeOrNot);
+ if (isDemoMode == false) {
+ Get.toNamed(Routers.checkingInSetPage,
+ arguments: {
+ 'getKeyInfosData': state.getKeyInfosData.value,
+ });
+ } else {
+ // Get.toNamed(Routers.selectLockTypePage);
+ logic.showToast('演示模式');
+ }
+ },
+ child: Image.asset(
+ 'images/main/icon_lockDetail_checkIn_set.png',
+ width: 36.w,
+ height: 36.w,
+ ))
+ else
+ Container(),
SizedBox(width: 30.w),
],
),
body: Column(
- children: [
+ children: [
topInfo(),
SizedBox(height: 10.h),
middleDayInfo(),
@@ -70,7 +80,7 @@ class _CheckingInListPageState extends State {
// height: 280.h,
color: Colors.white,
child: Column(
- children: [
+ children: [
SizedBox(height: 30.h),
Obx(() => Container(
width: 110.w,
@@ -80,32 +90,38 @@ class _CheckingInListPageState extends State {
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(60.w),
),
- child: Image.asset(getTopImg(), width: 120.w, height: 120.w)
- )),
+ child: Image.asset(getTopImg(), width: 120.w, height: 120.w))),
SizedBox(height: 10.h),
- Obx(() => Text(getTopTitle(), style: TextStyle(color: Colors.black, fontSize: 24.sp))),
+ Obx(() => Text(getTopTitle(),
+ style: TextStyle(color: Colors.black, fontSize: 24.sp))),
SizedBox(height: 30.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
+ children: [
// SizedBox(width: 30.w,),
Row(
- children: [
- SizedBox(width: 20.w,),
+ children: [
+ SizedBox(
+ width: 20.w,
+ ),
GestureDetector(
onTap: () async {
- var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
- if(isDemoMode == false){
+ final bool? isDemoMode =
+ await Storage.getBool(ifIsDemoModeOrNot);
+ if (isDemoMode == false) {
setState(() {
state.isDay.value = true;
- DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
- String beginDate = formatDate(dateTime, [mm,'-',dd]);
+ final DateTime dateTime =
+ DateTime.fromMillisecondsSinceEpoch(
+ state.checkListDateTimestamp.value);
+ final String beginDate =
+ formatDate(dateTime, [mm, '-', dd]);
state.checkListDate.value = beginDate;
logic.loadDataByType();
});
- }else{
+ } else {
// Get.toNamed(Routers.selectLockTypePage);
- logic.showToast("演示模式");
+ logic.showToast('演示模式');
}
},
child: Container(
@@ -113,37 +129,47 @@ class _CheckingInListPageState extends State {
// height: 100.h,
color: Colors.white,
child: Obx(() => Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(TranslationLoader.lanKeys!.dailyCharts!.tr, style: TextStyle(color: state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)),
- SizedBox(height: 10.h),
- Visibility(
- visible: state.isDay.value,
- child: Container(
- width: 20.w,
- height: 2.h,
- color: state.isDay.value ? AppColors.mainColor : Colors.black
- ),
- )
- ],
- )),
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Text(TranslationLoader.lanKeys!.dailyCharts!.tr,
+ style: TextStyle(
+ color: state.isDay.value
+ ? AppColors.mainColor
+ : Colors.black,
+ fontSize: 22.sp)),
+ SizedBox(height: 10.h),
+ Visibility(
+ visible: state.isDay.value,
+ child: Container(
+ width: 20.w,
+ height: 2.h,
+ color: state.isDay.value
+ ? AppColors.mainColor
+ : Colors.black),
+ )
+ ],
+ )),
),
),
// SizedBox(width: 20.w,),
GestureDetector(
onTap: () async {
- var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
- if(isDemoMode == false){
+ final bool? isDemoMode =
+ await Storage.getBool(ifIsDemoModeOrNot);
+ if (isDemoMode == false) {
setState(() {
state.isDay.value = false;
- DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
- String beginDate = formatDate(dateTime, [mm]);
+ final DateTime dateTime =
+ DateTime.fromMillisecondsSinceEpoch(
+ state.checkListDateTimestamp.value);
+ final String beginDate =
+ formatDate(dateTime, [mm]);
state.checkListDate.value = beginDate;
logic.loadDataByType();
});
- }else{
+ } else {
// Get.toNamed(Routers.selectLockTypePage);
- logic.showToast("演示模式");
+ logic.showToast('演示模式');
}
},
child: Container(
@@ -151,49 +177,76 @@ class _CheckingInListPageState extends State {
// height: 100.h,
color: Colors.white,
child: Obx(() => Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(TranslationLoader.lanKeys!.monthlyLeaderboard!.tr, style: TextStyle(color: !state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)),
- SizedBox(height: 10.h),
- Visibility(
- visible: !state.isDay.value,
- child: Container(width: 20.w, height: 2.h, color: !state.isDay.value ? AppColors.mainColor : Colors.black))
- ],
- )),
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Text(
+ TranslationLoader
+ .lanKeys!.monthlyLeaderboard!.tr,
+ style: TextStyle(
+ color: !state.isDay.value
+ ? AppColors.mainColor
+ : Colors.black,
+ fontSize: 22.sp)),
+ SizedBox(height: 10.h),
+ Visibility(
+ visible: !state.isDay.value,
+ child: Container(
+ width: 20.w,
+ height: 2.h,
+ color: !state.isDay.value
+ ? AppColors.mainColor
+ : Colors.black))
+ ],
+ )),
),
),
],
),
GestureDetector(
onTap: () async {
- var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
- if(isDemoMode == false){
+ final bool? isDemoMode =
+ await Storage.getBool(ifIsDemoModeOrNot);
+ if (isDemoMode == false) {
await showDialog(
context: Get.context!,
- builder: (context) {
+ builder: (BuildContext context) {
return ShowCalendar(
datePickerMode: DatePickerMode.day,
- selectAction: (dateTime) {
+ selectAction: (DateTime dateTime) {
setState(() {
- state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
- String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
+ state.checkListDateTimestamp.value =
+ dateTime.millisecondsSinceEpoch;
+ final String beginDate = formatDate(
+ dateTime,
+ state.isDay.value
+ ? [mm, '-', dd]
+ : [mm]);
state.checkListDate.value = beginDate;
logic.loadDataByType();
Get.back();
});
});
});
- }else{
+ } else {
// Get.toNamed(Routers.selectLockTypePage);
- logic.showToast("演示模式");
+ logic.showToast('演示模式');
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(state.checkListDate.value, style: TextStyle(color: Colors.black, fontSize: 22.sp),),
- Image.asset('images/icon_grayPullDown.png', width: 50.w, height: 30.w,),
- SizedBox(width: 10.w,),
+ children: [
+ Text(
+ state.checkListDate.value,
+ style: TextStyle(color: Colors.black, fontSize: 22.sp),
+ ),
+ Image.asset(
+ 'images/icon_grayPullDown.png',
+ width: 50.w,
+ height: 30.w,
+ ),
+ SizedBox(
+ width: 10.w,
+ ),
],
),
)
@@ -207,131 +260,174 @@ class _CheckingInListPageState extends State {
Widget middleDayInfo() {
return Obx(() => Visibility(
- visible: state.isDay.value,
- child: Container(
- height: 80.h,
- color: Colors.white,
- margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Column(
+ visible: state.isDay.value,
+ child: Container(
+ height: 80.h,
+ color: Colors.white,
+ margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- SizedBox(height: 5.h),
- Text(state.lateTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)),
- Text(TranslationLoader.lanKeys!.beLate!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)),
- SizedBox(height: 5.h),
+ children: [
+ Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ SizedBox(height: 5.h),
+ Text(state.lateTimes.value,
+ style: TextStyle(color: Colors.black, fontSize: 20.sp)),
+ Text(TranslationLoader.lanKeys!.beLate!.tr,
+ style: TextStyle(color: Colors.black, fontSize: 22.sp)),
+ SizedBox(height: 5.h),
+ ],
+ ),
+ Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ SizedBox(height: 5.h),
+ Text(state.earlyTimes.value,
+ style: TextStyle(color: Colors.black, fontSize: 20.sp)),
+ Text(TranslationLoader.lanKeys!.leaveEarly!.tr,
+ style: TextStyle(color: Colors.black, fontSize: 22.sp)),
+ SizedBox(height: 5.h),
+ ],
+ ),
+ Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ SizedBox(height: 5.h),
+ Text(state.noPunchTimes.value,
+ style: TextStyle(color: Colors.black, fontSize: 20.sp)),
+ Text(TranslationLoader.lanKeys!.noCardPunched!.tr,
+ style: TextStyle(color: Colors.black, fontSize: 22.sp)),
+ SizedBox(height: 5.h),
+ ],
+ ),
],
),
- Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- SizedBox(height: 5.h),
- Text(state.earlyTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)),
- Text(TranslationLoader.lanKeys!.leaveEarly!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)),
- SizedBox(height: 5.h),
- ],
- ),
- Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- SizedBox(height: 5.h),
- Text(state.noPunchTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)),
- Text(TranslationLoader.lanKeys!.noCardPunched!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)),
- SizedBox(height: 5.h),
- ],
- ),
- ],
- ),
- ),
- ));
+ ),
+ ));
}
- Widget getBottomList(){
- if((state.isDay.value == true && (state.listType.value == "1")) || (state.isDay.value == true && (state.listType.value == "2"))){
+ Widget getBottomList() {
+ if ((state.isDay.value == true && (state.listType.value == '1')) ||
+ (state.isDay.value == true && (state.listType.value == '2'))) {
return bottomDayList();
- }else{
+ } else {
return bottomMonthList();
}
}
Widget bottomDayList() {
- return Obx(() => state.checkingInDayListData.value.isNotEmpty ? ListView.separated(
- itemCount: state.checkingInDayListData.value.length,
- itemBuilder: (c, index) {
- AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index];
- return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () {
- Get.toNamed(Routers.checkingInDetailPage, arguments: {
- // "getKeyInfosData": state.getKeyInfosData.value,
- "companyId": state.companyId.value,
- "staffId": attendanceRecordList.staffId,
- "staffName": attendanceRecordList.staffName,
+ return Obx(() => state.checkingInDayListData.isNotEmpty
+ ? ListView.separated(
+ itemCount: state.checkingInDayListData.length,
+ itemBuilder: (BuildContext c, int index) {
+ final AttendanceRecordDayList attendanceRecordList =
+ state.checkingInDayListData[index];
+ return _checkingInListItem(
+ index,
+ attendanceRecordList.headurl,
+ attendanceRecordList.staffName,
+ attendanceRecordList.attendanceType, () {
+ Get.toNamed(Routers.checkingInDetailPage,
+ arguments: {
+ // "getKeyInfosData": state.getKeyInfosData.value,
+ 'companyId': state.companyId.value,
+ 'staffId': attendanceRecordList.staffId,
+ 'staffName': attendanceRecordList.staffName,
+ });
});
- });
- },
- separatorBuilder: (context, index) {
- return const Divider(height: 1, color: AppColors.greyLineColor);
- },
- ) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight*2 - 64.h - 280.h - 90.h,));
+ },
+ separatorBuilder: (BuildContext context, int index) {
+ return const Divider(height: 1, color: AppColors.greyLineColor);
+ },
+ )
+ : NoData(
+ noDataHeight:
+ 1.sh - ScreenUtil().statusBarHeight * 2 - 64.h - 280.h - 90.h,
+ ));
}
Widget bottomMonthList() {
- return Obx(() => state.checkingInMonthListData.value.isNotEmpty ? ListView.separated(
- itemCount: state.checkingInMonthListData.value.length,
- itemBuilder: (c, index) {
- AttendanceRecordMonthList attendanceRecordList= state.checkingInMonthListData.value[index];
- return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () {
- Get.toNamed(Routers.checkingInDetailPage, arguments: {
- "companyId": state.companyId.value,
- "staffId": attendanceRecordList.staffId,
- "staffName": attendanceRecordList.staffName,
- });
- });
- },
- separatorBuilder: (context, index) {
- return const Divider(height: 1, color: AppColors.greyLineColor);
- },
- ) : NoData(noDataHeight: 1.sh - - ScreenUtil().statusBarHeight - 280.h - 90.h,));
+ return Obx(() => state.checkingInMonthListData.isNotEmpty
+ ? ListView.separated(
+ itemCount: state.checkingInMonthListData.length,
+ itemBuilder: (BuildContext c, int index) {
+ final AttendanceRecordMonthList attendanceRecordList =
+ state.checkingInMonthListData[index];
+ return _checkingInListItem(
+ index,
+ attendanceRecordList.headurl,
+ attendanceRecordList.staffName,
+ attendanceRecordList.attendanceType, () {
+ Get.toNamed(Routers.checkingInDetailPage,
+ arguments: {
+ 'companyId': state.companyId.value,
+ 'staffId': attendanceRecordList.staffId,
+ 'staffName': attendanceRecordList.staffName,
+ });
+ });
+ },
+ separatorBuilder: (BuildContext context, int index) {
+ return const Divider(height: 1, color: AppColors.greyLineColor);
+ },
+ )
+ : NoData(
+ noDataHeight: 1.sh - -ScreenUtil().statusBarHeight - 280.h - 90.h,
+ ));
}
- Widget _checkingInListItem(int index, String? headUrl, String? name, Function() action) {
+ Widget _checkingInListItem(
+ int index, String? headUrl, String? name, int? type, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 80.h,
- padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
+ padding:
+ EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
- children: [
- SizedBox(width: 20.w,),
- Text("${index+1}", style: TextStyle(fontSize: 20.sp),),
- SizedBox(width: 20.w,),
- Image.asset('images/controls_user.png', width: 60.w, height: 60.w,),
- // Container(
- // width: 60.h,
- // height: 60.h,
- // decoration: BoxDecoration(
- // color: AppColors.mainColor,
- // border: Border.all(width: 1, color: AppColors.mainColor),
- // borderRadius: BorderRadius.circular(30.h),
- // ),
- // padding: EdgeInsets.all(10.w),
- // child: Image.asset(
- // 'images/controls_user.png',
- // width: 30.w,
- // height: 30.w,
- // color: Colors.white,
- // )),
+ children: [
+ SizedBox(
+ width: 20.w,
+ ),
+ Text(
+ '${index + 1}',
+ style: TextStyle(fontSize: 20.sp),
+ ),
+ SizedBox(
+ width: 20.w,
+ ),
+ if (headUrl == null || headUrl == '')
+ Image.asset(
+ getTypeIcon(type ?? 0),
+ width: 60.w,
+ height: 60.w,
+ )
+ else
+ ClipRRect(
+ borderRadius: BorderRadius.circular(100.w),
+ child: Image.network(
+ headUrl,
+ width: 60.w,
+ height: 60.w,
+ ),
+ ),
SizedBox(width: 20.w),
Expanded(
- child: Text(name!, style: TextStyle(fontSize: 24.sp),),
+ child: Text(
+ name!,
+ style: TextStyle(fontSize: 24.sp),
+ ),
),
SizedBox(width: 20.h),
- Image.asset("images/icon_right_grey.png", width: 21.w, height: 21.w,),
+ Image.asset(
+ 'images/icon_right_grey.png',
+ width: 21.w,
+ height: 21.w,
+ ),
SizedBox(width: 20.h),
],
),
@@ -339,35 +435,71 @@ class _CheckingInListPageState extends State {
);
}
+ // 1APP 2密码 3卡 4指纹
+ String getTypeIcon(int type) {
+ String title = 'images/controls_user.png';
+ switch (type) {
+ case 1:
+ // 蓝牙开锁
+ title = 'images/controls_user.png';
+ break;
+ case 2:
+ // 密码开锁
+ title = 'images/icon_password.png';
+ break;
+ case 3:
+ // ic卡
+ title = 'images/icon_card.png';
+ break;
+ case 4:
+ // 指纹开锁
+ title = 'images/icon_fingerprint.png';
+ break;
+ default:
+ break;
+ }
+ return title;
+ }
+
Widget titleWidget() {
return GestureDetector(
onTap: () async {
- var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
- if(isDemoMode == false){
+ final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
+ if (isDemoMode == false) {
showListType();
- }else{
+ } else {
// Get.toNamed(Routers.selectLockTypePage);
- logic.showToast("演示模式");
+ logic.showToast('演示模式');
}
},
child: Obx(() => Container(
- // width: 200.w,
- // height: 60.h,
- color: AppColors.mainColor,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(state.listTypeStr.value, style: TextStyle(color: Colors.white, fontSize: 26.sp),),
- SizedBox(width: 5.w,),
- Image.asset('images/main/icon_lockDetail_checkIn_topTitle.png', width: 22.w, height: 16.w, fit: BoxFit.fill,)
- ],
- ),
- )),
+ // width: 200.w,
+ // height: 60.h,
+ color: AppColors.mainColor,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ state.listTypeStr.value,
+ style: TextStyle(color: Colors.white, fontSize: 26.sp),
+ ),
+ SizedBox(
+ width: 5.w,
+ ),
+ Image.asset(
+ 'images/main/icon_lockDetail_checkIn_topTitle.png',
+ width: 22.w,
+ height: 16.w,
+ fit: BoxFit.fill,
+ )
+ ],
+ ),
+ )),
);
}
void showListType() {
- var list = [
+ final List list = [
TranslationLoader.lanKeys!.earlyArrivalList!.tr,
TranslationLoader.lanKeys!.lateList!.tr,
TranslationLoader.lanKeys!.hardWorkingList!.tr
@@ -385,39 +517,39 @@ class _CheckingInListPageState extends State {
//adapter: PickerAdapter(),
data: list,
//选择事件的回调
- clickCallBack: (int index, var str) {
- setState(() {
- state.listTypeStr.value = str.toString();
- state.isDay.value = true;
- if(index == 0){
- state.listType.value = "1";
- }else if(index == 1){
- state.listType.value = "2";
- }else if(index == 2){
- state.listType.value = "3";
- }
- logic.loadDataByType();
- });
- });
+ clickCallBack: (int index, Object str) {
+ setState(() {
+ state.listTypeStr.value = str.toString();
+ state.isDay.value = true;
+ if (index == 0) {
+ state.listType.value = '1';
+ } else if (index == 1) {
+ state.listType.value = '2';
+ } else if (index == 2) {
+ state.listType.value = '3';
+ }
+ logic.loadDataByType();
+ });
+ });
}
- String getTopImg(){
- if(state.listType.value == "1"){
- return "images/main/icon_lockDetail_checkInRanking_zd.png";
- }else if(state.listType.value == "2"){
- return "images/main/icon_lockDetail_checkInRanking_cd.png";
- }else{
- return "images/main/icon_lockDetail_checkInRanking_qf.png";
+ String getTopImg() {
+ if (state.listType.value == '1') {
+ return 'images/main/icon_lockDetail_checkInRanking_zd.png';
+ } else if (state.listType.value == '2') {
+ return 'images/main/icon_lockDetail_checkInRanking_cd.png';
+ } else {
+ return 'images/main/icon_lockDetail_checkInRanking_qf.png';
}
}
- String getTopTitle(){
- if(state.listType.value == "1"){
- return "无考勤记录";
- }else if(state.listType.value == "2"){
- return "大家干劲十足";
- }else{
- return "工作时长未出炉";
+ String getTopTitle() {
+ if (state.listType.value == '1') {
+ return '无考勤记录';
+ } else if (state.listType.value == '2') {
+ return '大家干劲十足';
+ } else {
+ return '工作时长未出炉';
}
}
}
diff --git a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart
index 0cf124c0..da4c5f2c 100755
--- a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
+import 'package:star_lock/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart';
import '../../../../appRouters.dart';
import '../../../../tools/commonItem.dart';
@@ -22,8 +23,8 @@ class CheckingInSetPage extends StatefulWidget {
}
class _CheckingInSetPageState extends State {
- final logic = Get.put(CheckingInSetLogic());
- final state = Get.find().state;
+ final CheckingInSetLogic logic = Get.put(CheckingInSetLogic());
+ final CheckingInSetState state = Get.find().state;
@override
Widget build(BuildContext context) {
@@ -31,17 +32,17 @@ class _CheckingInSetPageState extends State {
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
- "${TranslationLoader.lanKeys!.checkingIn!.tr}${TranslationLoader.lanKeys!.set!.tr}",
+ '${TranslationLoader.lanKeys!.checkingIn!.tr}${TranslationLoader.lanKeys!.set!.tr}',
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
- children: [
+ children: [
Obx(() => CommonItem(
leftTitel:
- "公司名称".tr,
- // rightTitle: state.companyName.value ?? "",
- isHaveRightWidget: true,
- rightWidget: getTFWidget(),
+ '公司名称'.tr,
+ rightTitle: state.companyName.value ?? '',
+ // isHaveRightWidget: true,
+ // rightWidget: getTFWidget(),
isHaveLine: true,
isHaveDirection: true,
action: () {
@@ -53,23 +54,23 @@ class _CheckingInSetPageState extends State {
isHaveLine: true,
isHaveDirection: true,
action: () {
- Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
- "getKeyInfosData": state.getKeyInfosData.value,
- "companyId": state.companyId.value
+ Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
+ 'getKeyInfosData': state.getKeyInfosData.value,
+ 'companyId': state.companyId.value
});
})),
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.tr}",
- rightTitle: (state.beginTime.value.isNotEmpty) ? "${state.beginTime.value} - ${state.endTime.value}" : "",
+ rightTitle: (state.beginTime.value.isNotEmpty) ? '${state.beginTime.value} - ${state.endTime.value}' : '',
isHaveLine: true,
isHaveDirection: true,
action: () async {
- var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
+ var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
// "getKeyInfosData": state.getKeyInfosData.value,
- "companyId": state.companyId.value,
- "pushType": "2",
- "checkingInSetInfo": state.checkingInSetInfo.value,
+ 'companyId': state.companyId.value,
+ 'pushType': '2',
+ 'checkingInSetInfo': state.checkingInSetInfo.value,
});
if(data != null) {
setState(() {
@@ -84,30 +85,30 @@ class _CheckingInSetPageState extends State {
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}",
- rightTitle: state.isCustom.value == true ? state.weekDaysStr.value : (state.weekDaysStr.value.length == 5 ? "单休" : "双休"),
+ rightTitle: state.isCustom.value == true ? state.weekDaysStr.value : (state.weekDaysStr.value.length == 5 ? '单休' : '双休'),
isHaveLine: true,
isHaveDirection: true,
action: () async {
- var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: {
- "getKeyInfosData": state.getKeyInfosData.value,
- "companyId": state.companyId.value,
- "pushType": "2",
- "checkingInSetInfo": state.checkingInSetInfo.value,
+ var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: {
+ 'getKeyInfosData': state.getKeyInfosData.value,
+ 'companyId': state.companyId.value,
+ 'pushType': '2',
+ 'checkingInSetInfo': state.checkingInSetInfo.value,
});
if(data != null) {
- state.isCustom.value = data["attendanceType"];
- state.weekDays.value = data["weekDays"];
- state.weekDaysStr.value = state.weekDays.value.join(",");
+ state.isCustom.value = data['attendanceType'];
+ state.weekDays.value = data['weekDays'];
+ state.weekDaysStr.value = state.weekDays.value.join(',');
}
})),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.holidays!.tr,
- rightTitle: "",
+ rightTitle: '',
isHaveLine: false,
isHaveDirection: true,
action: () {
- Get.toNamed(Routers.checkingInSetHolidaysPage, arguments: {
- "companyId": state.companyId.value
+ Get.toNamed(Routers.checkingInSetHolidaysPage, arguments: {
+ 'companyId': state.companyId.value
});
}),
SizedBox(
@@ -117,14 +118,14 @@ class _CheckingInSetPageState extends State {
visible: state.getKeyInfosData.value.isLockOwner == 1,
child: SubmitBtn(
btnName:
- "${TranslationLoader.lanKeys!.delete!.tr} ${TranslationLoader.lanKeys!.company!.tr}",
+ '${TranslationLoader.lanKeys!.delete!.tr} ${TranslationLoader.lanKeys!.company!.tr}',
borderRadius: 20.w,
fontSize: 32.sp,
isDelete: true,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () {
- ShowTipView().showIosTipWithContentDialog("是否删除?".tr, () {
+ ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, () {
logic.deletCompanyData();
});
// showDeletCompanyAlertDialog(context);
@@ -140,12 +141,19 @@ class _CheckingInSetPageState extends State {
context: context,
builder: (BuildContext context) {
return ShowTFView(
- title: "修改公司名字".tr,
- tipTitle: "",
+ title: '修改公司名字'.tr,
+ tipTitle: '',
controller: state.changeNameController,
+ inputFormatters: [
+ LengthLimitingTextInputFormatter(30),
+ ],
sureClick: () {
if(state.changeNameController.text.isEmpty){
- logic.showToast("请输入公司名字".tr);
+ logic.showToast('请输入公司名字'.tr);
+ return;
+ }
+ if(state.changeNameController.text.length <6){
+ logic.showToast('公司名字长度不能小于 6 '.tr);
return;
}
Get.back();
@@ -159,7 +167,7 @@ class _CheckingInSetPageState extends State {
// 接受者信息输入框
Widget getTFWidget() {
- state.nameController.text = state.companyName.value ?? "";
+ state.nameController.text = state.companyName.value ?? '';
return Container(
// color: Colors.red,
height: 65.h,
@@ -168,7 +176,7 @@ class _CheckingInSetPageState extends State {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
- children: [
+ children: [
Expanded(
child: TextField(
//输入框一行
diff --git a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart
index 476e3c51..89b334f6 100755
--- a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart
@@ -6,28 +6,28 @@ import '../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInSet_entity.dart';
class CheckingInSetState{
- final getKeyInfosData = LockListInfoItemEntity().obs;
- final companyId = "".obs;
+ CheckingInSetState() {
+ Map map = Get.arguments;
+ getKeyInfosData.value = map['getKeyInfosData'];
+ }
+ final Rx getKeyInfosData = LockListInfoItemEntity().obs;
+ final RxString companyId = ''.obs;
- var isCustom = false.obs;
+ RxBool isCustom = false.obs;
- var weekDays = [].obs;// 工作天数
- var weekDaysStr = "".obs;// 拼接显示的字符串天数
+ RxList weekDays = [].obs;// 工作天数
+ RxString weekDaysStr = ''.obs;// 拼接显示的字符串天数
- var beginTime = "".obs;// 开始时间
- var endTime = "".obs;// 结束时间
- var beginTimeTimestamp = "".obs;// 开始时间时间戳
- var endTimeTimestamp = "".obs;// 结束时间时间戳
+ RxString beginTime = ''.obs;// 开始时间
+ RxString endTime = ''.obs;// 结束时间
+ RxString beginTimeTimestamp = ''.obs;// 开始时间时间戳
+ RxString endTimeTimestamp = ''.obs;// 结束时间时间戳
- var staffNumber = "".obs;// 员工数量
- var companyName = "".obs;// 公司名称
+ RxString staffNumber = ''.obs;// 员工数量
+ RxString companyName = ''.obs;// 公司名称
final TextEditingController changeNameController = TextEditingController();
final TextEditingController nameController = TextEditingController();
- final checkingInSetInfo = CheckingInSetInfo().obs;
- CheckingInSetState() {
- Map map = Get.arguments;
- getKeyInfosData.value = map["getKeyInfosData"];
- }
+ final Rx checkingInSetInfo = CheckingInSetInfo().obs;
}
\ No newline at end of file
diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart
index ab08598e..6f21bf4e 100755
--- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart
@@ -4,6 +4,8 @@ import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
+import 'package:star_lock/login/login/entity/LoginEntity.dart';
+import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/eventBusEventManage.dart';
@@ -23,30 +25,30 @@ class CheckingInAddStaffLogic extends BaseGetXController {
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
_getNumberEvent = eventBus
.on()
- .listen((event) {
+ .listen((ChickInAddStaffCardAndFingerprintBlockNumberEvent event) {
state.attendanceWayNumber.value = event.number;
isCanClickAction();
});
}
// 添加员工
- void addStaffLoadData() async {
- var usernameType = "1";
- if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
- usernameType = "2";
+ Future addStaffLoadData() async {
+ String usernameType = '1';
+ if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
+ usernameType = '2';
}
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
if (state.appUnHaveAccount.value &&
- state.selectPrintingMethodType.value == "1") {
+ state.selectPrintingMethodType.value == '1') {
state.attendanceWayNumber.value = state.staffAccountController.text;
}
- var entity = await ApiRepository.to.addStaffData(
+ final LoginEntity entity = await ApiRepository.to.addStaffData(
attendanceType: state.selectPrintingMethodType.value,
attendanceWay: state.attendanceWayNumber.value,
companyId: state.companyId.value,
- have: state.appUnHaveAccount.value ? "2" : "1",
+ have: state.appUnHaveAccount.value ? '2' : '1',
staffName: state.staffNameController.text,
countryCode: state.countryCode.value,
usernameType: usernameType,
@@ -54,7 +56,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshCheckInSetDataEvent());
eventBus.fire(RefreshCheckInListEvent());
- Get.back(result: "addScuess");
+ Get.back(result: 'addScuess');
} else if (entity.errorCode! == 425) {
showToast(entity.errorMsg!);
}
@@ -62,8 +64,9 @@ class CheckingInAddStaffLogic extends BaseGetXController {
// 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,
// attendanceWay分别为用户名、密码、卡号、指纹号
- void addStaffSelectKey(KeyClickCallback kyClickCallback) async {
- var entity = await ApiRepository.to.addStaffSelectKeyData(
+ Future addStaffSelectKey(KeyClickCallback kyClickCallback) async {
+ final CheckingInAddStaffSelectKeyEntity entity =
+ await ApiRepository.to.addStaffSelectKeyData(
companyId: state.companyId.value,
type: state.selectPrintingMethodType.value,
);
@@ -74,18 +77,17 @@ class CheckingInAddStaffLogic extends BaseGetXController {
}
// 编辑员工
- void editStaffLoadData() async {
- var usernameType = "1";
- if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
- usernameType = "2";
+ Future editStaffLoadData() async {
+ String usernameType = '1';
+ if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
+ usernameType = '2';
}
-
- var entity = await ApiRepository.to.editStaffData(
+ final LoginEntity entity = await ApiRepository.to.editStaffData(
attendanceType: state.selectPrintingMethodType.value,
attendanceWay: state.attendanceWayNumber.value,
staffId: state.staffListItemData.value.staffId.toString(),
- have: state.appUnHaveAccount.value ? "2" : "1",
+ have: state.appUnHaveAccount.value ? '2' : '1',
staffName: state.staffNameController.text,
countryCode: state.countryCode.value,
usernameType: usernameType,
@@ -99,13 +101,13 @@ class CheckingInAddStaffLogic extends BaseGetXController {
}
//获取密码请求
- void getKeyboardPwdRequest() async {
+ Future getKeyboardPwdRequest() async {
if (state.staffNameController.text.isEmpty) {
- showToast("请输入姓名");
+ showToast('请输入姓名');
return;
}
- var entity = await ApiRepository.to.getPasswordKey(
- endDate: "0",
+ final PasswordKeyEntity entity = await ApiRepository.to.getPasswordKey(
+ endDate: '0',
keyboardPwdName: state.staffNameController.text,
keyboardPwdType: 2.toString(),
lockId: state.getKeyInfosData.value.lockId.toString(),
@@ -136,7 +138,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
// 是否能点击
void isCanClickAction() {
- if (state.selectPrintingMethodType.value == "1" &&
+ if (state.selectPrintingMethodType.value == '1' &&
state.appUnHaveAccount.value) {
// 没有账号的时候直接判断姓名和账号是否为空
state.isCanClick.value =
@@ -154,6 +156,8 @@ class CheckingInAddStaffLogic extends BaseGetXController {
_initLoadDataAction();
changeInput(state.staffNameController);
+
+
}
@override
diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart
index 9a03705f..e8aee62b 100755
--- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart
@@ -1,9 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSelectKey_entity.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart';
+import 'package:star_lock/tools/commonDataManage.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
@@ -44,7 +46,7 @@ class _CheckingInAddStaffPageState extends State {
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
- "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}",
+ '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}',
state.staffNameController)),
// 选择打卡方式
Obx(() => CommonItem(
@@ -59,10 +61,13 @@ class _CheckingInAddStaffPageState extends State {
'卡'.tr,
'指纹'.tr
];
- if (state.getKeyInfosData.value.lockName!.contains('T9A')) {
+
+ // if (state.getKeyInfosData.value.lockName!.contains('T9A')) {
+ if (CommonDataManage().currentKeyInfo.lockFeature?.d3Face ==
+ 1) {
list.add('人脸'.tr);
}
- _showSelectClockInType(list, list, '1', '选择钥匙'.tr);
+ _showSelectClockInType(list, list, list, '1', '选择钥匙'.tr);
})),
SizedBox(height: 10.h),
//员工是否有App、卡、钥匙、指纹必须显示
@@ -96,10 +101,8 @@ class _CheckingInAddStaffPageState extends State {
))),
// 当选择App时且没有钥匙的时候 显示输入账号输入框和选择国家 其他隐藏
Obx(() => Visibility(
- visible: (state.appUnHaveAccount.value &&
- state.selectPrintingMethodType.value == '1')
- ? true
- : false,
+ visible: state.appUnHaveAccount.value &&
+ state.selectPrintingMethodType.value == '1',
child: Column(
children: [
CommonItem(
@@ -166,7 +169,7 @@ class _CheckingInAddStaffPageState extends State {
return;
}
- final data = await Get.toNamed(
+ final dynamic data = await Get.toNamed(
Routers.addCardPage,
arguments: {
'lockId':
@@ -228,9 +231,14 @@ class _CheckingInAddStaffPageState extends State {
// 当选择钥匙类型为有时 必显示
Obx(() {
final bool isPass = state.selectPrintingMethodType.value == '2';
- String rightTitle = state.attendanceWayNumber.value;
+ String attendanceWayNumber = state.attendanceWayNumber.value;
+ final String attendanceWayName = state.attendanceWayName.value;
if (isPass) {
- rightTitle = showPass(rightTitle);
+ attendanceWayNumber = showPass(attendanceWayNumber);
+ }
+ String rightTitle = attendanceWayNumber;
+ if (attendanceWayName.trim() != '') {
+ rightTitle = '$attendanceWayName - ' + rightTitle;
}
return Visibility(
visible: !state.appUnHaveAccount.value,
@@ -243,6 +251,7 @@ class _CheckingInAddStaffPageState extends State {
logic.addStaffSelectKey(
(List v) {
final List showList = [];
+ final List nameList = [];
final List numberList = [];
for (final CheckingInAddStaffKeyEntity element in v) {
final bool isPass =
@@ -252,12 +261,13 @@ class _CheckingInAddStaffPageState extends State {
attendanceWay = showPass(attendanceWay);
}
final String text =
- '${element.staffName}-$attendanceWay';
+ '${element.staffName} - $attendanceWay';
showList.add(text);
numberList.add(element.attendanceWay ?? '');
+ nameList.add(element.staffName ?? '');
}
- _showSelectClockInType(showList, numberList, '2',
- addStaffSelectKeySelectClockInType());
+ _showSelectClockInType(showList, numberList, nameList,
+ '2', addStaffSelectKeySelectClockInType());
});
}),
);
@@ -344,8 +354,8 @@ class _CheckingInAddStaffPageState extends State {
}
// type 1 打卡方式 2选择钥匙
- void _showSelectClockInType(List showList, List numberList,
- String showBottomSheetToolType, String title) {
+ void _showSelectClockInType(List showList, List numberList,
+ List nameList, String showBottomSheetToolType, String title) {
ShowBottomSheetTool().showSingleRowPicker(
//上下文
context,
@@ -364,8 +374,10 @@ class _CheckingInAddStaffPageState extends State {
if (showBottomSheetToolType == '1') {
state.selectPrintingMethodType.value = (index + 1).toString();
state.selectPrintingMethodStr.value = str.toString();
+ state.attendanceWayName.value = '';
state.attendanceWayNumber.value = '';
} else {
+ state.attendanceWayName.value = nameList[index].toString();
state.attendanceWayNumber.value = numberList[index].toString();
}
logic.isCanClickAction();
diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart
index 10f58706..1a939a7a 100755
--- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart
@@ -6,59 +6,34 @@ import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
import 'checkingInAddStaffSelectKey_entity.dart';
class CheckingInAddStaffState {
- final getKeyInfosData = LockListInfoItemEntity().obs;
- final companyId = "".obs;
- final staffListItemData = CheckingInAddStaffListItemEntity().obs;
-
- final TextEditingController staffNameController = TextEditingController();
- final TextEditingController staffAccountController = TextEditingController();
-
- final selectPrintingMethodType = "1".obs; // 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸
- final selectPrintingMethodStr = "APP".obs; // 选择打卡类型字符串
-
- final countryName = "中国".tr.obs;
- final countryCode = "86".obs;
-
- final appUnHaveAccount = true.obs; // 默认没有账号
- final keyEntity = [].obs; // 选择钥匙数据
-
- final isAdd = "1".obs; // 1添加 2编辑
- final attendanceWayNumber = "".obs;
- final isCanClick = false.obs;
- var staffName = ''.obs;
- var staffAccount = ''.obs;
-
- bool get staffNameIsNotEmpty => staffName.value.isNotEmpty;
-
- bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty;
-
- bool get attendanceWayNumberIsNotEmpty =>
- attendanceWayNumber.value.isNotEmpty;
CheckingInAddStaffState() {
- Map map = Get.arguments;
- getKeyInfosData.value = map["getKeyInfosData"];
- companyId.value = map["companyId"];
+ final Map map = Get.arguments;
+ getKeyInfosData.value = map['getKeyInfosData'];
+ companyId.value = map['companyId'];
- isAdd.value = map["isAdd"];
- if (isAdd.value == "2") {
- staffListItemData.value = map["staffListItem"];
+ isAdd.value = map['isAdd'];
+ if (isAdd.value == '2') {
+ staffListItemData.value = map['staffListItem'];
staffNameController.text = staffListItemData.value.staffName!;
selectPrintingMethodType.value =
staffListItemData.value.attendanceType.toString();
switch (staffListItemData.value.attendanceType) {
case 1:
- selectPrintingMethodStr.value = "APP";
+ selectPrintingMethodStr.value = 'APP';
break;
case 2:
- selectPrintingMethodStr.value = "密码".tr;
+ selectPrintingMethodStr.value = '密码'.tr;
break;
case 3:
- selectPrintingMethodStr.value = "卡".tr;
+ selectPrintingMethodStr.value = '卡'.tr;
break;
case 4:
- selectPrintingMethodStr.value = "指纹".tr;
+ selectPrintingMethodStr.value = '指纹'.tr;
+ break;
+ case 5:
+ selectPrintingMethodStr.value = '人脸'.tr;
break;
}
@@ -70,4 +45,37 @@ class CheckingInAddStaffState {
}
}
}
+ final Rx getKeyInfosData =
+ LockListInfoItemEntity().obs;
+ final RxString companyId = ''.obs;
+ final Rx staffListItemData =
+ CheckingInAddStaffListItemEntity().obs;
+
+ final TextEditingController staffNameController = TextEditingController();
+ final TextEditingController staffAccountController = TextEditingController();
+
+ final RxString selectPrintingMethodType =
+ '1'.obs; // 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸
+ final RxString selectPrintingMethodStr = 'APP'.obs; // 选择打卡类型字符串
+
+ final RxString countryName = '中国'.tr.obs;
+ final RxString countryCode = '86'.obs;
+
+ final RxBool appUnHaveAccount = true.obs; // 默认没有账号
+ final RxList keyEntity =
+ [].obs; // 选择钥匙数据
+
+ final RxString isAdd = '1'.obs; // 1添加 2编辑
+ final RxString attendanceWayName = ''.obs;
+ final RxString attendanceWayNumber = ''.obs;
+ final RxBool isCanClick = false.obs;
+ RxString staffName = ''.obs;
+ RxString staffAccount = ''.obs;
+
+ bool get staffNameIsNotEmpty => staffName.value.isNotEmpty;
+
+ bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty;
+
+ bool get attendanceWayNumberIsNotEmpty =>
+ attendanceWayNumber.value.isNotEmpty;
}
diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart
index c3d189b7..2b0e1afe 100755
--- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart
+++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
+import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_state.dart';
import 'package:star_lock/tools/showTipView.dart';
import '../../../../../appRouters.dart';
@@ -23,8 +24,10 @@ class CheckingInStaffListPage extends StatefulWidget {
}
class _CheckingInStaffListPageState extends State {
- final logic = Get.put(CheckingInStaffManageLogic());
- final state = Get.find().state;
+ final CheckingInStaffManageLogic logic =
+ Get.put(CheckingInStaffManageLogic());
+ final CheckingInStaffManageState state =
+ Get.find().state;
@override
Widget build(BuildContext context) {
@@ -34,15 +37,17 @@ class _CheckingInStaffListPageState extends State {
barTitle: TranslationLoader.lanKeys!.staff!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
- actionsList: [
+ actionsList: [
GestureDetector(
onTap: () async {
- var data = await Get.toNamed(Routers.checkingInAddStaffPage, arguments: {
- "getKeyInfosData": state.getKeyInfosData.value,
- "companyId": state.companyId.value,
- "isAdd": "1",
- });
- if(data != null) {
+ final dynamic data = await Get.toNamed(
+ Routers.checkingInAddStaffPage,
+ arguments: {
+ 'getKeyInfosData': state.getKeyInfosData.value,
+ 'companyId': state.companyId.value,
+ 'isAdd': '1',
+ });
+ if (data != null) {
logic.getStaffList();
}
},
@@ -58,65 +63,76 @@ class _CheckingInStaffListPageState extends State {
),
body: Container(
color: Colors.white,
- child: Obx(() => state.staffListData.value.isNotEmpty ?
- SlidableAutoCloseBehavior(
- child: ListView.separated(
- itemCount: state.staffListData.value.length,
- itemBuilder: (c, index) {
- CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
- return Slidable(
- key:ValueKey(staffListItem.staffId),
- endActionPane: ActionPane(
- extentRatio: 0.2,
- motion: const ScrollMotion(),
- children: [
- SlidableAction(
- onPressed: (BuildContext context){
- // 1APP 2密码 3卡 4指纹 5人脸
- if(staffListItem.attendanceType == 1){
- ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (isAllData) {
- logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0));
- });
- }else{
- ShowTipView().showIosTipWithContentDialog("确定要删除员工吗?".tr, () {
- logic.deletStaff(staffListItem.staffId!, 0);
- });
- // showIosTipViewDialog(staffListItem.staffId!, context);
- }
- },
- backgroundColor: Colors.red,
- foregroundColor: Colors.white,
- label: '删除'.tr,
- padding: EdgeInsets.only(left: 5.w, right: 5.w),
- ),
- ],
+ child: Obx(() => state.staffListData.isNotEmpty
+ ? SlidableAutoCloseBehavior(
+ child: ListView.separated(
+ itemCount: state.staffListData.length,
+ itemBuilder: (BuildContext c, int index) {
+ final CheckingInAddStaffListItemEntity staffListItem =
+ state.staffListData[index];
+ return Slidable(
+ key: ValueKey(staffListItem.staffId),
+ endActionPane: ActionPane(
+ extentRatio: 0.2,
+ motion: const ScrollMotion(),
+ children: [
+ SlidableAction(
+ onPressed: (BuildContext context) {
+ // 1APP 2密码 3卡 4指纹 5人脸
+ if (staffListItem.attendanceType == 1) {
+ ShowTipView()
+ .showDeleteAdministratorIsHaveAllDataDialog(
+ '同时删除员工钥匙'.tr, (bool isAllData) {
+ logic.deletStaff(staffListItem.staffId!,
+ (isAllData ? 1 : 0));
+ });
+ } else {
+ ShowTipView().showIosTipWithContentDialog(
+ '确定要删除员工吗?'.tr, () {
+ logic.deletStaff(staffListItem.staffId!, 0);
+ });
+ // showIosTipViewDialog(staffListItem.staffId!, context);
+ }
+ },
+ backgroundColor: Colors.red,
+ foregroundColor: Colors.white,
+ label: '删除'.tr,
+ padding: EdgeInsets.only(left: 5.w, right: 5.w),
+ ),
+ ],
+ ),
+ child: _checkingInStaffManageItem(staffListItem, () {
+ Get.toNamed(Routers.checkingInStaffDetailPage,
+ arguments: {
+ 'staffListItem': staffListItem,
+ 'getKeyInfosData': state.getKeyInfosData.value,
+ 'companyId': state.companyId.value,
+ });
+ }),
+ );
+
+ // return _checkingInStaffManageItem(staffListItem, () {
+ // Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
+ // "staffListItem": staffListItem,
+ // "getKeyInfosData": state.getKeyInfosData.value,
+ // "companyId": state.companyId.value,
+ // });
+ // });
+ },
+ separatorBuilder: (BuildContext context, int index) {
+ return Divider(
+ height: 1.h,
+ indent: 20.w,
+ color: AppColors.greyLineColor);
+ },
),
- child: _checkingInStaffManageItem(staffListItem, () {
- Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
- "staffListItem": staffListItem,
- "getKeyInfosData": state.getKeyInfosData.value,
- "companyId": state.companyId.value,
- });
- }),
- );
-
- // return _checkingInStaffManageItem(staffListItem, () {
- // Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
- // "staffListItem": staffListItem,
- // "getKeyInfosData": state.getKeyInfosData.value,
- // "companyId": state.companyId.value,
- // });
- // });
- },
- separatorBuilder: (context, index) {
- return Divider(height: 1.h, indent: 20.w, color: AppColors.greyLineColor);
- },
- ),
- ) : NoData()),
+ )
+ : NoData()),
));
}
- Widget _checkingInStaffManageItem(CheckingInAddStaffListItemEntity staffListItem, Function() action) {
+ Widget _checkingInStaffManageItem(
+ CheckingInAddStaffListItemEntity staffListItem, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
@@ -125,35 +141,41 @@ class _CheckingInStaffListPageState extends State {
color: Colors.white,
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
child: Row(
- children: [
- SizedBox(width: 20.w,),
+ children: [
+ SizedBox(
+ width: 20.w,
+ ),
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
- Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w),
- SizedBox(width: 20.w,),
+ Image.asset(getTypeIcon(staffListItem.attendanceType!),
+ width: 60.w, height: 60.w),
+ SizedBox(
+ width: 20.w,
+ ),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
- children: [
+ children: [
SizedBox(
width: 1.sw - 20.w - 60.w - 20.w - 30.w,
child: Text(staffListItem.staffName!,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
- style: TextStyle(fontSize: 24.sp)
- )
- ),
+ style: TextStyle(fontSize: 24.sp))),
Visibility(
- visible: staffListItem.cardStatus == 1 ? true : false,
- child: SizedBox(height: 5.h,)
- ),
+ visible: staffListItem.cardStatus == 1,
+ child: SizedBox(
+ height: 5.h,
+ )),
Visibility(
- visible: staffListItem.cardStatus == 1 ? true : false,
+ visible: staffListItem.cardStatus == 1,
child: 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)),
+ child: Text('打卡方式无效'.tr,
+ style: TextStyle(
+ fontSize: 18.sp, color: AppColors.appBarIconColor)),
),
),
],
@@ -169,19 +191,19 @@ class _CheckingInStaffListPageState extends State {
String title = 'images/controls_user.png';
switch (type) {
case 1:
- // 蓝牙开锁
+ // 蓝牙开锁
title = 'images/controls_user.png';
break;
case 2:
- // 密码开锁
+ // 密码开锁
title = 'images/icon_password.png';
break;
case 3:
- // ic卡
+ // ic卡
title = 'images/icon_card.png';
break;
case 4:
- // 指纹开锁
+ // 指纹开锁
title = 'images/icon_fingerprint.png';
break;
default:
@@ -190,23 +212,22 @@ class _CheckingInStaffListPageState extends State {
return title;
}
- // void showIosTipViewDialog(int staffId, BuildContext context) {
- // showDialog(
- // context: context,
- // builder: (BuildContext context) {
- // return ShowIosTipView(
- // title: "提示",
- // tipTitle: "确定要删除员工吗?",
- // sureClick: () async {
- // Get.back();
- // logic.deletStaff(staffId, 0);
- // },
- // cancelClick: () {
- // Get.back();
- // },
- // );
- // },
- // );
- // }
-
+// void showIosTipViewDialog(int staffId, BuildContext context) {
+// showDialog(
+// context: context,
+// builder: (BuildContext context) {
+// return ShowIosTipView(
+// title: "提示",
+// tipTitle: "确定要删除员工吗?",
+// sureClick: () async {
+// Get.back();
+// logic.deletStaff(staffId, 0);
+// },
+// cancelClick: () {
+// Get.back();
+// },
+// );
+// },
+// );
+// }
}
diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart
index 0ecca01f..33a21cd5 100755
--- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart
+++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart
@@ -1,4 +1,3 @@
-
import 'dart:async';
import 'package:flutter/scheduler.dart';
@@ -7,6 +6,8 @@ import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
+import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
+import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import 'package:star_lock/widget/permission/permission_dialog.dart';
@@ -35,7 +36,7 @@ class LockDetailLogic extends BaseGetXController {
// 监听设备返回的数据
void initReplySubscription() {
state.replySubscription =
- EventBusManager().eventBus!.on().listen((reply) async {
+ EventBusManager().eventBus!.on().listen((Reply reply) async {
// 开门
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
_replyOpenLock(reply);
@@ -51,7 +52,7 @@ class LockDetailLogic extends BaseGetXController {
// 开门数据解析
Future _replyOpenLock(Reply reply) async {
- int status = reply.data[6];
+ final int status = reply.data[6];
switch (status) {
case 0x00:
@@ -62,19 +63,20 @@ class LockDetailLogic extends BaseGetXController {
state.iSClosedUnlockSuccessfulPopup.value = true;
state.closedUnlockSuccessfulTimer?.cancel();
// 如果没有点击关闭弹窗,3秒后自动关闭
- state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (timer) {
+ state.closedUnlockSuccessfulTimer =
+ Timer.periodic(3.seconds, (Timer timer) {
state.iSClosedUnlockSuccessfulPopup.value = false;
timer.cancel();
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
// 电量
- int power = reply.data[7];
+ final int power = reply.data[7];
state.electricQuantity.value = power;
// 备用电量
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
- int powerStandby = reply.data[9];
+ final int powerStandby = reply.data[9];
state.electricQuantityStandby.value = powerStandby;
}
// 更新电量
@@ -85,14 +87,17 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x06:
//无权限
- var privateKey = await Storage.getStringList(saveBluePrivateKey);
- List getPrivateKeyList = changeStringListToIntList(privateKey!);
+ final List? privateKey =
+ await Storage.getStringList(saveBluePrivateKey);
+ final List getPrivateKeyList =
+ changeStringListToIntList(privateKey!);
- var signKey = await Storage.getStringList(saveBlueSignKey);
- List signKeyDataList = changeStringListToIntList(signKey!);
+ final List? signKey =
+ await Storage.getStringList(saveBlueSignKey);
+ final List signKeyDataList = changeStringListToIntList(signKey!);
- var tokenData = reply.data.sublist(2, 6);
- var saveStrList = changeIntListToStringList(tokenData);
+ final List tokenData = reply.data.sublist(2, 6);
+ final List saveStrList = changeIntListToStringList(tokenData);
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderOpenLock(
@@ -110,7 +115,7 @@ class LockDetailLogic extends BaseGetXController {
case 0x16:
// 正在开锁中...
resetOpenDoorState();
- showToast("正在开锁中...".tr, something: () {
+ showToast('正在开锁中...'.tr, something: () {
cancelBlueConnetctToastTimer();
});
break;
@@ -132,7 +137,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0a:
// 钥匙不存在
- showToast("钥匙不存在");
+ showToast('钥匙不存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@@ -140,7 +145,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0c:
// 钥匙数量已到上限
- showToast("钥匙数量已到上限");
+ showToast('钥匙数量已到上限');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@@ -148,7 +153,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0e:
// 钥匙已存在
- showToast("钥匙已存在");
+ showToast('钥匙已存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@@ -156,7 +161,7 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x0f:
// 用户已存在
- showToast("用户已存在");
+ showToast('用户已存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@@ -164,7 +169,7 @@ class LockDetailLogic extends BaseGetXController {
break;
default:
//失败
- AppLog.log("开锁失败");
+ AppLog.log('开锁失败');
// state.animationController!.stop();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
@@ -183,11 +188,11 @@ class LockDetailLogic extends BaseGetXController {
// 根据时间查解析数据
Future _replyReferEventRecordTime(Reply reply) async {
- int status = reply.data[2];
+ final int status = reply.data[2];
switch (status) {
case 0x00:
//成功
- int dataLength = (reply.data[5] << 8) + reply.data[6];
+ final int dataLength = (reply.data[5] << 8) + reply.data[6];
// AppLog.log("dataLength:$dataLength");
if (dataLength > 0) {
reply.data.removeRange(0, 7);
@@ -195,32 +200,32 @@ class LockDetailLogic extends BaseGetXController {
if (reply.data.length < 17) {
return;
}
- var getList = splitList(reply.data, 17);
+ final List> getList = splitList(reply.data, 17);
// AppLog.log("getList:$getList");
- var uploadList = [];
+ final List uploadList = [];
for (int i = 0; i < getList.length; i++) {
- var indexList = getList[i];
+ final List indexList = getList[i];
// AppLog.log("indexList:$indexList");
- var indexMap = {};
- indexMap["type"] = indexList[0].toString();
+ final Map indexMap = {};
+ indexMap['type'] = indexList[0].toString();
int operateDate = 0;
if (indexList[0] == 2) {
- var passwordData = reply.data.sublist(7, 17);
- var password = utf8String(passwordData);
- indexMap["user"] = password.toString();
+ final List passwordData = reply.data.sublist(7, 17);
+ final String password = utf8String(passwordData);
+ indexMap['user'] = password.toString();
} else {
- int userNo = (indexList[1] * 256) + indexList[2];
- indexMap["user"] = userNo.toString();
+ final int userNo = (indexList[1] * 256) + indexList[2];
+ indexMap['user'] = userNo.toString();
}
- indexMap["success"] = "1";
+ indexMap['success'] = '1';
- int time = ((0xff & indexList[(3)]) << 24 |
+ final int time = ((0xff & indexList[(3)]) << 24 |
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
operateDate = time * 1000;
- indexMap["date"] = "$operateDate";
+ indexMap['date'] = '$operateDate';
uploadList.add(indexMap);
if (i == getList.length - 1) {
@@ -256,14 +261,15 @@ class LockDetailLogic extends BaseGetXController {
// BlueManage().stopScan();
BlueManage().disconnect();
});
- var privateKey = await Storage.getStringList(saveBluePrivateKey);
- List getPrivateKeyList = changeStringListToIntList(privateKey!);
+ final List? privateKey =
+ await Storage.getStringList(saveBluePrivateKey);
+ final List getPrivateKeyList = changeStringListToIntList(privateKey!);
- var signKey = await Storage.getStringList(saveBlueSignKey);
- List signKeyDataList = changeStringListToIntList(signKey!);
+ final List? signKey = await Storage.getStringList(saveBlueSignKey);
+ final List signKeyDataList = changeStringListToIntList(signKey!);
- var token = await Storage.getStringList(saveBlueToken);
- List getTokenList = changeStringListToIntList(token!);
+ final List? token = await Storage.getStringList(saveBlueToken);
+ final List getTokenList = changeStringListToIntList(token!);
BlueManage()
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
@@ -303,14 +309,18 @@ class LockDetailLogic extends BaseGetXController {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
- var privateKey = await Storage.getStringList(saveBluePrivateKey);
- List getPrivateKeyList = changeStringListToIntList(privateKey!);
+ final List? privateKey =
+ await Storage.getStringList(saveBluePrivateKey);
+ final List getPrivateKeyList =
+ changeStringListToIntList(privateKey!);
- var token = await Storage.getStringList(saveBlueToken);
- List getTokenList = changeStringListToIntList(token!);
+ final List? token = await Storage.getStringList(saveBlueToken);
+ final List getTokenList = changeStringListToIntList(token!);
- var publicKey = await Storage.getStringList(saveBluePublicKey);
- List getPublicKeyList = changeStringListToIntList(publicKey!);
+ final List? publicKey =
+ await Storage.getStringList(saveBluePublicKey);
+ final List getPublicKeyList =
+ changeStringListToIntList(publicKey!);
IoSenderManage.senderReferEventRecordTimeCommand(
keyID: BlueManage().connectDeviceName,
@@ -329,7 +339,8 @@ class LockDetailLogic extends BaseGetXController {
// 从服务器获取锁的时间 开锁时传入
void getServerDatetime() async {
- var entity = await ApiRepository.to.getServerDatetimeData();
+ final GetServerDatetimeEntity entity =
+ await ApiRepository.to.getServerDatetimeData();
if (entity.errorCode!.codeIsSuccessful) {
state.differentialTime = entity.data!.date! ~/ 1000 -
DateTime.now().millisecondsSinceEpoch ~/ 1000;
@@ -344,17 +355,17 @@ class LockDetailLogic extends BaseGetXController {
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
void getLockNetToken() async {
- LockNetTokenEntity entity = await ApiRepository.to
+ final LockNetTokenEntity entity = await ApiRepository.to
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
state.lockNetToken = entity.data!.token!.toString();
- AppLog.log("从服务器获取联网token:${state.lockNetToken}");
+ AppLog.log('从服务器获取联网token:${state.lockNetToken}');
openDoorAction();
} else {
- showToast("网络访问失败,请检查网络是否正常".tr, something: () {
+ showToast('网络访问失败,请检查网络是否正常'.tr, something: () {
resetOpenDoorState();
cancelBlueConnetctToastTimer();
- state.lockNetToken = "0";
+ state.lockNetToken = '0';
openDoorAction();
});
}
@@ -362,7 +373,7 @@ class LockDetailLogic extends BaseGetXController {
//电量更新请求
Future uploadElectricQuantityRequest() async {
- KeyOperationRecordEntity entity = await ApiRepository.to
+ final KeyOperationRecordEntity entity = await ApiRepository.to
.uploadElectricQuantity(
electricQuantity: state.electricQuantity.value.toString(),
electricQuantityStandby:
@@ -371,15 +382,15 @@ class LockDetailLogic extends BaseGetXController {
isUnShowLoading: true);
if (entity.errorCode!.codeIsSuccessful) {
SchedulerBinding.instance.addPostFrameCallback((_) {
- eventBus.fire(RefreshLockListInfoDataEvent());
+ eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
});
}
}
// 查询锁记录最后时间
void getLockRecordLastUploadDataTime() async {
- LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
- .getLockRecordLastUploadDataTime(
+ final LockOperatingRecordGetLastRecordTimeEntity entity =
+ await ApiRepository.to.getLockRecordLastUploadDataTime(
lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
state.operateDate = entity.data!.operateDate! ~/ 1000;
@@ -388,14 +399,14 @@ class LockDetailLogic extends BaseGetXController {
}
// 操作记录上传
- void lockRecordUploadData(List list) async {
- KeyOperationRecordEntity entity = await ApiRepository.to
+ Future lockRecordUploadData(List list) async {
+ final KeyOperationRecordEntity entity = await ApiRepository.to
.lockRecordUploadData(
lockId: state.keyInfos.value.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) {
// mockNetworkDataRequest();
AppLog.log(
- "state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
+ 'state.keyInfos.value.keyType:${state.keyInfos.value.keyType}');
if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) {
// 单次删除
deletKeyData();
@@ -405,10 +416,11 @@ class LockDetailLogic extends BaseGetXController {
// 普通用户或者授权管理员删除钥匙
void deletKeyData() async {
- var entity = await ApiRepository.to.deleteElectronicKey(
- keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
+ final ElectronicKeyListEntity entity = await ApiRepository.to
+ .deleteElectronicKey(
+ keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
if (entity.errorCode!.codeIsSuccessful) {
- BlueManage().connectDeviceMacAddress = "";
+ BlueManage().connectDeviceMacAddress = '';
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
});
@@ -422,7 +434,7 @@ class LockDetailLogic extends BaseGetXController {
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
eventBus
.on()
- .listen((event) {
+ .listen((LockSetChangeSetRefreshLockDetailWithType event) {
if (event.type == 0) {
// 0考勤
state.isAttendance.value = int.parse(event.setResult);
@@ -433,7 +445,7 @@ class LockDetailLogic extends BaseGetXController {
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.appUnlockOnline =
int.parse(event.setResult);
- state.lockNetToken = ""; // 改变开锁时是否联网状态的时候清空token
+ state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token
} else if (event.type == 2) {
// 2 常开模式
state.isOpenPassageMode.value = int.parse(event.setResult);
@@ -458,7 +470,7 @@ class LockDetailLogic extends BaseGetXController {
}
String getKeyStatusTextAndShow() {
- String text = "";
+ String text = '';
if (state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
@@ -469,7 +481,7 @@ class LockDetailLogic extends BaseGetXController {
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
} else {
text = state.isOpenPassageMode.value == 1
- ? "常开模式启动!长按闭锁".tr
+ ? '常开模式启动!长按闭锁'.tr
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
}
return text;
@@ -477,9 +489,9 @@ class LockDetailLogic extends BaseGetXController {
String getCurrentFormattedTime() {
// 获取当前时间
- DateTime now = DateTime.now();
+ final DateTime now = DateTime.now();
// 格式化日期和时间
- String formattedTime = DateFormat('MM/dd HH:mm').format(now);
+ final String formattedTime = DateFormat('MM/dd HH:mm').format(now);
return formattedTime;
}
diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart
index 451f629f..f179465c 100755
--- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart
+++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart
@@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
+import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart';
import 'package:star_lock/tools/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/showTipView.dart';
@@ -44,8 +45,8 @@ class LockDetailPage extends StatefulWidget {
class _LockDetailPageState extends State
with TickerProviderStateMixin, RouteAware {
// with RouteAware
- final logic = Get.put(LockDetailLogic());
- final state = Get.find().state;
+ final LockDetailLogic logic = Get.put(LockDetailLogic());
+ final LockDetailState state = Get.find().state;
@override
void initState() {
@@ -75,8 +76,9 @@ class _LockDetailPageState extends State
void _initRefreshLockDetailInfoDataEventAction() {
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
- _lockRefreshLockDetailInfoDataEvent =
- eventBus.on().listen((event) {
+ _lockRefreshLockDetailInfoDataEvent = eventBus
+ .on()
+ .listen((RefreshLockDetailInfoDataEvent event) {
setState(() {});
});
}
@@ -114,26 +116,28 @@ class _LockDetailPageState extends State
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
- List publicKeyData =
+ final List publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast();
- var saveStrList = changeIntListToStringList(publicKeyData);
+ final List saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList);
// 私钥
- List privateKeyData =
+ final List privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast();
- var savePrivateKeyList = changeIntListToStringList(privateKeyData);
+ final List savePrivateKeyList =
+ changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey
- List signKeyData =
+ final List signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast();
- var saveSignKeyList = changeIntListToStringList(signKeyData);
+ final List saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
- bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
+ final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
if (!ifHaveKey) {
- var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
+ final List saveTokenList =
+ changeIntListToStringList([0, 0, 0, 0]);
Storage.setStringList(saveBlueToken, saveTokenList);
}
}
@@ -141,7 +145,7 @@ class _LockDetailPageState extends State
@override
Widget build(BuildContext context) {
loadData();
- return F.sw(defaultCall: () => skWidget(), xhjCall: () => xhjWidget());
+ return F.sw(defaultCall: skWidget, xhjCall: xhjWidget);
}
//鑫泓佳布局
@@ -150,9 +154,9 @@ class _LockDetailPageState extends State
backgroundColor: Colors.white,
body: Obx(() {
return Stack(
- children: [
+ children: [
Column(
- children: [
+ children: [
SizedBox(
height: 35.h,
),
@@ -193,7 +197,7 @@ class _LockDetailPageState extends State
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.r),
- boxShadow: [
+ boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
@@ -202,7 +206,7 @@ class _LockDetailPageState extends State
),
]),
child: Row(
- children: [
+ children: [
Image.asset(
img,
width: 32.r,
@@ -236,7 +240,7 @@ class _LockDetailPageState extends State
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
- boxShadow: [
+ boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
@@ -247,19 +251,15 @@ class _LockDetailPageState extends State
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
- children: [
+ children: [
const Spacer(),
GestureDetector(
onTap: state.openDoorBtnisUneable.value == true
- ? () {
- isNeedRealNameAuthThenOpenLock();
- }
+ ? isNeedRealNameAuthThenOpenLock
: null,
onLongPressStart: state.openDoorBtnisUneable.value == true
- ? (details) {
- setState(() {
- startUnLock();
- });
+ ? (LongPressStartDetails details) {
+ setState(startUnLock);
}
: null,
child: Container(
@@ -268,7 +268,7 @@ class _LockDetailPageState extends State
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(100.w),
- boxShadow: [
+ boxShadow: