Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
This commit is contained in:
commit
c971b4ad49
@ -22,7 +22,8 @@
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<!--允许写设备缓存,用于问题排查-->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
|
||||
<!--允许写入扩展存储,用于写入缓存定位数据-->
|
||||
<!--允许读设备日志,用于问题排查-->
|
||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||
|
||||
<!--相机-->
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
@ -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"
|
||||
}
|
||||
|
||||
@ -884,5 +884,6 @@
|
||||
"门铃事件":"门铃事件",
|
||||
"视频事件":"视频事件",
|
||||
"请开启蓝牙":"请开启蓝牙",
|
||||
"请选择有效日":"请选择有效日"
|
||||
"请选择有效日":"请选择有效日",
|
||||
"公司名字长度不能小于 6 ": "公司名字长度不能小于 6 "
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@
|
||||
"身份证号": "身份证号",
|
||||
"请输入真实姓名": "请输入真实姓名",
|
||||
"请输入身份证号": "请输入身份证号",
|
||||
"请输入身份证号和真实姓名":"请输入身份证号和真实姓名",
|
||||
"请输入身份证号和真实姓名": "请输入身份证号和真实姓名",
|
||||
"点击返回设备配对": "点击返回设备配对",
|
||||
"无法连接?尝试升级": "无法连接?尝试升级",
|
||||
"固件升级提示": "固件升级提示",
|
||||
@ -845,14 +845,15 @@
|
||||
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。",
|
||||
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮",
|
||||
"正在尝试闭锁……": "正在尝试闭锁……",
|
||||
"清空记录":"清空记录",
|
||||
"是否要删除操作记录?":"是否要删除操作记录?",
|
||||
"被删除的记录不能恢复":"被删除的记录不能恢复",
|
||||
"全部事件":"全部事件",
|
||||
"开锁事件":"开锁事件",
|
||||
"异常事件":"异常事件",
|
||||
"门铃事件":"门铃事件",
|
||||
"视频事件":"视频事件",
|
||||
"请开启蓝牙":"请开启蓝牙",
|
||||
"请选择有效日":"请选择有效日"
|
||||
"清空记录": "清空记录",
|
||||
"是否要删除操作记录?": "是否要删除操作记录?",
|
||||
"被删除的记录不能恢复": "被删除的记录不能恢复",
|
||||
"全部事件": "全部事件",
|
||||
"开锁事件": "开锁事件",
|
||||
"异常事件": "异常事件",
|
||||
"门铃事件": "门铃事件",
|
||||
"视频事件": "视频事件",
|
||||
"请开启蓝牙": "请开启蓝牙",
|
||||
"请选择有效日": "请选择有效日",
|
||||
"公司名字长度不能小于 6 ": "公司名字长度不能小于 6 "
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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<ScanResult>);
|
||||
|
||||
class BlueManage {
|
||||
final List<ScanResult> scanDevices = [];
|
||||
final List<ScanResult> scanDevices = <ScanResult>[];
|
||||
|
||||
// 用来写入的服务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<EventSendModel>? _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<EventSendModel>()
|
||||
.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<void> 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<dynamic> completer = Completer<dynamic>();
|
||||
var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
// AppLog.log("startScanSingle扫描到的设备:$results");
|
||||
bool isExit = results.any((element) =>
|
||||
final Completer<dynamic> completer = Completer<dynamic>();
|
||||
final StreamSubscription<List<ScanResult>> subscription =
|
||||
FlutterBluePlus.scanResults.listen((List<ScanResult> 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<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack,
|
||||
{List<Guid>? 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<List<ScanResult>> subscription =
|
||||
FlutterBluePlus.scanResults.listen((List<ScanResult> 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<void> 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<ScanResult> devicesList = scanDevices;
|
||||
final List<ScanResult> 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<BluetoothService> 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 = <int>[];
|
||||
List<int> allData = <int>[];
|
||||
|
||||
// 保存上一次的数据,用来判断是否收到重复的数据
|
||||
var lastTimeData = <int>[];
|
||||
List<int> lastTimeData = <int>[];
|
||||
int? dataLen;
|
||||
|
||||
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
|
||||
final subscription = characteristic.onValueReceived.listen((data) {
|
||||
final StreamSubscription<List<int>> subscription =
|
||||
characteristic.onValueReceived.listen((List<int> data) {
|
||||
// AppLog.log("订阅获取的数据:$data");
|
||||
if (data == lastTimeData || data.isEmpty) {
|
||||
return;
|
||||
@ -580,15 +584,15 @@ class BlueManage {
|
||||
|
||||
// 写入
|
||||
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
||||
List<BluetoothService> services =
|
||||
final List<BluetoothService> 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<int> valueList = value;
|
||||
List subData = splitList(valueList, _mtuSize!);
|
||||
final List<int> 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<void> writeNull() async {
|
||||
List<BluetoothService> services =
|
||||
final List<BluetoothService> 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<int> valueList = [1];
|
||||
final List<int> valueList = <int>[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<void> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<void>.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<void> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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<void> 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<Future<void>>(() 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 =
|
||||
|
||||
@ -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<CheckingInAddHolidaysPage> {
|
||||
final logic = Get.put(CheckingInAddHolidaysLogic());
|
||||
final state = Get.find<CheckingInAddHolidaysLogic>().state;
|
||||
final CheckingInAddHolidaysLogic logic =
|
||||
Get.put(CheckingInAddHolidaysLogic());
|
||||
final CheckingInAddHolidaysState state =
|
||||
Get.find<CheckingInAddHolidaysLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,27 +36,31 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
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, <String>[yyyy, '-', mm, '-', dd]);
|
||||
state.beginDate.value = beginDate;
|
||||
Get.back();
|
||||
// Navigator.of(context).pop(true);
|
||||
@ -61,17 +69,20 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
})),
|
||||
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, <String>[yyyy, '-', mm, '-', dd]);
|
||||
state.endDate.value = endDate;
|
||||
Get.back();
|
||||
});
|
||||
@ -85,11 +96,12 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
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, <String>[yyyy, '-', mm, '-', dd]);
|
||||
state.makeUpWorkDate.value = makeUpWorkDate;
|
||||
Get.back();
|
||||
});
|
||||
@ -112,30 +124,26 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
}
|
||||
|
||||
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: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -145,7 +153,7 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'images/icon_round_unSelect.png',
|
||||
width: 40.w,
|
||||
|
||||
@ -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<CheckingInSetHolidaysPage> {
|
||||
final logic = Get.put(CheckingInSetHolidaysLogic());
|
||||
final state = Get.find<CheckingInSetHolidaysLogic>().state;
|
||||
final CheckingInSetHolidaysLogic logic =
|
||||
Get.put(CheckingInSetHolidaysLogic());
|
||||
final CheckingInSetHolidaysState state =
|
||||
Get.find<CheckingInSetHolidaysLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -37,12 +40,14 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
titleWidget: titleWidget(),
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var data = await Get.toNamed(
|
||||
final dynamic data = await Get.toNamed(
|
||||
Routers.checkingInAddHolidaysPage,
|
||||
arguments: {"companyId": state.companyId.value});
|
||||
arguments: <String, String>{
|
||||
'companyId': state.companyId.value
|
||||
});
|
||||
if (data != null) {
|
||||
logic.editStaffLoadData();
|
||||
}
|
||||
@ -58,12 +63,12 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
],
|
||||
),
|
||||
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<CheckingInSetHolidaysPage> {
|
||||
}
|
||||
|
||||
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: <Color>[
|
||||
colorWithMonth(int.parse(
|
||||
holidaysMonthListData.listItem![0].month.toString())),
|
||||
Colors.white
|
||||
],
|
||||
stops: const <double>[0.2, 0.2],
|
||||
),
|
||||
),
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
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<CheckingInSetHolidaysPage> {
|
||||
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: <String, ListItem>{'listItem': listItem});
|
||||
if (data != null) {
|
||||
logic.editStaffLoadData();
|
||||
}
|
||||
@ -123,83 +138,66 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
);
|
||||
}
|
||||
|
||||
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: <Widget>[
|
||||
Text(
|
||||
Characters(lockTypeTitle!).join('\u{200B}'),
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${TranslationLoader.lanKeys!.libertyDay!.tr}:$vacationStartDate - $vacationEndDate',
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
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: <Widget>[
|
||||
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<CheckingInSetHolidaysPage> {
|
||||
// 样式 详见下方样式
|
||||
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<CheckingInSetHolidaysPage> {
|
||||
),
|
||||
),
|
||||
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<CheckingInSetHolidaysPage> {
|
||||
selectDate: PDuration(year: 2023),
|
||||
minDate: PDuration(year: 1900),
|
||||
maxDate: PDuration(year: 2100),
|
||||
onConfirm: (p) {
|
||||
onConfirm: (PDuration p) {
|
||||
state.selectYear.value = p.year!;
|
||||
logic.editStaffLoadData();
|
||||
},
|
||||
|
||||
@ -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<CheckingInListPage> {
|
||||
final logic = Get.put(CheckingInListLogic());
|
||||
final state = Get.find<CheckingInListLogic>().state;
|
||||
final CheckingInListLogic logic = Get.put(CheckingInListLogic());
|
||||
final CheckingInListState state = Get.find<CheckingInListLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -35,26 +37,34 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
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: <Widget>[
|
||||
if (state.getKeyInfosData.value.keyRight == 1)
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
final bool? isDemoMode =
|
||||
await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
Get.toNamed(Routers.checkingInSetPage,
|
||||
arguments: <String, LockListInfoItemEntity>{
|
||||
'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: <Widget>[
|
||||
topInfo(),
|
||||
SizedBox(height: 10.h),
|
||||
middleDayInfo(),
|
||||
@ -70,7 +80,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
// height: 280.h,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(height: 30.h),
|
||||
Obx(() => Container(
|
||||
width: 110.w,
|
||||
@ -80,32 +90,38 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
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: <Widget>[
|
||||
// SizedBox(width: 30.w,),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(width: 20.w,),
|
||||
children: <Widget>[
|
||||
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, <String>[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<CheckingInListPage> {
|
||||
// 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: <Widget>[
|
||||
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, <String>[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<CheckingInListPage> {
|
||||
// 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: <Widget>[
|
||||
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
|
||||
? <String>[mm, '-', dd]
|
||||
: <String>[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: <Widget>[
|
||||
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<CheckingInListPage> {
|
||||
|
||||
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: <Widget>[
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
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: <Widget>[
|
||||
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: <Widget>[
|
||||
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: <String, Object?>{
|
||||
// "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: <String, Object?>{
|
||||
'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: <Widget>[
|
||||
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<CheckingInListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 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: <Widget>[
|
||||
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<String> list = <String>[
|
||||
TranslationLoader.lanKeys!.earlyArrivalList!.tr,
|
||||
TranslationLoader.lanKeys!.lateList!.tr,
|
||||
TranslationLoader.lanKeys!.hardWorkingList!.tr
|
||||
@ -385,39 +517,39 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
//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 '工作时长未出炉';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<CheckingInSetPage> {
|
||||
final logic = Get.put(CheckingInSetLogic());
|
||||
final state = Get.find<CheckingInSetLogic>().state;
|
||||
final CheckingInSetLogic logic = Get.put(CheckingInSetLogic());
|
||||
final CheckingInSetState state = Get.find<CheckingInSetLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -31,17 +32,17 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
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: <Widget>[
|
||||
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<CheckingInSetPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": state.companyId.value
|
||||
Get.toNamed(Routers.checkingInStaffManagePage, arguments: <String, Object>{
|
||||
'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: <String, Object>{
|
||||
// "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<CheckingInSetPage> {
|
||||
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: <String, Object>{
|
||||
'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: <String, String>{
|
||||
'companyId': state.companyId.value
|
||||
});
|
||||
}),
|
||||
SizedBox(
|
||||
@ -117,14 +118,14 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
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<CheckingInSetPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "修改公司名字".tr,
|
||||
tipTitle: "",
|
||||
title: '修改公司名字'.tr,
|
||||
tipTitle: '',
|
||||
controller: state.changeNameController,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
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<CheckingInSetPage> {
|
||||
|
||||
// 接受者信息输入框
|
||||
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<CheckingInSetPage> {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
|
||||
@ -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<LockListInfoItemEntity> getKeyInfosData = LockListInfoItemEntity().obs;
|
||||
final RxString companyId = ''.obs;
|
||||
|
||||
var isCustom = false.obs;
|
||||
RxBool isCustom = false.obs;
|
||||
|
||||
var weekDays = <int>[].obs;// 工作天数
|
||||
var weekDaysStr = "".obs;// 拼接显示的字符串天数
|
||||
RxList<int> weekDays = <int>[].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 = CheckingInSetInfo().obs;
|
||||
}
|
||||
@ -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<ChickInAddStaffCardAndFingerprintBlockNumberEvent>()
|
||||
.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<void> 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<void> 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<void> 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<void> 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
|
||||
|
||||
@ -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<CheckingInAddStaffPage> {
|
||||
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<CheckingInAddStaffPage> {
|
||||
'卡'.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<CheckingInAddStaffPage> {
|
||||
))),
|
||||
// 当选择App时且没有钥匙的时候 显示输入账号输入框和选择国家 其他隐藏
|
||||
Obx(() => Visibility(
|
||||
visible: (state.appUnHaveAccount.value &&
|
||||
state.selectPrintingMethodType.value == '1')
|
||||
? true
|
||||
: false,
|
||||
visible: state.appUnHaveAccount.value &&
|
||||
state.selectPrintingMethodType.value == '1',
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
@ -166,7 +169,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
final data = await Get.toNamed(
|
||||
final dynamic data = await Get.toNamed(
|
||||
Routers.addCardPage,
|
||||
arguments: <String, Object?>{
|
||||
'lockId':
|
||||
@ -228,9 +231,14 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
// 当选择钥匙类型为有时 必显示
|
||||
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<CheckingInAddStaffPage> {
|
||||
logic.addStaffSelectKey(
|
||||
(List<CheckingInAddStaffKeyEntity> v) {
|
||||
final List<String> showList = <String>[];
|
||||
final List<String> nameList = <String>[];
|
||||
final List<String> numberList = <String>[];
|
||||
for (final CheckingInAddStaffKeyEntity element in v) {
|
||||
final bool isPass =
|
||||
@ -252,12 +261,13 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
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<CheckingInAddStaffPage> {
|
||||
}
|
||||
|
||||
// type 1 打卡方式 2选择钥匙
|
||||
void _showSelectClockInType(List showList, List numberList,
|
||||
String showBottomSheetToolType, String title) {
|
||||
void _showSelectClockInType(List<String> showList, List<String> numberList,
|
||||
List<String> nameList, String showBottomSheetToolType, String title) {
|
||||
ShowBottomSheetTool().showSingleRowPicker(
|
||||
//上下文
|
||||
context,
|
||||
@ -364,8 +374,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
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();
|
||||
|
||||
@ -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 = <CheckingInAddStaffKeyEntity>[].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<dynamic, dynamic> 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<LockListInfoItemEntity> getKeyInfosData =
|
||||
LockListInfoItemEntity().obs;
|
||||
final RxString companyId = ''.obs;
|
||||
final Rx<CheckingInAddStaffListItemEntity> 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<CheckingInAddStaffKeyEntity> keyEntity =
|
||||
<CheckingInAddStaffKeyEntity>[].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;
|
||||
}
|
||||
|
||||
@ -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<CheckingInStaffListPage> {
|
||||
final logic = Get.put(CheckingInStaffManageLogic());
|
||||
final state = Get.find<CheckingInStaffManageLogic>().state;
|
||||
final CheckingInStaffManageLogic logic =
|
||||
Get.put(CheckingInStaffManageLogic());
|
||||
final CheckingInStaffManageState state =
|
||||
Get.find<CheckingInStaffManageLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -34,15 +37,17 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
barTitle: TranslationLoader.lanKeys!.staff!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
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: <String, Object>{
|
||||
'getKeyInfosData': state.getKeyInfosData.value,
|
||||
'companyId': state.companyId.value,
|
||||
'isAdd': '1',
|
||||
});
|
||||
if (data != null) {
|
||||
logic.getStaffList();
|
||||
}
|
||||
},
|
||||
@ -58,65 +63,76 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
),
|
||||
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<int?>(staffListItem.staffId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: <Widget>[
|
||||
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: <String, Object>{
|
||||
'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<CheckingInStaffListPage> {
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 20.w,),
|
||||
children: <Widget>[
|
||||
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: <Widget>[
|
||||
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<CheckingInStaffListPage> {
|
||||
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<CheckingInStaffListPage> {
|
||||
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();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -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<Reply>().listen((reply) async {
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// 开门
|
||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||
_replyOpenLock(reply);
|
||||
@ -51,7 +52,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 开门数据解析
|
||||
Future<void> _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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
final List<String>? signKey =
|
||||
await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var tokenData = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(tokenData);
|
||||
final List<int> tokenData = reply.data.sublist(2, 6);
|
||||
final List<String> 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<void> _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<List<int>> 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<int> 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<int> 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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
final List<String>? publicKey =
|
||||
await Storage.getStringList(saveBluePublicKey);
|
||||
final List<int> 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<void> 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<void> 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<LockSetChangeSetRefreshLockDetailWithType>()
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
@ -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<LockDetailPage>
|
||||
with TickerProviderStateMixin, RouteAware {
|
||||
// with RouteAware
|
||||
final logic = Get.put(LockDetailLogic());
|
||||
final state = Get.find<LockDetailLogic>().state;
|
||||
final LockDetailLogic logic = Get.put(LockDetailLogic());
|
||||
final LockDetailState state = Get.find<LockDetailLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -75,8 +76,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
void _initRefreshLockDetailInfoDataEventAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_lockRefreshLockDetailInfoDataEvent =
|
||||
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
||||
_lockRefreshLockDetailInfoDataEvent = eventBus
|
||||
.on<RefreshLockDetailInfoDataEvent>()
|
||||
.listen((RefreshLockDetailInfoDataEvent event) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
@ -114,26 +116,28 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
BlueManage().connectDeviceName =
|
||||
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||
|
||||
List<int> publicKeyData =
|
||||
final List<int> publicKeyData =
|
||||
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||
final List<String> saveStrList = changeIntListToStringList(publicKeyData);
|
||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||
|
||||
// 私钥
|
||||
List<int> privateKeyData =
|
||||
final List<int> privateKeyData =
|
||||
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||
final List<String> savePrivateKeyList =
|
||||
changeIntListToStringList(privateKeyData);
|
||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||
|
||||
// signKey
|
||||
List<int> signKeyData =
|
||||
final List<int> signKeyData =
|
||||
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||
final List<String> 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<String> saveTokenList =
|
||||
changeIntListToStringList(<int>[0, 0, 0, 0]);
|
||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||
}
|
||||
}
|
||||
@ -141,7 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
@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<LockDetailPage>
|
||||
backgroundColor: Colors.white,
|
||||
body: Obx(() {
|
||||
return Stack(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
@ -193,7 +197,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.r),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: const Offset(0, 0),
|
||||
@ -202,7 +206,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
]),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
img,
|
||||
width: 32.r,
|
||||
@ -236,7 +240,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: const Offset(0, 0),
|
||||
@ -247,19 +251,15 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
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<LockDetailPage>
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(100.w),
|
||||
boxShadow: [
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
offset: const Offset(0, 0),
|
||||
@ -279,42 +279,44 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
||||
child: Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: [
|
||||
state.openDoorBtnisUneable.value == false
|
||||
? Icon(
|
||||
Icons.bluetooth_searching,
|
||||
size: 48.r,
|
||||
color: AppColors.mainColor,
|
||||
)
|
||||
: Image.asset(
|
||||
state.isOpenPassageMode.value == 1
|
||||
? 'images/icon_lock_err.png'
|
||||
: 'images/icon_lock_fill.png',
|
||||
width: 38.r,
|
||||
height: 38.r,
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
state.openDoorBtnisUneable.value == false
|
||||
? Positioned(
|
||||
child: Icon(
|
||||
Icons.bluetooth_searching,
|
||||
size: 96.r,
|
||||
),
|
||||
)
|
||||
: state.openLockBtnState.value == 1
|
||||
? xhjBuildRotationTransition(
|
||||
width: 88.r,
|
||||
height: 88.r,
|
||||
)
|
||||
: Positioned(
|
||||
child: Image.asset(
|
||||
'images/icon_circle_dotted.png',
|
||||
width: 88.r,
|
||||
height: 88.r,
|
||||
color: state.isOpenPassageMode.value == 1
|
||||
? Colors.red
|
||||
: AppColors.mainColor,
|
||||
)),
|
||||
children: <Widget>[
|
||||
if (state.openDoorBtnisUneable.value == false)
|
||||
Icon(
|
||||
Icons.bluetooth_searching,
|
||||
size: 48.r,
|
||||
color: AppColors.mainColor,
|
||||
)
|
||||
else
|
||||
Image.asset(
|
||||
state.isOpenPassageMode.value == 1
|
||||
? 'images/icon_lock_err.png'
|
||||
: 'images/icon_lock_fill.png',
|
||||
width: 38.r,
|
||||
height: 38.r,
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
if (state.openDoorBtnisUneable.value == false)
|
||||
Positioned(
|
||||
child: Icon(
|
||||
Icons.bluetooth_searching,
|
||||
size: 96.r,
|
||||
),
|
||||
)
|
||||
else
|
||||
state.openLockBtnState.value == 1
|
||||
? xhjBuildRotationTransition(
|
||||
width: 88.r,
|
||||
height: 88.r,
|
||||
)
|
||||
: Positioned(
|
||||
child: Image.asset(
|
||||
'images/icon_circle_dotted.png',
|
||||
width: 88.r,
|
||||
height: 88.r,
|
||||
color: state.isOpenPassageMode.value == 1
|
||||
? Colors.red
|
||||
: AppColors.mainColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -323,10 +325,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
TranslationLoader
|
||||
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
|
||||
@ -341,16 +343,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text("${state.electricQuantity.value}%",
|
||||
Text('${state.electricQuantity.value}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
@ -368,13 +370,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text("--%",
|
||||
Text('--%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
@ -400,32 +402,30 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
//斯凯布局
|
||||
Widget skWidget() {
|
||||
return ListView(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
visible:
|
||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||
state.keyInfos.value.keyType ==
|
||||
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||
(DateTool().compareTimeGetDaysFromNow(
|
||||
state.keyInfos.value.endDate!) <=
|
||||
15 &&
|
||||
DateTool().compareTimeGetDaysFromNow(
|
||||
state.keyInfos.value.endDate!) >=
|
||||
0) && // 0到30天
|
||||
(state.keyInfos.value.keyStatus ==
|
||||
XSConstantMacro.keyStatusNormalUse ||
|
||||
state.keyInfos.value.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||
)
|
||||
? true
|
||||
: false,
|
||||
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||
state.keyInfos.value.keyType ==
|
||||
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||
(DateTool().compareTimeGetDaysFromNow(
|
||||
state.keyInfos.value.endDate!) <=
|
||||
15 &&
|
||||
DateTool().compareTimeGetDaysFromNow(
|
||||
state.keyInfos.value.endDate!) >=
|
||||
0) && // 0到30天
|
||||
(state.keyInfos.value.keyStatus ==
|
||||
XSConstantMacro.keyStatusNormalUse ||
|
||||
state.keyInfos.value.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||
,
|
||||
child: Container(
|
||||
// height: 30.h,
|
||||
color: const Color(0xFFFBEFD4),
|
||||
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
|
||||
style: TextStyle(
|
||||
@ -434,26 +434,26 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
),
|
||||
),
|
||||
Stack(children: [
|
||||
Stack(children: <Widget>[
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
topWidget(),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Obx(() => buildPageIndicator()),
|
||||
Obx(buildPageIndicator),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
||||
child: PageView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: state.pageController,
|
||||
children: [
|
||||
Obx(() => bottomWidget()),
|
||||
children: <Widget>[
|
||||
Obx(bottomWidget),
|
||||
attachmentWidget(),
|
||||
],
|
||||
),
|
||||
@ -476,7 +476,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
Widget topWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
F.sw(
|
||||
defaultCall: () => SizedBox(height: 50.h),
|
||||
xhjCall: () => Padding(
|
||||
@ -490,7 +490,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
),
|
||||
Stack(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: Text(
|
||||
state.lockAlias.value,
|
||||
@ -504,7 +504,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
Positioned(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
@ -512,7 +512,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
FlavorsImg(
|
||||
child: Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
@ -520,7 +520,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
height: 24.w),
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
Text("${state.electricQuantity.value}%",
|
||||
Text('${state.electricQuantity.value}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
@ -542,7 +542,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
FlavorsImg(
|
||||
child: Image.asset(
|
||||
showElectricIcon(
|
||||
@ -551,7 +551,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
height: 24.w),
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
Text("${state.electricQuantityStandby.value}%",
|
||||
Text('${state.electricQuantityStandby.value}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
@ -580,23 +580,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
color: Colors.white,
|
||||
height: 330.w,
|
||||
child: Stack(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: state.openDoorBtnisUneable.value == true
|
||||
? () {
|
||||
isNeedRealNameAuthThenOpenLock();
|
||||
}
|
||||
? isNeedRealNameAuthThenOpenLock
|
||||
: null,
|
||||
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||
? (details) {
|
||||
setState(() {
|
||||
startUnLock();
|
||||
});
|
||||
? (LongPressStartDetails details) {
|
||||
setState(startUnLock);
|
||||
}
|
||||
: null,
|
||||
child: Stack(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
FlavorsImg(
|
||||
child: Image.asset(
|
||||
state.openDoorBtnisUneable.value == false
|
||||
@ -609,31 +605,32 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// color: AppColors.primaryTopColor,
|
||||
),
|
||||
),
|
||||
state.openDoorBtnisUneable.value == false
|
||||
? Positioned(
|
||||
child: FlavorsImg(
|
||||
if (state.openDoorBtnisUneable.value == false)
|
||||
Positioned(
|
||||
child: FlavorsImg(
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_openLockBtn_grey.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
state.openLockBtnState.value == 1
|
||||
? buildRotationTransition(
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
)
|
||||
: Positioned(
|
||||
child: FlavorsImg(
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_openLockBtn_grey.png',
|
||||
state.isOpenPassageMode.value == 1
|
||||
? 'images/main/icon_main_normallyOpenMode_circle.png'
|
||||
: 'images/main/icon_main_openLockBtn_circle.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
),
|
||||
),
|
||||
)
|
||||
: state.openLockBtnState.value == 1
|
||||
? buildRotationTransition(
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
)
|
||||
: Positioned(
|
||||
child: FlavorsImg(
|
||||
child: Image.asset(
|
||||
state.isOpenPassageMode.value == 1
|
||||
? 'images/main/icon_main_normallyOpenMode_circle.png'
|
||||
: 'images/main/icon_main_openLockBtn_circle.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
),
|
||||
)),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
@ -641,9 +638,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
right: 90.w,
|
||||
bottom: 1,
|
||||
child: Obx(() => Visibility(
|
||||
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1
|
||||
? true
|
||||
: false,
|
||||
visible:
|
||||
state.keyInfos.value.lockSetting!.remoteUnlock == 1,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
ShowCupertinoAlertView().isToRemoteUnLockAlert(
|
||||
@ -672,7 +668,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
logic.getKeyStatusTextAndShow(),
|
||||
style: TextStyle(
|
||||
@ -685,9 +681,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
F.sw(
|
||||
defaultCall: () => adminInfoView(),
|
||||
xhjCall: () => const SizedBox()),
|
||||
F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
@ -707,7 +701,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
mainAxisAlignment:
|
||||
center ? MainAxisAlignment.center : MainAxisAlignment.start,
|
||||
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'images/icon_electronicKey_admin.png',
|
||||
width: 24.w,
|
||||
@ -742,7 +736,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
? AppColors.mainColor
|
||||
: AppColors.btnDisableColor),
|
||||
),
|
||||
if (add) ...[
|
||||
if (add) ...<Widget>[
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
@ -752,7 +746,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
FlavorsImg(
|
||||
child: Image.asset(
|
||||
'images/mine/icon_mine_main_addLock.png',
|
||||
@ -823,7 +817,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
Widget buildPageIndicator() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: List.generate(2, (index) {
|
||||
children: List.generate(2, (int index) {
|
||||
return Container(
|
||||
width: 10.0.w,
|
||||
height: 10.0.w,
|
||||
@ -855,7 +849,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
// 配件配置
|
||||
List<Widget> getAttachmentWidget() {
|
||||
var showWidgetArr = <Widget>[];
|
||||
final List<Widget> showWidgetArr = <Widget>[];
|
||||
// 无线键盘
|
||||
// if (state.isAttendance.value == 1) {
|
||||
// showWidgetArr.add(bottomItem(
|
||||
@ -911,7 +905,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
// 普通用户
|
||||
List<Widget> getNormalWidget() {
|
||||
List<Widget> showWidgetArr = <Widget>[];
|
||||
final List<Widget> showWidgetArr = <Widget>[];
|
||||
// 考勤
|
||||
if (state.isAttendance.value == 1) {
|
||||
showWidgetArr.add(bottomItem(
|
||||
@ -928,15 +922,17 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.doorLockLogPage,
|
||||
arguments: {"keyInfo": state.keyInfos.value});
|
||||
arguments: <String, LockListInfoItemEntity>{
|
||||
'keyInfo': state.keyInfos.value
|
||||
});
|
||||
}));
|
||||
|
||||
// 设置
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
"isOnlyOneData": state.isOnlyOneData
|
||||
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData
|
||||
});
|
||||
}));
|
||||
|
||||
@ -945,7 +941,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
// 授权管理员、超级管理员字段
|
||||
List<Widget> getAllWidget() {
|
||||
var showWidgetArr = <Widget>[];
|
||||
final List<Widget> showWidgetArr = <Widget>[];
|
||||
// 考勤
|
||||
if (state.isAttendance.value == 1) {
|
||||
showWidgetArr.add(bottomItem(
|
||||
@ -971,7 +967,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
TranslationLoader.lanKeys!.password!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.passwordKeyListPage,
|
||||
arguments: {"keyInfo": state.keyInfos.value});
|
||||
arguments: <String, LockListInfoItemEntity>{
|
||||
'keyInfo': state.keyInfos.value
|
||||
});
|
||||
}));
|
||||
|
||||
// ic卡
|
||||
@ -980,8 +978,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
'images/main/icon_main_icCard.png',
|
||||
TranslationLoader.lanKeys!.card!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.cardListPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.cardListPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}));
|
||||
}
|
||||
@ -992,8 +990,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
'images/main/icon_main_fingerprint.png',
|
||||
TranslationLoader.lanKeys!.fingerprint!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.fingerprintListPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.fingerprintListPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}));
|
||||
}
|
||||
@ -1015,8 +1013,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
'images/main/icon_face.png',
|
||||
TranslationLoader.lanKeys!.humanFace!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.faceListPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.faceListPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -1027,8 +1025,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
bottomItem(
|
||||
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
|
||||
() {
|
||||
Get.toNamed(Routers.irisListPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.irisListPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -1039,8 +1037,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
bottomItem(
|
||||
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
|
||||
() {
|
||||
Get.toNamed(Routers.palmListPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.palmListPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -1053,9 +1051,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
'images/main/icon_catEyes.png',
|
||||
TranslationLoader.lanKeys!.monitoring!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
||||
"lockName": state.keyInfos.value.lockName,
|
||||
"isMonitoring": true
|
||||
Get.toNamed(Routers.realTimePicturePage, arguments: <String, Object?>{
|
||||
'lockName': state.keyInfos.value.lockName,
|
||||
'isMonitoring': true
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -1068,11 +1066,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.authorizedAdminListPage,
|
||||
arguments: {"keyInfo": state.keyInfos.value});
|
||||
arguments: <String, LockListInfoItemEntity>{
|
||||
'keyInfo': state.keyInfos.value
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
var endWiddget = <Widget>[];
|
||||
final List<Widget> endWiddget = <Widget>[];
|
||||
endWiddget.add(
|
||||
// 操作记录
|
||||
bottomItem(
|
||||
@ -1082,7 +1082,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// Get.toNamed(Routers.lockOperatingRecordPage,
|
||||
// arguments: {"keyInfo": state.keyInfos.value});
|
||||
Get.toNamed(Routers.doorLockLogPage,
|
||||
arguments: {"keyInfo": state.keyInfos.value});
|
||||
arguments: <String, LockListInfoItemEntity>{
|
||||
'keyInfo': state.keyInfos.value
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
@ -1092,8 +1094,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
'images/main/icon_lockDetail_videoLog.png',
|
||||
TranslationLoader.lanKeys!.videoLog!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.videoLogPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.videoLogPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}));
|
||||
}
|
||||
@ -1103,8 +1105,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
'images/main/icon_lockDetail_messageReminding.png',
|
||||
TranslationLoader.lanKeys!.messageReminding!.tr,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
Get.toNamed(Routers.msgNotificationPage, arguments: <String, int?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -1114,9 +1116,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||
// logic.clickItemBtnAction(10);
|
||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
"isOnlyOneData": state.isOnlyOneData,
|
||||
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -1126,12 +1128,12 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
Widget bottomItem(
|
||||
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
|
||||
Widget child = F.sw(
|
||||
final Widget child = F.sw(
|
||||
defaultCall: () => Container(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 42.w,
|
||||
height: 42.h,
|
||||
@ -1164,7 +1166,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 42.w,
|
||||
height: 42.h,
|
||||
@ -1195,19 +1197,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
onTap: bottomBtnisEable
|
||||
? onClick
|
||||
: () {
|
||||
logic.showToast("请在锁旁边完成第一次开锁".tr);
|
||||
logic.showToast('请在锁旁边完成第一次开锁'.tr);
|
||||
},
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
listeningAnimations() async {
|
||||
await Future.delayed(Duration.zero, () {
|
||||
Future<void> listeningAnimations() async {
|
||||
await Future<void>.delayed(Duration.zero, () {
|
||||
state.animationController = AnimationController(
|
||||
duration: const Duration(seconds: 1), vsync: this);
|
||||
state.animationController!.repeat();
|
||||
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
||||
state.animationController!.addStatusListener((status) {
|
||||
state.animationController!.addStatusListener((AnimationStatus status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
state.animationController!.reset();
|
||||
state.animationController!.forward();
|
||||
@ -1237,7 +1239,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
Widget _unlockSuccessWidget() {
|
||||
return Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
state.iSOpenLock.value == true
|
||||
? 'images/main/unlocked_bg.png'
|
||||
@ -1250,7 +1252,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
left: 55.w,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
state.keyInfos.value.lockAlias!,
|
||||
style: TextStyle(
|
||||
@ -1289,9 +1291,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1303,24 +1305,20 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
|
||||
AliyunRealNameAuthProvider(
|
||||
getLockInfo: state.keyInfos.value,
|
||||
onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) {
|
||||
onCertifyResultWithTime: (bool isSuccess, int getNextAuthTime) {
|
||||
state.nextAuthTime.value = getNextAuthTime;
|
||||
if (isSuccess) {
|
||||
// 认证成功,去开锁
|
||||
setState(() {
|
||||
startOpenLock();
|
||||
});
|
||||
setState(startOpenLock);
|
||||
}
|
||||
})).initAliyunRealNameAuth();
|
||||
}).initAliyunRealNameAuth();
|
||||
} else {
|
||||
//无需认证,直接开锁
|
||||
setState(() {
|
||||
startOpenLock();
|
||||
});
|
||||
setState(startOpenLock);
|
||||
}
|
||||
}
|
||||
|
||||
startOpenLock() {
|
||||
void startOpenLock() {
|
||||
if (state.openLockBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
@ -1329,21 +1327,21 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
state.openLockBtnState.value = 1;
|
||||
state.animationController!.forward();
|
||||
|
||||
AppLog.log("点击开锁");
|
||||
AppLog.log('点击开锁');
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
// 不需要联网
|
||||
state.openDoorModel = 0;
|
||||
AppLog.log("点击开锁 state.openDoorModel = 0 不需要联网");
|
||||
AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
|
||||
logic.openDoorAction();
|
||||
} else {
|
||||
// 需要联网
|
||||
state.openDoorModel = 2;
|
||||
AppLog.log("点击开锁 state.openDoorModel = 2 需要联网");
|
||||
AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
|
||||
logic.getLockNetToken();
|
||||
}
|
||||
}
|
||||
|
||||
startUnLock() {
|
||||
void startUnLock() {
|
||||
if (state.openLockBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
@ -1352,16 +1350,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
state.openLockBtnState.value = 1;
|
||||
state.animationController!.forward();
|
||||
|
||||
EasyLoading.showToast("正在尝试闭锁……".tr, duration: 2000.milliseconds);
|
||||
AppLog.log("长按闭锁");
|
||||
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
|
||||
AppLog.log('长按闭锁');
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
// 不需要联网
|
||||
AppLog.log("长按闭锁 state.openDoorModel = 32 不需要联网");
|
||||
AppLog.log('长按闭锁 state.openDoorModel = 32 不需要联网');
|
||||
state.openDoorModel = 32;
|
||||
logic.openDoorAction();
|
||||
} else {
|
||||
// 需要联网
|
||||
AppLog.log("长按闭锁 state.openDoorModel = 34 需要联网");
|
||||
AppLog.log('长按闭锁 state.openDoorModel = 34 需要联网');
|
||||
state.openDoorModel = 34;
|
||||
logic.getLockNetToken();
|
||||
}
|
||||
|
||||
@ -15,10 +15,11 @@ import 'lockMain_state.dart';
|
||||
class LockMainLogic extends BaseGetXController {
|
||||
final LockMainState state = LockMainState();
|
||||
|
||||
Future<LockListInfoEntity> getStarLockInfo() async {
|
||||
Future<LockListInfoEntity> getStarLockInfo({bool isUnShowLoading = false}) async {
|
||||
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
||||
pageNo: pageNo,
|
||||
pageSize: 50,
|
||||
isUnShowLoading: isUnShowLoading,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
loadMainDataLogic(entity.data!);
|
||||
|
||||
@ -37,14 +37,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
final logic = Get.put(LockMainLogic());
|
||||
final state = Get.find<LockMainLogic>().state;
|
||||
|
||||
Future<void> getHttpData({bool clearScanDevices = false}) async {
|
||||
Future<void> getHttpData(
|
||||
{bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
||||
LockListInfoGroupEntity? lockListInfoGroupEntity =
|
||||
await Storage.getLockMainListData();
|
||||
if (lockListInfoGroupEntity != null) {
|
||||
var localLockListInfoGroupEntity = lockListInfoGroupEntity;
|
||||
await logic.loadMainDataLogic(localLockListInfoGroupEntity);
|
||||
}
|
||||
await logic.getStarLockInfo();
|
||||
await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading);
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
if (clearScanDevices) {
|
||||
BlueManage().scanDevices.clear();
|
||||
@ -237,7 +238,9 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
void _initLoadDataAction() {
|
||||
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
||||
logic.pageNo = 1;
|
||||
getHttpData(clearScanDevices: event.clearScanDevices);
|
||||
getHttpData(
|
||||
clearScanDevices: event.clearScanDevices,
|
||||
isUnShowLoading: event.isUnShowLoading);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ class ApiProvider extends BaseProvider {
|
||||
'idCardNumber': idCardNumber
|
||||
}));
|
||||
|
||||
Future<Response> uploadElectricQuantity(
|
||||
Future<Response<dynamic>> uploadElectricQuantity(
|
||||
String electricQuantity,
|
||||
String electricQuantityStandby,
|
||||
String lockId,
|
||||
@ -374,12 +374,12 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 获取锁信息列表
|
||||
Future<Response> getStarLockListInfo(int pageNo, int pageSize) => post(
|
||||
Future<Response> getStarLockListInfo(int pageNo, int pageSize,{bool isUnShowLoading = true}) => post(
|
||||
getStarLockInfoURL.toUrl,
|
||||
jsonEncode({
|
||||
"pageNo": pageNo,
|
||||
'pageSize': pageSize,
|
||||
}));
|
||||
}),isUnShowLoading: isUnShowLoading);
|
||||
|
||||
// 获取所有锁设置信息
|
||||
Future<Response> getLockSettingInfoData(String lockId) => post(
|
||||
|
||||
@ -37,7 +37,6 @@ class BaseProvider extends GetConnect with Api {
|
||||
}) async {
|
||||
AppLog.log("post: url:$url body:$body");
|
||||
if (isUnShowLoading == false){
|
||||
// AppLog.log("post: url:$url show loading");
|
||||
EasyLoading.show();
|
||||
}
|
||||
if (isUserBaseUrl == false) {
|
||||
|
||||
@ -421,8 +421,8 @@ class ApiRepository {
|
||||
|
||||
// 获取锁信息列表
|
||||
Future<LockListInfoEntity> getStarLockListInfo(
|
||||
{required int pageNo, required int pageSize}) async {
|
||||
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize);
|
||||
{required int pageNo, required int pageSize,required bool isUnShowLoading}) async {
|
||||
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize,isUnShowLoading:isUnShowLoading);
|
||||
return LockListInfoEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
60
lib/tools/bugly/bugly_tool.dart
Normal file
60
lib/tools/bugly/bugly_tool.dart
Normal file
@ -0,0 +1,60 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginData.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
///
|
||||
/// 错误日志监控
|
||||
///
|
||||
///
|
||||
class BuglyTool {
|
||||
static Future<void> init() async {
|
||||
if (F.isProductionEnv) {
|
||||
//生产
|
||||
await FlutterBuglyPlugin.init(
|
||||
appIdAndroid: '73c99cca00',
|
||||
appIdiOS: 'b25632a54f',
|
||||
);
|
||||
} else {
|
||||
//测试
|
||||
await FlutterBuglyPlugin.init(
|
||||
appIdAndroid: '02fb541c1c',
|
||||
appIdiOS: '618ab9feeb',
|
||||
);
|
||||
}
|
||||
|
||||
//关联用户 id
|
||||
final LoginData? loginData = await Storage.getLoginData();
|
||||
setUserId(loginData?.userid);
|
||||
|
||||
//错误日志监控
|
||||
FlutterError.onError = (FlutterErrorDetails details) async {
|
||||
AppLog.log('error:${details.exception.toString()}',
|
||||
stackTrace: details.stack, error: true);
|
||||
FlutterBuglyPlugin.reportException(
|
||||
exceptionName: details.exception.toString(),
|
||||
reason: details.stack.toString());
|
||||
Zone.current.handleUncaughtError(
|
||||
details.exception, details.stack ?? StackTrace.empty);
|
||||
};
|
||||
|
||||
//错误日志监控
|
||||
PlatformDispatcher.instance.onError = (Object error, StackTrace stack) {
|
||||
AppLog.log('error:$error', stackTrace: stack, error: true);
|
||||
FlutterBuglyPlugin.reportException(
|
||||
exceptionName: error.toString(), reason: stack.toString());
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
//关联 userid
|
||||
static void setUserId(int? userId) {
|
||||
FlutterBuglyPlugin.setUserIdentifier(
|
||||
userIdentifier: (userId ?? 0).toString());
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,21 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
|
||||
class CommonItem extends StatelessWidget {
|
||||
CommonItem(
|
||||
{required this.leftTitel,
|
||||
Key? key,
|
||||
this.rightTitle,
|
||||
this.allHeight,
|
||||
this.isHaveDirection = false,
|
||||
this.isHaveLine = false,
|
||||
this.isHaveRightWidget = false,
|
||||
this.isPadding = true,
|
||||
this.setHeight = true,
|
||||
this.rightWidget,
|
||||
this.isTipsImg,
|
||||
this.action,
|
||||
this.tipsImgAction})
|
||||
: super(key: key);
|
||||
String? leftTitel;
|
||||
String? rightTitle;
|
||||
bool? isHaveDirection;
|
||||
@ -12,100 +27,75 @@ class CommonItem extends StatelessWidget {
|
||||
Function()? action;
|
||||
Function()? tipsImgAction;
|
||||
double? allHeight;
|
||||
bool? setHeight;
|
||||
bool? isTipsImg;
|
||||
bool? isPadding;
|
||||
|
||||
CommonItem(
|
||||
{Key? key,
|
||||
required this.leftTitel,
|
||||
this.rightTitle,
|
||||
this.allHeight,
|
||||
this.isHaveDirection = false,
|
||||
this.isHaveLine = false,
|
||||
this.isHaveRightWidget = false,
|
||||
this.isPadding = true,
|
||||
this.rightWidget,
|
||||
this.isTipsImg,
|
||||
this.action,
|
||||
this.tipsImgAction})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: allHeight ?? 65.h,
|
||||
color: Colors.white,
|
||||
padding: isPadding == true ? EdgeInsets.only(left: 20.w, right: 10.w) : EdgeInsets.zero, // , top: 20.w, bottom: 20.w
|
||||
child: Row(
|
||||
children: [
|
||||
// SizedBox(width: 20.w),
|
||||
SizedBox(
|
||||
// width: isHaveRightWidget! ? 100.w : 300.w,
|
||||
child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))),
|
||||
SizedBox(width: 6.w),
|
||||
isTipsImg == true
|
||||
? GestureDetector(
|
||||
onTap: tipsImgAction,
|
||||
child: Container(
|
||||
width: 50.h,
|
||||
height: 50.h,
|
||||
padding: EdgeInsets.only(right:10.h, top: 15.h, bottom: 10.h),
|
||||
child: Image.asset(
|
||||
'images/icon_tips_Q.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
Expanded(child: SizedBox(width: 10.w)),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
isHaveRightWidget!
|
||||
? rightWidget!
|
||||
: SizedBox(
|
||||
// width: rightTitle!.isNotEmpty ? 260.w : 0.1.w,
|
||||
child: Text(
|
||||
rightTitle ?? "",
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
isHaveDirection! ? SizedBox(width: 15.w) : Container(),
|
||||
isHaveDirection!
|
||||
? Image.asset(
|
||||
'images/icon_right_grey.png',
|
||||
width: 12.w,
|
||||
height: 21.w,
|
||||
)
|
||||
: SizedBox(width: 10.w),
|
||||
isHaveDirection! ? SizedBox(width: 5.w) : Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
// isHaveLine!?Container(height: 0.5.h, color: Colors.grey,):Container()
|
||||
//by DaisyWu
|
||||
isHaveLine!
|
||||
? Divider(
|
||||
color: AppColors.greyLineColor,
|
||||
indent: isPadding == true ? 20.w : 0,
|
||||
endIndent: isPadding == true ? 20.w : 0,
|
||||
height: 1,
|
||||
child: Container(
|
||||
height: setHeight == true ? allHeight ?? 65.h : null,
|
||||
padding: isPadding == true
|
||||
? EdgeInsets.only(left: 20.w, right: 10.w)
|
||||
: EdgeInsets.zero,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: isHaveLine!
|
||||
? Border(
|
||||
bottom: BorderSide(
|
||||
color: AppColors.greyLineColor, // 设置边框颜色
|
||||
width: 2.0.h, // 设置边框宽度
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
: null,
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(leftTitel!, style: TextStyle(fontSize: 22.sp)),
|
||||
SizedBox(width: 6.w),
|
||||
if (isTipsImg == true)
|
||||
GestureDetector(
|
||||
onTap: tipsImgAction,
|
||||
child: Container(
|
||||
width: 50.h,
|
||||
height: 50.h,
|
||||
padding:
|
||||
EdgeInsets.only(right: 10.h, top: 15.h, bottom: 10.h),
|
||||
child: Image.asset(
|
||||
'images/icon_tips_Q.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isHaveRightWidget!) ...<Widget>[
|
||||
const Spacer(),
|
||||
rightWidget!
|
||||
] else
|
||||
Expanded(
|
||||
child: Text(
|
||||
rightTitle ?? '',
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
),
|
||||
if (isHaveDirection!) SizedBox(width: 15.w) else Container(),
|
||||
if (isHaveDirection!)
|
||||
Image.asset(
|
||||
'images/icon_right_grey.png',
|
||||
width: 12.w,
|
||||
height: 21.w,
|
||||
)
|
||||
else
|
||||
SizedBox(width: 10.w),
|
||||
if (isHaveDirection!) SizedBox(width: 5.w) else Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -9,8 +9,10 @@ EventBus eventBus = EventBus();
|
||||
class RefreshLockListInfoDataEvent {
|
||||
//是否清除蓝牙设备列表缓存
|
||||
bool clearScanDevices;
|
||||
bool isUnShowLoading;
|
||||
|
||||
RefreshLockListInfoDataEvent({this.clearScanDevices = false});
|
||||
RefreshLockListInfoDataEvent(
|
||||
{this.clearScanDevices = false, this.isUnShowLoading = false});
|
||||
}
|
||||
|
||||
/// 蓝牙添加用户成功
|
||||
|
||||
@ -65,6 +65,7 @@ class ShowTFView extends StatelessWidget {
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
),
|
||||
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@ -191,6 +191,8 @@ dependencies:
|
||||
expandable: ^5.0.1
|
||||
colorfilter_generator: ^0.0.8
|
||||
file_picker: ^5.3.1
|
||||
# 错误日志监控
|
||||
flutter_bugly_plugin: ^0.0.9
|
||||
|
||||
|
||||
dependency_overrides:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user