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.CHANGE_WIFI_STATE"/>
|
||||||
<!--允许写设备缓存,用于问题排查-->
|
<!--允许写设备缓存,用于问题排查-->
|
||||||
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
|
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
|
||||||
<!--允许写入扩展存储,用于写入缓存定位数据-->
|
<!--允许读设备日志,用于问题排查-->
|
||||||
|
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||||
|
|
||||||
<!--相机-->
|
<!--相机-->
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
|||||||
@ -855,5 +855,6 @@
|
|||||||
"门铃事件":"Doorbell event",
|
"门铃事件":"Doorbell event",
|
||||||
"视频事件":"Video event",
|
"视频事件":"Video event",
|
||||||
"请开启蓝牙":"Please turn on Bluetooth",
|
"请开启蓝牙":"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
|
- Flutter
|
||||||
- auto_orientation (0.0.1):
|
- auto_orientation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- Bugly (2.6.1)
|
||||||
- camera_avfoundation (0.0.1):
|
- camera_avfoundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
@ -81,6 +82,9 @@ PODS:
|
|||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_blue_plus (0.0.1):
|
- flutter_blue_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- flutter_bugly_plugin (0.0.1):
|
||||||
|
- Bugly
|
||||||
|
- Flutter
|
||||||
- flutter_local_notifications (0.0.1):
|
- flutter_local_notifications (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_native_contact_picker (0.0.1):
|
- flutter_native_contact_picker (0.0.1):
|
||||||
@ -170,6 +174,7 @@ DEPENDENCIES:
|
|||||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`)
|
- 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_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||||
- flutter_pcm_sound (from `.symlinks/plugins/flutter_pcm_sound/ios`)
|
- flutter_pcm_sound (from `.symlinks/plugins/flutter_pcm_sound/ios`)
|
||||||
@ -205,6 +210,7 @@ SPEC REPOS:
|
|||||||
- AMap3DMap
|
- AMap3DMap
|
||||||
- AMapFoundation
|
- AMapFoundation
|
||||||
- AMapLocation
|
- AMapLocation
|
||||||
|
- Bugly
|
||||||
- DKImagePickerController
|
- DKImagePickerController
|
||||||
- DKPhotoGallery
|
- DKPhotoGallery
|
||||||
- GoogleMaps
|
- GoogleMaps
|
||||||
@ -248,6 +254,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_blue_plus:
|
flutter_blue_plus:
|
||||||
:path: ".symlinks/plugins/flutter_blue_plus/ios"
|
:path: ".symlinks/plugins/flutter_blue_plus/ios"
|
||||||
|
flutter_bugly_plugin:
|
||||||
|
:path: ".symlinks/plugins/flutter_bugly_plugin/ios"
|
||||||
flutter_local_notifications:
|
flutter_local_notifications:
|
||||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
||||||
flutter_native_contact_picker:
|
flutter_native_contact_picker:
|
||||||
@ -309,6 +317,7 @@ SPEC CHECKSUMS:
|
|||||||
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
|
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
|
||||||
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
|
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
|
||||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||||
|
Bugly: 217ac2ce5f0f2626d43dbaa4f70764c953a26a31
|
||||||
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
|
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
|
||||||
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
|
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
|
||||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||||
@ -318,6 +327,7 @@ SPEC CHECKSUMS:
|
|||||||
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
||||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||||
flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96
|
flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96
|
||||||
|
flutter_bugly_plugin: d2db6d6641938269fa538575126e8ff530ee02c7
|
||||||
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
|
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
|
||||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||||
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
||||||
|
|||||||
@ -23,7 +23,8 @@ class AppLog {
|
|||||||
// if(!_printLog)return;
|
// if(!_printLog)return;
|
||||||
// if(_onlyError && !error) return;
|
// if(_onlyError && !error) return;
|
||||||
if (error) {
|
if (error) {
|
||||||
msg = '----->>> $msg $stackTrace';
|
final bool stackTraceIsNull = stackTrace != null;
|
||||||
|
msg = '----->>> $msg ${stackTraceIsNull ? '\n$stackTrace' : ''}';
|
||||||
}
|
}
|
||||||
Get.log(msg);
|
Get.log(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:app_settings/app_settings.dart';
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.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_model.dart';
|
||||||
import 'io_tool/io_tool.dart';
|
import 'io_tool/io_tool.dart';
|
||||||
@ -21,19 +17,19 @@ typedef ConnectStateCallBack = Function(
|
|||||||
typedef ScanDevicesCallBack = Function(List<ScanResult>);
|
typedef ScanDevicesCallBack = Function(List<ScanResult>);
|
||||||
|
|
||||||
class BlueManage {
|
class BlueManage {
|
||||||
final List<ScanResult> scanDevices = [];
|
final List<ScanResult> scanDevices = <ScanResult>[];
|
||||||
|
|
||||||
// 用来写入的服务id
|
// 用来写入的服务id
|
||||||
final Guid _serviceIdConnect = Guid("fff0");
|
final Guid _serviceIdConnect = Guid('fff0');
|
||||||
|
|
||||||
// 用来写入的服务id
|
// 用来写入的服务id
|
||||||
final Guid _serviceIdWrite = Guid('0000FFF0-0000-1000-8000-00805F9B34FB');
|
final Guid _serviceIdWrite = Guid('0000FFF0-0000-1000-8000-00805F9B34FB');
|
||||||
|
|
||||||
// 用来订阅的特征id
|
// 用来订阅的特征id
|
||||||
final Guid _characteristicIdSubscription = Guid("fff1");
|
final Guid _characteristicIdSubscription = Guid('fff1');
|
||||||
|
|
||||||
// 用来写入的特征id
|
// 用来写入的特征id
|
||||||
final Guid _characteristicIdWrite = Guid("fff2");
|
final Guid _characteristicIdWrite = Guid('fff2');
|
||||||
|
|
||||||
// 监听发送事件
|
// 监听发送事件
|
||||||
StreamSubscription<EventSendModel>? _sendStreamSubscription;
|
StreamSubscription<EventSendModel>? _sendStreamSubscription;
|
||||||
@ -50,10 +46,10 @@ class BlueManage {
|
|||||||
int? _mtuSize = 20;
|
int? _mtuSize = 20;
|
||||||
|
|
||||||
// 当前连接设备的名字
|
// 当前连接设备的名字
|
||||||
String connectDeviceName = "";
|
String connectDeviceName = '';
|
||||||
|
|
||||||
// 当前连接设备的mac地址
|
// 当前连接设备的mac地址
|
||||||
String connectDeviceMacAddress = "";
|
String connectDeviceMacAddress = '';
|
||||||
|
|
||||||
// 当前连接的设备
|
// 当前连接的设备
|
||||||
BluetoothDevice? bluetoothConnectDevice;
|
BluetoothDevice? bluetoothConnectDevice;
|
||||||
@ -93,7 +89,7 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _initGetMtuSubscription() {
|
void _initGetMtuSubscription() {
|
||||||
_mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((value) {
|
_mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((int value) {
|
||||||
_mtuSize = value - 3;
|
_mtuSize = value - 3;
|
||||||
AppLog.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
|
AppLog.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
|
||||||
});
|
});
|
||||||
@ -101,7 +97,7 @@ class BlueManage {
|
|||||||
|
|
||||||
void _initAdapterStateStateSubscription() {
|
void _initAdapterStateStateSubscription() {
|
||||||
_adapterStateStateSubscription ??=
|
_adapterStateStateSubscription ??=
|
||||||
FlutterBluePlus.adapterState.listen((state) {
|
FlutterBluePlus.adapterState.listen((BluetoothAdapterState state) {
|
||||||
_adapterState = state;
|
_adapterState = state;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -149,8 +145,8 @@ class BlueManage {
|
|||||||
_connectionStateSubscription?.cancel();
|
_connectionStateSubscription?.cancel();
|
||||||
_connectionStateSubscription = null;
|
_connectionStateSubscription = null;
|
||||||
|
|
||||||
_connectionStateSubscription =
|
_connectionStateSubscription = bluetoothConnectDevice!.connectionState
|
||||||
bluetoothConnectDevice!.connectionState.listen((state) async {
|
.listen((BluetoothConnectionState state) async {
|
||||||
bluetoothConnectionState = state;
|
bluetoothConnectionState = state;
|
||||||
// AppLog.log("蓝牙连接状态:$state");
|
// AppLog.log("蓝牙连接状态:$state");
|
||||||
});
|
});
|
||||||
@ -162,18 +158,18 @@ class BlueManage {
|
|||||||
.on<EventSendModel>()
|
.on<EventSendModel>()
|
||||||
.listen((EventSendModel model) {
|
.listen((EventSendModel model) {
|
||||||
if (model.sendChannel == DataChannel.ble) {
|
if (model.sendChannel == DataChannel.ble) {
|
||||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
FlutterBluePlus.isSupported.then((bool isAvailable) async {
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
if (_adapterState == BluetoothAdapterState.on) {
|
if (_adapterState == BluetoothAdapterState.on) {
|
||||||
// 蓝牙已开启,可以进行蓝牙操作
|
// 蓝牙已开启,可以进行蓝牙操作
|
||||||
writeCharacteristicWithResponse(model.data);
|
writeCharacteristicWithResponse(model.data);
|
||||||
} else {
|
} else {
|
||||||
try {} catch (e) {
|
try {} catch (e) {
|
||||||
AppLog.log("蓝牙打开失败");
|
AppLog.log('蓝牙打开失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AppLog.log("写入数据 蓝牙不可用,不能进行蓝牙操作");
|
AppLog.log('写入数据 蓝牙不可用,不能进行蓝牙操作');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -183,31 +179,33 @@ class BlueManage {
|
|||||||
/// 开始指定设备名称的扫描蓝牙设备
|
/// 开始指定设备名称的扫描蓝牙设备
|
||||||
Future<void> startScanSingle(String deviceName, int timeout,
|
Future<void> startScanSingle(String deviceName, int timeout,
|
||||||
ScanDevicesCallBack scanDevicesCallBack) async {
|
ScanDevicesCallBack scanDevicesCallBack) async {
|
||||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
FlutterBluePlus.isSupported.then((bool isAvailable) async {
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
if (_adapterState == BluetoothAdapterState.on) {
|
if (_adapterState == BluetoothAdapterState.on) {
|
||||||
try {
|
try {
|
||||||
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
||||||
Completer<dynamic> completer = Completer<dynamic>();
|
final Completer<dynamic> completer = Completer<dynamic>();
|
||||||
var subscription = FlutterBluePlus.scanResults.listen((results) {
|
final StreamSubscription<List<ScanResult>> subscription =
|
||||||
// AppLog.log("startScanSingle扫描到的设备:$results");
|
FlutterBluePlus.scanResults.listen((List<ScanResult> results) {
|
||||||
bool isExit = results.any((element) =>
|
final bool isExit = results.any((ScanResult element) =>
|
||||||
(element.device.platformName == deviceName) ||
|
(element.device.platformName == deviceName) ||
|
||||||
(element.advertisementData.advName == deviceName));
|
(element.advertisementData.advName == deviceName));
|
||||||
|
AppLog.log('扫描到的设备数:${results.length} 是否查找到 $isExit');
|
||||||
if (isExit) {
|
if (isExit) {
|
||||||
for (var scanResult in results) {
|
for (final ScanResult scanResult in results) {
|
||||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
||||||
? scanResult.advertisementData.serviceUuids[0]
|
? scanResult.advertisementData.serviceUuids[0]
|
||||||
: "")
|
: '')
|
||||||
.toString()
|
.toString()
|
||||||
.contains("758824")) &&
|
.contains('758824')) &&
|
||||||
(scanResult.rssi >= -100)) {
|
(scanResult.rssi >= -100)) {
|
||||||
// 查询id相同的元素
|
// 查询id相同的元素
|
||||||
final knownDeviceIndex = scanDevices.indexWhere((d) =>
|
final int knownDeviceIndex = scanDevices.indexWhere(
|
||||||
(d.device.platformName ==
|
(ScanResult d) =>
|
||||||
scanResult.device.platformName) ||
|
(d.device.platformName ==
|
||||||
(d.advertisementData.advName ==
|
scanResult.device.platformName) ||
|
||||||
scanResult.advertisementData.advName));
|
(d.advertisementData.advName ==
|
||||||
|
scanResult.advertisementData.advName));
|
||||||
// 不存在的时候返回-1
|
// 不存在的时候返回-1
|
||||||
if (knownDeviceIndex >= 0) {
|
if (knownDeviceIndex >= 0) {
|
||||||
scanDevices[knownDeviceIndex] = scanResult;
|
scanDevices[knownDeviceIndex] = scanResult;
|
||||||
@ -220,7 +218,7 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
}, onError: (e) {
|
}, onError: (e) {
|
||||||
AppLog.log(
|
AppLog.log(
|
||||||
"扫描失败:$e",
|
'扫描失败:$e',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||||
@ -228,7 +226,7 @@ class BlueManage {
|
|||||||
scanDevicesCallBack(scanDevices);
|
scanDevicesCallBack(scanDevices);
|
||||||
subscription.cancel();
|
subscription.cancel();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log("扫描失败");
|
AppLog.log('扫描失败');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -236,11 +234,11 @@ class BlueManage {
|
|||||||
await FlutterBluePlus.turnOn();
|
await FlutterBluePlus.turnOn();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log("蓝牙打开失败");
|
AppLog.log('蓝牙打开失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -248,15 +246,16 @@ class BlueManage {
|
|||||||
/// 开始扫描蓝牙设备
|
/// 开始扫描蓝牙设备
|
||||||
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack,
|
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack,
|
||||||
{List<Guid>? idList}) async {
|
{List<Guid>? idList}) async {
|
||||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
FlutterBluePlus.isSupported.then((bool isAvailable) async {
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
if (_adapterState == BluetoothAdapterState.on) {
|
if (_adapterState == BluetoothAdapterState.on) {
|
||||||
try {
|
try {
|
||||||
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
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();
|
scanDevices.clear();
|
||||||
for (var scanResult in results) {
|
for (final ScanResult scanResult in results) {
|
||||||
// 判断名字为空的直接剔除
|
// 判断名字为空的直接剔除
|
||||||
// if (scanResult.device.advName.isEmpty) {
|
// if (scanResult.device.advName.isEmpty) {
|
||||||
// return;
|
// return;
|
||||||
@ -266,16 +265,17 @@ class BlueManage {
|
|||||||
// " rssi:${scanResult.rssi}");
|
// " rssi:${scanResult.rssi}");
|
||||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
||||||
? scanResult.advertisementData.serviceUuids[0]
|
? scanResult.advertisementData.serviceUuids[0]
|
||||||
: "")
|
: '')
|
||||||
.toString()
|
.toString()
|
||||||
.contains("758824")) &&
|
.contains('758824')) &&
|
||||||
(scanResult.rssi >= -100)) {
|
(scanResult.rssi >= -100)) {
|
||||||
// 查询id相同的元素
|
// 查询id相同的元素
|
||||||
final knownDeviceIndex = scanDevices.indexWhere((d) =>
|
final int knownDeviceIndex = scanDevices.indexWhere(
|
||||||
(d.device.platformName ==
|
(ScanResult d) =>
|
||||||
scanResult.device.platformName) ||
|
(d.device.platformName ==
|
||||||
(d.advertisementData.advName ==
|
scanResult.device.platformName) ||
|
||||||
scanResult.advertisementData.advName));
|
(d.advertisementData.advName ==
|
||||||
|
scanResult.advertisementData.advName));
|
||||||
// 不存在的时候返回-1
|
// 不存在的时候返回-1
|
||||||
if (knownDeviceIndex >= 0) {
|
if (knownDeviceIndex >= 0) {
|
||||||
scanDevices[knownDeviceIndex] = scanResult;
|
scanDevices[knownDeviceIndex] = scanResult;
|
||||||
@ -303,13 +303,13 @@ class BlueManage {
|
|||||||
// FlutterBluePlus.stopScan();
|
// FlutterBluePlus.stopScan();
|
||||||
}, onError: (e) {
|
}, onError: (e) {
|
||||||
AppLog.log(
|
AppLog.log(
|
||||||
"扫描失败:$e",
|
'扫描失败:$e',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log("扫描失败");
|
AppLog.log('扫描失败');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -317,11 +317,11 @@ class BlueManage {
|
|||||||
await FlutterBluePlus.turnOn();
|
await FlutterBluePlus.turnOn();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log("蓝牙打开失败");
|
AppLog.log('蓝牙打开失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -330,12 +330,13 @@ class BlueManage {
|
|||||||
Future<void> bludSendData(
|
Future<void> bludSendData(
|
||||||
String deviceName, ConnectStateCallBack stateCallBack,
|
String deviceName, ConnectStateCallBack stateCallBack,
|
||||||
{bool isAddEquipment = false}) async {
|
{bool isAddEquipment = false}) async {
|
||||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
FlutterBluePlus.isSupported.then((bool isAvailable) async {
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
|
AppLog.log('蓝牙状态 系统蓝牙状态:$_adapterState 蓝牙连接状态:$bluetoothConnectionState');
|
||||||
if (_adapterState == BluetoothAdapterState.on) {
|
if (_adapterState == BluetoothAdapterState.on) {
|
||||||
// 蓝牙已开启,可以进行蓝牙操作
|
// 蓝牙已开启,可以进行蓝牙操作
|
||||||
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
|
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
|
||||||
_connect(deviceName, (state) {
|
_connect(deviceName, (BluetoothConnectionState state) {
|
||||||
stateCallBack(bluetoothConnectionState!);
|
stateCallBack(bluetoothConnectionState!);
|
||||||
}, isAddEquipment: isAddEquipment);
|
}, isAddEquipment: isAddEquipment);
|
||||||
} else {
|
} else {
|
||||||
@ -346,11 +347,11 @@ class BlueManage {
|
|||||||
stateCallBack(BluetoothConnectionState.disconnected);
|
stateCallBack(BluetoothConnectionState.disconnected);
|
||||||
openBlue();
|
openBlue();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log("蓝牙打开失败");
|
AppLog.log('蓝牙打开失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
AppLog.log('开始扫描 蓝牙不可用,不能进行蓝牙操作');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -360,9 +361,9 @@ class BlueManage {
|
|||||||
String deviceName, ConnectStateCallBack connectStateCallBack,
|
String deviceName, ConnectStateCallBack connectStateCallBack,
|
||||||
{bool isAddEquipment = false}) async {
|
{bool isAddEquipment = false}) async {
|
||||||
connectDeviceName = deviceName;
|
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.device.platformName == connectDeviceName ||
|
||||||
element.advertisementData.advName == connectDeviceName);
|
element.advertisementData.advName == connectDeviceName);
|
||||||
|
|
||||||
@ -383,7 +384,7 @@ class BlueManage {
|
|||||||
{bool isAddEquipment = false}) async {
|
{bool isAddEquipment = false}) async {
|
||||||
// 判断数组列表里面是否有这个设备
|
// 判断数组列表里面是否有这个设备
|
||||||
// AppLog.log("devicesList:$devicesList");
|
// AppLog.log("devicesList:$devicesList");
|
||||||
final knownDeviceIndex = devicesList.indexWhere((d) =>
|
final int knownDeviceIndex = devicesList.indexWhere((ScanResult d) =>
|
||||||
(d.device.platformName == deviceName) ||
|
(d.device.platformName == deviceName) ||
|
||||||
(d.advertisementData.advName == deviceName));
|
(d.advertisementData.advName == deviceName));
|
||||||
|
|
||||||
@ -412,15 +413,15 @@ class BlueManage {
|
|||||||
// AppLog.log("调用了停止扫描的方法");
|
// AppLog.log("调用了停止扫描的方法");
|
||||||
await stopScan();
|
await stopScan();
|
||||||
|
|
||||||
if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == "0") &&
|
if ((scanResult.advertisementData.serviceUuids[0].toString()[31] == '0') &&
|
||||||
isAddEquipment == false) {
|
isAddEquipment == false) {
|
||||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||||
EasyLoading.showToast("该锁已被重置".tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重连三次
|
// 重连三次
|
||||||
int maxAttempts = 3;
|
final int maxAttempts = 3;
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
while (attempt < maxAttempts) {
|
while (attempt < maxAttempts) {
|
||||||
try {
|
try {
|
||||||
@ -443,14 +444,16 @@ class BlueManage {
|
|||||||
// await bluetoothConnectDevice!.connect();
|
// await bluetoothConnectDevice!.connect();
|
||||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||||
try {
|
try {
|
||||||
bluetoothConnectDevice!.discoverServices().then((services) {
|
bluetoothConnectDevice!
|
||||||
for (BluetoothService service in services) {
|
.discoverServices()
|
||||||
|
.then((List<BluetoothService> services) {
|
||||||
|
for (final BluetoothService service in services) {
|
||||||
// AppLog.log("11111service.remoteId:${service.remoteId}"
|
// AppLog.log("11111service.remoteId:${service.remoteId}"
|
||||||
// " service.uuid:${service.uuid}"
|
// " service.uuid:${service.uuid}"
|
||||||
// " service.characteristics:${service.characteristics}"
|
// " service.characteristics:${service.characteristics}"
|
||||||
// " service.includedServices:${service.includedServices}");
|
// " service.includedServices:${service.includedServices}");
|
||||||
if (service.uuid == _serviceIdConnect) {
|
if (service.uuid == _serviceIdConnect) {
|
||||||
for (BluetoothCharacteristic characteristic
|
for (final BluetoothCharacteristic characteristic
|
||||||
in service.characteristics) {
|
in service.characteristics) {
|
||||||
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
|
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
|
||||||
// " characteristic.uuid:${characteristic.uuid}"
|
// " 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;
|
int? dataLen;
|
||||||
|
|
||||||
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
|
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
|
||||||
final subscription = characteristic.onValueReceived.listen((data) {
|
final StreamSubscription<List<int>> subscription =
|
||||||
|
characteristic.onValueReceived.listen((List<int> data) {
|
||||||
// AppLog.log("订阅获取的数据:$data");
|
// AppLog.log("订阅获取的数据:$data");
|
||||||
if (data == lastTimeData || data.isEmpty) {
|
if (data == lastTimeData || data.isEmpty) {
|
||||||
return;
|
return;
|
||||||
@ -580,15 +584,15 @@ class BlueManage {
|
|||||||
|
|
||||||
// 写入
|
// 写入
|
||||||
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
||||||
List<BluetoothService> services =
|
final List<BluetoothService> services =
|
||||||
await bluetoothConnectDevice!.discoverServices();
|
await bluetoothConnectDevice!.discoverServices();
|
||||||
for (BluetoothService service in services) {
|
for (final BluetoothService service in services) {
|
||||||
// AppLog.log("33333 service.remoteId:${service.remoteId}"
|
// AppLog.log("33333 service.remoteId:${service.remoteId}"
|
||||||
// " service.uuid:${service.uuid}\n\n"
|
// " service.uuid:${service.uuid}\n\n"
|
||||||
// " service.characteristics:${service.characteristics}\n\n"
|
// " service.characteristics:${service.characteristics}\n\n"
|
||||||
// " service.includedServices:${service.includedServices}");
|
// " service.includedServices:${service.includedServices}");
|
||||||
if (service.uuid == _serviceIdConnect) {
|
if (service.uuid == _serviceIdConnect) {
|
||||||
for (BluetoothCharacteristic characteristic
|
for (final BluetoothCharacteristic characteristic
|
||||||
in service.characteristics) {
|
in service.characteristics) {
|
||||||
// AppLog.log("44444 characteristic.remoteId:${characteristic.remoteId}"
|
// AppLog.log("44444 characteristic.remoteId:${characteristic.remoteId}"
|
||||||
// " characteristic.uuid:${characteristic.uuid}\n\n"
|
// " characteristic.uuid:${characteristic.uuid}\n\n"
|
||||||
@ -598,8 +602,8 @@ class BlueManage {
|
|||||||
// .characteristicUuid}");
|
// .characteristicUuid}");
|
||||||
if (characteristic.characteristicUuid == _characteristicIdWrite) {
|
if (characteristic.characteristicUuid == _characteristicIdWrite) {
|
||||||
try {
|
try {
|
||||||
List<int> valueList = value;
|
final List<int> valueList = value;
|
||||||
List subData = splitList(valueList, _mtuSize!);
|
final List subData = splitList(valueList, _mtuSize!);
|
||||||
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
||||||
for (int i = 0; i < subData.length; i++) {
|
for (int i = 0; i < subData.length; i++) {
|
||||||
if (characteristic.properties.writeWithoutResponse) {
|
if (characteristic.properties.writeWithoutResponse) {
|
||||||
@ -660,15 +664,15 @@ class BlueManage {
|
|||||||
|
|
||||||
// 写入
|
// 写入
|
||||||
Future<void> writeNull() async {
|
Future<void> writeNull() async {
|
||||||
List<BluetoothService> services =
|
final List<BluetoothService> services =
|
||||||
await bluetoothConnectDevice!.discoverServices();
|
await bluetoothConnectDevice!.discoverServices();
|
||||||
for (BluetoothService service in services) {
|
for (final BluetoothService service in services) {
|
||||||
if (service.uuid == _serviceIdConnect) {
|
if (service.uuid == _serviceIdConnect) {
|
||||||
for (BluetoothCharacteristic characteristic
|
for (final BluetoothCharacteristic characteristic
|
||||||
in service.characteristics) {
|
in service.characteristics) {
|
||||||
if (characteristic.characteristicUuid == _characteristicIdWrite) {
|
if (characteristic.characteristicUuid == _characteristicIdWrite) {
|
||||||
try {
|
try {
|
||||||
List<int> valueList = [1];
|
final List<int> valueList = <int>[1];
|
||||||
AppLog.log('APP写入 writeNull ');
|
AppLog.log('APP写入 writeNull ');
|
||||||
await characteristic.write(valueList);
|
await characteristic.write(valueList);
|
||||||
} on Exception catch (e, s) {
|
} on Exception catch (e, s) {
|
||||||
@ -713,7 +717,7 @@ class BlueManage {
|
|||||||
try {
|
try {
|
||||||
await FlutterBluePlus.stopScan();
|
await FlutterBluePlus.stopScan();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log("停止扫描失败");
|
AppLog.log('停止扫描失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,17 +725,17 @@ class BlueManage {
|
|||||||
Future<void> disconnect() async {
|
Future<void> disconnect() async {
|
||||||
try {
|
try {
|
||||||
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
|
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
|
||||||
connectDeviceMacAddress = "";
|
connectDeviceMacAddress = '';
|
||||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||||
// await writeNull();
|
// await writeNull();
|
||||||
// await Future.delayed(const Duration(milliseconds: 1000));
|
// await Future.delayed(const Duration(milliseconds: 1000));
|
||||||
//加快蓝牙断连
|
//加快蓝牙断连
|
||||||
await bluetoothConnectDevice!.disconnect(timeout: 2);
|
await bluetoothConnectDevice!.disconnect(timeout: 2);
|
||||||
AppLog.log("断开连接成功");
|
AppLog.log('断开连接成功');
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
} on Exception catch (e, _) {
|
} on Exception catch (e, _) {
|
||||||
AppLog.log("断开连接失败: $e");
|
AppLog.log('断开连接失败: $e');
|
||||||
} finally {
|
} finally {
|
||||||
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||||
}
|
}
|
||||||
@ -742,7 +746,7 @@ class BlueManage {
|
|||||||
await FlutterBluePlus.turnOn();
|
await FlutterBluePlus.turnOn();
|
||||||
}
|
}
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
EasyLoading.showToast("请开启蓝牙".tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('请开启蓝牙'.tr, duration: 2000.milliseconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class F {
|
|||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.local:
|
case Flavor.local:
|
||||||
return 'https://ge.lock.star-lock.cn'; // 葛工
|
return 'https://ge.lock.star-lock.cn'; // 葛工
|
||||||
// return 'http://192.168.1.15:8022'; // 谢工
|
// return 'http://192.168.1.15:8022'; // 谢工
|
||||||
case Flavor.dev:
|
case Flavor.dev:
|
||||||
return 'https://dev.lock.star-lock.cn';
|
return 'https://dev.lock.star-lock.cn';
|
||||||
case Flavor.pre:
|
case Flavor.pre:
|
||||||
@ -95,7 +95,7 @@ class F {
|
|||||||
return 'https://lock.skychip.top';
|
return 'https://lock.skychip.top';
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return 'https://lock.xhjcn.ltd';
|
return 'https://lock.xhjcn.ltd';
|
||||||
// return 'https://pre.lock.star-lock.cn';
|
// return 'https://pre.lock.star-lock.cn';
|
||||||
default:
|
default:
|
||||||
throw Exception('flavor[$name] apiPrefix not found');
|
throw Exception('flavor[$name] apiPrefix not found');
|
||||||
}
|
}
|
||||||
@ -125,4 +125,19 @@ class F {
|
|||||||
throw Exception('flavor[$name] aMapKey not found');
|
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 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.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/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/xs_jPhush.dart';
|
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||||
|
|
||||||
@ -14,34 +17,15 @@ import 'starLock_login_state.dart';
|
|||||||
|
|
||||||
class StarLockLoginLogic extends BaseGetXController {
|
class StarLockLoginLogic extends BaseGetXController {
|
||||||
final StarLockLoginState state = StarLockLoginState();
|
final StarLockLoginState state = StarLockLoginState();
|
||||||
final stateMyLogic = Get.put(StarLockMineLogic()).state;
|
final StarLockMineState stateMyLogic = Get.put(StarLockMineLogic()).state;
|
||||||
int indexFocusNode = noneFocusNode;
|
int indexFocusNode = noneFocusNode;
|
||||||
static int noneFocusNode = 0;
|
static int noneFocusNode = 0;
|
||||||
static int emailOrPhoneFocusNode = 1;
|
static int emailOrPhoneFocusNode = 1;
|
||||||
static int pwdFocusNode = 2;
|
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() {
|
void changeInputFocusNode() {
|
||||||
Future.delayed(Duration(milliseconds: 100), () {
|
Future<void>.delayed(const Duration(milliseconds: 100), () {
|
||||||
if (indexFocusNode == noneFocusNode) {
|
if (indexFocusNode == noneFocusNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -53,9 +37,9 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void login() async {
|
Future<void> login() async {
|
||||||
var entity = await ApiRepository.to.login(
|
final LoginEntity entity = await ApiRepository.to.login(
|
||||||
loginType: "1",
|
loginType: '1',
|
||||||
password: state.pwd.value,
|
password: state.pwd.value,
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
username: state.emailOrPhone.value);
|
username: state.emailOrPhone.value);
|
||||||
@ -67,7 +51,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
// Get.toNamed(Routers.starLockMain);
|
// Get.toNamed(Routers.starLockMain);
|
||||||
XSJPushProvider().initJPushService();
|
XSJPushProvider().initJPushService();
|
||||||
XSJPushProvider().initLocalNotification(false);
|
XSJPushProvider().initLocalNotification(false);
|
||||||
Get.offNamedUntil(Routers.starLockMain, (route) => false);
|
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/flavors.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/device_info_service.dart';
|
||||||
import 'package:star_lock/tools/platform_info_services.dart';
|
import 'package:star_lock/tools/platform_info_services.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
@ -21,19 +24,10 @@ FutureOr<void> main() async {
|
|||||||
// 设置国际化信息
|
// 设置国际化信息
|
||||||
await _initTranslation();
|
await _initTranslation();
|
||||||
|
|
||||||
//错误日志监控
|
// bugly错误日志监控
|
||||||
FlutterError.onError = (FlutterErrorDetails details) async {
|
await BuglyTool.init();
|
||||||
AppLog.log('error:${details.exception.toString()}',
|
|
||||||
stackTrace: details.stack, error: true);
|
|
||||||
Zone.current.handleUncaughtError(details.exception, details.stack!);
|
|
||||||
};
|
|
||||||
|
|
||||||
//错误日志监控
|
runApp(const MyApp());
|
||||||
runZonedGuarded<Future<void>>(() async {
|
|
||||||
runApp(const MyApp());
|
|
||||||
}, (Object error, StackTrace stackTrace) async {
|
|
||||||
AppLog.log('error:$error', stackTrace: stackTrace, error: true);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (AppPlatform.isAndroid) {
|
if (AppPlatform.isAndroid) {
|
||||||
const SystemUiOverlayStyle systemUiOverlayStyle =
|
const SystemUiOverlayStyle systemUiOverlayStyle =
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import 'package:date_format/date_format.dart';
|
import 'package:date_format/date_format.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_state.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
@ -20,8 +22,10 @@ class CheckingInAddHolidaysPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||||
final logic = Get.put(CheckingInAddHolidaysLogic());
|
final CheckingInAddHolidaysLogic logic =
|
||||||
final state = Get.find<CheckingInAddHolidaysLogic>().state;
|
Get.put(CheckingInAddHolidaysLogic());
|
||||||
|
final CheckingInAddHolidaysState state =
|
||||||
|
Get.find<CheckingInAddHolidaysLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -32,27 +36,31 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
|||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
|
setHeight: false,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
"(${TranslationLoader.lanKeys!.mustFillIn!.tr})")),
|
'(${TranslationLoader.lanKeys!.mustFillIn!.tr})')),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.startDate!.tr,
|
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,
|
isHaveLine: true,
|
||||||
isHaveDirection: false,
|
isHaveDirection: false,
|
||||||
action: () async {
|
action: () async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return ShowCalendar(
|
return ShowCalendar(
|
||||||
datePickerMode: DatePickerMode.day,
|
datePickerMode: DatePickerMode.day,
|
||||||
selectAction: (dateTime) {
|
selectAction: (DateTime dateTime) {
|
||||||
String beginDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
|
final String beginDate = formatDate(
|
||||||
|
dateTime, <String>[yyyy, '-', mm, '-', dd]);
|
||||||
state.beginDate.value = beginDate;
|
state.beginDate.value = beginDate;
|
||||||
Get.back();
|
Get.back();
|
||||||
// Navigator.of(context).pop(true);
|
// Navigator.of(context).pop(true);
|
||||||
@ -61,17 +69,20 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
|||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.endDate!.tr,
|
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,
|
isHaveLine: true,
|
||||||
isHaveDirection: false,
|
isHaveDirection: false,
|
||||||
action: () async {
|
action: () async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return ShowCalendar(
|
return ShowCalendar(
|
||||||
datePickerMode: DatePickerMode.day,
|
datePickerMode: DatePickerMode.day,
|
||||||
selectAction: (dateTime) {
|
selectAction: (DateTime dateTime) {
|
||||||
String endDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
|
final String endDate = formatDate(
|
||||||
|
dateTime, <String>[yyyy, '-', mm, '-', dd]);
|
||||||
state.endDate.value = endDate;
|
state.endDate.value = endDate;
|
||||||
Get.back();
|
Get.back();
|
||||||
});
|
});
|
||||||
@ -85,11 +96,12 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
|||||||
action: () async {
|
action: () async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return ShowCalendar(
|
return ShowCalendar(
|
||||||
datePickerMode: DatePickerMode.day,
|
datePickerMode: DatePickerMode.day,
|
||||||
selectAction: (dateTime) {
|
selectAction: (DateTime dateTime) {
|
||||||
String makeUpWorkDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
|
final String makeUpWorkDate = formatDate(
|
||||||
|
dateTime, <String>[yyyy, '-', mm, '-', dd]);
|
||||||
state.makeUpWorkDate.value = makeUpWorkDate;
|
state.makeUpWorkDate.value = makeUpWorkDate;
|
||||||
Get.back();
|
Get.back();
|
||||||
});
|
});
|
||||||
@ -112,30 +124,26 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getTFWidget(String tfStr) {
|
Widget getTFWidget(String tfStr) {
|
||||||
return Container(
|
return Expanded(
|
||||||
height: 50.h,
|
child: TextField(
|
||||||
width: 300.w,
|
//输入框一行
|
||||||
// color: Colors.red,
|
maxLines: 2,
|
||||||
child: Row(
|
minLines: 1,
|
||||||
children: [
|
controller: state.staffNameController,
|
||||||
Expanded(
|
autofocus: false,
|
||||||
child: TextField(
|
textAlign: TextAlign.end,
|
||||||
//输入框一行
|
decoration: InputDecoration(
|
||||||
maxLines: 1,
|
//输入里面输入文字内边距设置
|
||||||
controller: state.staffNameController,
|
contentPadding: const EdgeInsets.only(bottom: 3),
|
||||||
autofocus: false,
|
hintText: tfStr,
|
||||||
textAlign: TextAlign.end,
|
hintStyle: TextStyle(
|
||||||
decoration: InputDecoration(
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor, height: 1),
|
||||||
//输入里面输入文字内边距设置
|
//不需要输入框下划线
|
||||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
border: InputBorder.none,
|
||||||
hintText: tfStr,
|
isCollapsed: true,
|
||||||
hintStyle: TextStyle(
|
),
|
||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
inputFormatters: <TextInputFormatter>[
|
||||||
//不需要输入框下划线
|
LengthLimitingTextInputFormatter(30),
|
||||||
border: InputBorder.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -145,7 +153,7 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_round_unSelect.png',
|
'images/icon_round_unSelect.png',
|
||||||
width: 40.w,
|
width: 40.w,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_state.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/style/picker_style.dart';
|
import 'package:star_lock/tools/pickers/style/picker_style.dart';
|
||||||
@ -25,8 +26,10 @@ class CheckingInSetHolidaysPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||||
final logic = Get.put(CheckingInSetHolidaysLogic());
|
final CheckingInSetHolidaysLogic logic =
|
||||||
final state = Get.find<CheckingInSetHolidaysLogic>().state;
|
Get.put(CheckingInSetHolidaysLogic());
|
||||||
|
final CheckingInSetHolidaysState state =
|
||||||
|
Get.find<CheckingInSetHolidaysLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -37,12 +40,14 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
titleWidget: titleWidget(),
|
titleWidget: titleWidget(),
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var data = await Get.toNamed(
|
final dynamic data = await Get.toNamed(
|
||||||
Routers.checkingInAddHolidaysPage,
|
Routers.checkingInAddHolidaysPage,
|
||||||
arguments: {"companyId": state.companyId.value});
|
arguments: <String, String>{
|
||||||
|
'companyId': state.companyId.value
|
||||||
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.editStaffLoadData();
|
logic.editStaffLoadData();
|
||||||
}
|
}
|
||||||
@ -58,12 +63,12 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Obx(() {
|
body: Obx(() {
|
||||||
return state.holidaysListData.value!.isNotEmpty
|
return state.holidaysListData.isNotEmpty
|
||||||
? ListView.builder(
|
? ListView.builder(
|
||||||
itemCount: state.holidaysListData.value!.length,
|
itemCount: state.holidaysListData.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
HolidaysMonthListData holidaysMonthListData =
|
final HolidaysMonthListData holidaysMonthListData =
|
||||||
state.holidaysListData.value![index];
|
state.holidaysListData[index];
|
||||||
return _checkingInListMouthItem(holidaysMonthListData);
|
return _checkingInListMouthItem(holidaysMonthListData);
|
||||||
})
|
})
|
||||||
: NoData();
|
: NoData();
|
||||||
@ -71,34 +76,44 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _checkingInListMouthItem(HolidaysMonthListData holidaysMonthListData) {
|
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(
|
return GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 140.h * holidaysMonthListData.listItem!.length + 20.w,
|
decoration: BoxDecoration(
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
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(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
color: colorWithMonth(int.parse(
|
color: colorWithMonth(int.parse(
|
||||||
holidaysMonthListData.listItem![0].month.toString())),
|
holidaysMonthListData.listItem![0].month.toString())),
|
||||||
width: 100.w,
|
width: l,
|
||||||
height: 140.h * holidaysMonthListData.listItem!.length,
|
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${holidaysMonthListData.listItem![0].month}\n${TranslationLoader.lanKeys!.month!.tr}",
|
'${holidaysMonthListData.listItem![0].month}\n${TranslationLoader.lanKeys!.month!.tr}',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||||
))),
|
))),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 140.h * holidaysMonthListData.listItem!.length,
|
width: r,
|
||||||
width: 1.sw - 100.w - 20.w * 2,
|
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: holidaysMonthListData.listItem!.length,
|
itemCount: holidaysMonthListData.listItem!.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
ListItem listItem = holidaysMonthListData.listItem![index];
|
final ListItem listItem =
|
||||||
|
holidaysMonthListData.listItem![index];
|
||||||
return _checkingInListItem(
|
return _checkingInListItem(
|
||||||
index,
|
|
||||||
listItem.vacationName,
|
listItem.vacationName,
|
||||||
DateTool().dateToYMDString(
|
DateTool().dateToYMDString(
|
||||||
listItem.vacationStartDate.toString()),
|
listItem.vacationStartDate.toString()),
|
||||||
@ -107,10 +122,10 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
listItem.fillClassDate!.isNotEmpty
|
listItem.fillClassDate!.isNotEmpty
|
||||||
? DateTool().dateToYMDString(
|
? DateTool().dateToYMDString(
|
||||||
listItem.fillClassDate.toString())
|
listItem.fillClassDate.toString())
|
||||||
: "", () async {
|
: '', () async {
|
||||||
var data = await Get.toNamed(
|
final dynamic data = await Get.toNamed(
|
||||||
Routers.checkingInDeletHolidaysPage,
|
Routers.checkingInDeletHolidaysPage,
|
||||||
arguments: {"listItem": listItem});
|
arguments: <String, ListItem>{'listItem': listItem});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.editStaffLoadData();
|
logic.editStaffLoadData();
|
||||||
}
|
}
|
||||||
@ -123,83 +138,66 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _checkingInListItem(
|
Widget _checkingInListItem(String? lockTypeTitle, String? vacationStartDate,
|
||||||
int index,
|
String? vacationEndDate, String? makeUpClass, Function() action) {
|
||||||
String? lockTypeTitle,
|
|
||||||
String? vacationStartDate,
|
|
||||||
String? vacationEndDate,
|
|
||||||
String? makeUpClass,
|
|
||||||
Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Column(
|
child: Container(
|
||||||
children: [
|
padding:
|
||||||
Container(
|
EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
height: 140.h,
|
border: Border(
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
bottom: BorderSide(
|
||||||
child: Row(
|
color: AppColors.mainBackgroundColor, width: 1.h, // 设置边框宽度
|
||||||
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),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
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() {
|
Widget titleWidget() {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: showListType,
|
||||||
showListType();
|
|
||||||
},
|
|
||||||
child: Obx(() => Container(
|
child: Obx(() => Container(
|
||||||
width: 300.w,
|
width: 300.w,
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${state.selectYear.value}${TranslationLoader.lanKeys!.year!.tr}",
|
'${state.selectYear.value}${TranslationLoader.lanKeys!.year!.tr}',
|
||||||
style: TextStyle(color: Colors.white, fontSize: 26.sp),
|
style: TextStyle(color: Colors.white, fontSize: 26.sp),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -226,9 +224,7 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
// 样式 详见下方样式
|
// 样式 详见下方样式
|
||||||
pickerStyle: PickerStyle(
|
pickerStyle: PickerStyle(
|
||||||
cancelButton: GestureDetector(
|
cancelButton: GestureDetector(
|
||||||
onTap: () {
|
onTap: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.only(left: 22, right: 12),
|
padding: const EdgeInsets.only(left: 22, right: 12),
|
||||||
@ -237,9 +233,7 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
commitButton: GestureDetector(
|
commitButton: GestureDetector(
|
||||||
onTap: () {
|
onTap: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.only(left: 22, right: 12),
|
padding: const EdgeInsets.only(left: 22, right: 12),
|
||||||
@ -252,7 +246,7 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
|||||||
selectDate: PDuration(year: 2023),
|
selectDate: PDuration(year: 2023),
|
||||||
minDate: PDuration(year: 1900),
|
minDate: PDuration(year: 1900),
|
||||||
maxDate: PDuration(year: 2100),
|
maxDate: PDuration(year: 2100),
|
||||||
onConfirm: (p) {
|
onConfirm: (PDuration p) {
|
||||||
state.selectYear.value = p.year!;
|
state.selectYear.value = p.year!;
|
||||||
logic.editStaffLoadData();
|
logic.editStaffLoadData();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListMonth_entity.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 '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -23,8 +25,8 @@ class CheckingInListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInListPageState extends State<CheckingInListPage> {
|
class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||||
final logic = Get.put(CheckingInListLogic());
|
final CheckingInListLogic logic = Get.put(CheckingInListLogic());
|
||||||
final state = Get.find<CheckingInListLogic>().state;
|
final CheckingInListState state = Get.find<CheckingInListLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -35,26 +37,34 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
titleWidget: titleWidget(),
|
titleWidget: titleWidget(),
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
(state.getKeyInfosData.value.keyRight == 1) ?
|
if (state.getKeyInfosData.value.keyRight == 1)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode =
|
||||||
if(isDemoMode == false){
|
await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
Get.toNamed(Routers.checkingInSetPage, arguments: {
|
if (isDemoMode == false) {
|
||||||
"getKeyInfosData": state.getKeyInfosData.value,
|
Get.toNamed(Routers.checkingInSetPage,
|
||||||
});
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
}else{
|
'getKeyInfosData': state.getKeyInfosData.value,
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
});
|
||||||
logic.showToast("演示模式");
|
} else {
|
||||||
}
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
},
|
logic.showToast('演示模式');
|
||||||
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)) : Container(),
|
}
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
'images/main/icon_lockDetail_checkIn_set.png',
|
||||||
|
width: 36.w,
|
||||||
|
height: 36.w,
|
||||||
|
))
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
topInfo(),
|
topInfo(),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
middleDayInfo(),
|
middleDayInfo(),
|
||||||
@ -70,7 +80,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
// height: 280.h,
|
// height: 280.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(height: 30.h),
|
SizedBox(height: 30.h),
|
||||||
Obx(() => Container(
|
Obx(() => Container(
|
||||||
width: 110.w,
|
width: 110.w,
|
||||||
@ -80,32 +90,38 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
borderRadius: BorderRadius.circular(60.w),
|
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),
|
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),
|
SizedBox(height: 30.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
// SizedBox(width: 30.w,),
|
// SizedBox(width: 30.w,),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w,),
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode =
|
||||||
if(isDemoMode == false){
|
await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isDay.value = true;
|
state.isDay.value = true;
|
||||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
final DateTime dateTime =
|
||||||
String beginDate = formatDate(dateTime, [mm,'-',dd]);
|
DateTime.fromMillisecondsSinceEpoch(
|
||||||
|
state.checkListDateTimestamp.value);
|
||||||
|
final String beginDate =
|
||||||
|
formatDate(dateTime, <String>[mm, '-', dd]);
|
||||||
state.checkListDate.value = beginDate;
|
state.checkListDate.value = beginDate;
|
||||||
logic.loadDataByType();
|
logic.loadDataByType();
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式");
|
logic.showToast('演示模式');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -113,37 +129,47 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
// height: 100.h,
|
// height: 100.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Obx(() => Column(
|
child: Obx(() => Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(TranslationLoader.lanKeys!.dailyCharts!.tr, style: TextStyle(color: state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)),
|
Text(TranslationLoader.lanKeys!.dailyCharts!.tr,
|
||||||
SizedBox(height: 10.h),
|
style: TextStyle(
|
||||||
Visibility(
|
color: state.isDay.value
|
||||||
visible: state.isDay.value,
|
? AppColors.mainColor
|
||||||
child: Container(
|
: Colors.black,
|
||||||
width: 20.w,
|
fontSize: 22.sp)),
|
||||||
height: 2.h,
|
SizedBox(height: 10.h),
|
||||||
color: state.isDay.value ? AppColors.mainColor : Colors.black
|
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,),
|
// SizedBox(width: 20.w,),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode =
|
||||||
if(isDemoMode == false){
|
await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isDay.value = false;
|
state.isDay.value = false;
|
||||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
final DateTime dateTime =
|
||||||
String beginDate = formatDate(dateTime, [mm]);
|
DateTime.fromMillisecondsSinceEpoch(
|
||||||
|
state.checkListDateTimestamp.value);
|
||||||
|
final String beginDate =
|
||||||
|
formatDate(dateTime, <String>[mm]);
|
||||||
state.checkListDate.value = beginDate;
|
state.checkListDate.value = beginDate;
|
||||||
logic.loadDataByType();
|
logic.loadDataByType();
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式");
|
logic.showToast('演示模式');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -151,49 +177,76 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
// height: 100.h,
|
// height: 100.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Obx(() => Column(
|
child: Obx(() => Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(TranslationLoader.lanKeys!.monthlyLeaderboard!.tr, style: TextStyle(color: !state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)),
|
Text(
|
||||||
SizedBox(height: 10.h),
|
TranslationLoader
|
||||||
Visibility(
|
.lanKeys!.monthlyLeaderboard!.tr,
|
||||||
visible: !state.isDay.value,
|
style: TextStyle(
|
||||||
child: Container(width: 20.w, height: 2.h, color: !state.isDay.value ? AppColors.mainColor : Colors.black))
|
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(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode =
|
||||||
if(isDemoMode == false){
|
await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return ShowCalendar(
|
return ShowCalendar(
|
||||||
datePickerMode: DatePickerMode.day,
|
datePickerMode: DatePickerMode.day,
|
||||||
selectAction: (dateTime) {
|
selectAction: (DateTime dateTime) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
|
state.checkListDateTimestamp.value =
|
||||||
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
|
dateTime.millisecondsSinceEpoch;
|
||||||
|
final String beginDate = formatDate(
|
||||||
|
dateTime,
|
||||||
|
state.isDay.value
|
||||||
|
? <String>[mm, '-', dd]
|
||||||
|
: <String>[mm]);
|
||||||
state.checkListDate.value = beginDate;
|
state.checkListDate.value = beginDate;
|
||||||
logic.loadDataByType();
|
logic.loadDataByType();
|
||||||
Get.back();
|
Get.back();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式");
|
logic.showToast('演示模式');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(state.checkListDate.value, style: TextStyle(color: Colors.black, fontSize: 22.sp),),
|
Text(
|
||||||
Image.asset('images/icon_grayPullDown.png', width: 50.w, height: 30.w,),
|
state.checkListDate.value,
|
||||||
SizedBox(width: 10.w,),
|
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() {
|
Widget middleDayInfo() {
|
||||||
return Obx(() => Visibility(
|
return Obx(() => Visibility(
|
||||||
visible: state.isDay.value,
|
visible: state.isDay.value,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 80.h,
|
height: 80.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
|
margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(height: 5.h),
|
Column(
|
||||||
Text(state.lateTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)),
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
Text(TranslationLoader.lanKeys!.beLate!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)),
|
children: <Widget>[
|
||||||
SizedBox(height: 5.h),
|
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(){
|
Widget getBottomList() {
|
||||||
if((state.isDay.value == true && (state.listType.value == "1")) || (state.isDay.value == true && (state.listType.value == "2"))){
|
if ((state.isDay.value == true && (state.listType.value == '1')) ||
|
||||||
|
(state.isDay.value == true && (state.listType.value == '2'))) {
|
||||||
return bottomDayList();
|
return bottomDayList();
|
||||||
}else{
|
} else {
|
||||||
return bottomMonthList();
|
return bottomMonthList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomDayList() {
|
Widget bottomDayList() {
|
||||||
return Obx(() => state.checkingInDayListData.value.isNotEmpty ? ListView.separated(
|
return Obx(() => state.checkingInDayListData.isNotEmpty
|
||||||
itemCount: state.checkingInDayListData.value.length,
|
? ListView.separated(
|
||||||
itemBuilder: (c, index) {
|
itemCount: state.checkingInDayListData.length,
|
||||||
AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index];
|
itemBuilder: (BuildContext c, int index) {
|
||||||
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () {
|
final AttendanceRecordDayList attendanceRecordList =
|
||||||
Get.toNamed(Routers.checkingInDetailPage, arguments: {
|
state.checkingInDayListData[index];
|
||||||
// "getKeyInfosData": state.getKeyInfosData.value,
|
return _checkingInListItem(
|
||||||
"companyId": state.companyId.value,
|
index,
|
||||||
"staffId": attendanceRecordList.staffId,
|
attendanceRecordList.headurl,
|
||||||
"staffName": attendanceRecordList.staffName,
|
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: (BuildContext context, int index) {
|
||||||
separatorBuilder: (context, index) {
|
return const Divider(height: 1, color: AppColors.greyLineColor);
|
||||||
return const Divider(height: 1, color: AppColors.greyLineColor);
|
},
|
||||||
},
|
)
|
||||||
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight*2 - 64.h - 280.h - 90.h,));
|
: NoData(
|
||||||
|
noDataHeight:
|
||||||
|
1.sh - ScreenUtil().statusBarHeight * 2 - 64.h - 280.h - 90.h,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomMonthList() {
|
Widget bottomMonthList() {
|
||||||
return Obx(() => state.checkingInMonthListData.value.isNotEmpty ? ListView.separated(
|
return Obx(() => state.checkingInMonthListData.isNotEmpty
|
||||||
itemCount: state.checkingInMonthListData.value.length,
|
? ListView.separated(
|
||||||
itemBuilder: (c, index) {
|
itemCount: state.checkingInMonthListData.length,
|
||||||
AttendanceRecordMonthList attendanceRecordList= state.checkingInMonthListData.value[index];
|
itemBuilder: (BuildContext c, int index) {
|
||||||
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () {
|
final AttendanceRecordMonthList attendanceRecordList =
|
||||||
Get.toNamed(Routers.checkingInDetailPage, arguments: {
|
state.checkingInMonthListData[index];
|
||||||
"companyId": state.companyId.value,
|
return _checkingInListItem(
|
||||||
"staffId": attendanceRecordList.staffId,
|
index,
|
||||||
"staffName": attendanceRecordList.staffName,
|
attendanceRecordList.headurl,
|
||||||
});
|
attendanceRecordList.staffName,
|
||||||
});
|
attendanceRecordList.attendanceType, () {
|
||||||
},
|
Get.toNamed(Routers.checkingInDetailPage,
|
||||||
separatorBuilder: (context, index) {
|
arguments: <String, Object?>{
|
||||||
return const Divider(height: 1, color: AppColors.greyLineColor);
|
'companyId': state.companyId.value,
|
||||||
},
|
'staffId': attendanceRecordList.staffId,
|
||||||
) : NoData(noDataHeight: 1.sh - - ScreenUtil().statusBarHeight - 280.h - 90.h,));
|
'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(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 80.h,
|
// 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(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(10.w),
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w,),
|
SizedBox(
|
||||||
Text("${index+1}", style: TextStyle(fontSize: 20.sp),),
|
width: 20.w,
|
||||||
SizedBox(width: 20.w,),
|
),
|
||||||
Image.asset('images/controls_user.png', width: 60.w, height: 60.w,),
|
Text(
|
||||||
// Container(
|
'${index + 1}',
|
||||||
// width: 60.h,
|
style: TextStyle(fontSize: 20.sp),
|
||||||
// height: 60.h,
|
),
|
||||||
// decoration: BoxDecoration(
|
SizedBox(
|
||||||
// color: AppColors.mainColor,
|
width: 20.w,
|
||||||
// border: Border.all(width: 1, color: AppColors.mainColor),
|
),
|
||||||
// borderRadius: BorderRadius.circular(30.h),
|
if (headUrl == null || headUrl == '')
|
||||||
// ),
|
Image.asset(
|
||||||
// padding: EdgeInsets.all(10.w),
|
getTypeIcon(type ?? 0),
|
||||||
// child: Image.asset(
|
width: 60.w,
|
||||||
// 'images/controls_user.png',
|
height: 60.w,
|
||||||
// width: 30.w,
|
)
|
||||||
// height: 30.w,
|
else
|
||||||
// color: Colors.white,
|
ClipRRect(
|
||||||
// )),
|
borderRadius: BorderRadius.circular(100.w),
|
||||||
|
child: Image.network(
|
||||||
|
headUrl,
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(name!, style: TextStyle(fontSize: 24.sp),),
|
child: Text(
|
||||||
|
name!,
|
||||||
|
style: TextStyle(fontSize: 24.sp),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.h),
|
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),
|
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() {
|
Widget titleWidget() {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if (isDemoMode == false) {
|
||||||
showListType();
|
showListType();
|
||||||
}else{
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast("演示模式");
|
logic.showToast('演示模式');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Obx(() => Container(
|
child: Obx(() => Container(
|
||||||
// width: 200.w,
|
// width: 200.w,
|
||||||
// height: 60.h,
|
// height: 60.h,
|
||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(state.listTypeStr.value, style: TextStyle(color: Colors.white, fontSize: 26.sp),),
|
Text(
|
||||||
SizedBox(width: 5.w,),
|
state.listTypeStr.value,
|
||||||
Image.asset('images/main/icon_lockDetail_checkIn_topTitle.png', width: 22.w, height: 16.w, fit: BoxFit.fill,)
|
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() {
|
void showListType() {
|
||||||
var list = [
|
final List<String> list = <String>[
|
||||||
TranslationLoader.lanKeys!.earlyArrivalList!.tr,
|
TranslationLoader.lanKeys!.earlyArrivalList!.tr,
|
||||||
TranslationLoader.lanKeys!.lateList!.tr,
|
TranslationLoader.lanKeys!.lateList!.tr,
|
||||||
TranslationLoader.lanKeys!.hardWorkingList!.tr
|
TranslationLoader.lanKeys!.hardWorkingList!.tr
|
||||||
@ -385,39 +517,39 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
//adapter: PickerAdapter(),
|
//adapter: PickerAdapter(),
|
||||||
data: list,
|
data: list,
|
||||||
//选择事件的回调
|
//选择事件的回调
|
||||||
clickCallBack: (int index, var str) {
|
clickCallBack: (int index, Object str) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.listTypeStr.value = str.toString();
|
state.listTypeStr.value = str.toString();
|
||||||
state.isDay.value = true;
|
state.isDay.value = true;
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
state.listType.value = "1";
|
state.listType.value = '1';
|
||||||
}else if(index == 1){
|
} else if (index == 1) {
|
||||||
state.listType.value = "2";
|
state.listType.value = '2';
|
||||||
}else if(index == 2){
|
} else if (index == 2) {
|
||||||
state.listType.value = "3";
|
state.listType.value = '3';
|
||||||
}
|
}
|
||||||
logic.loadDataByType();
|
logic.loadDataByType();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTopImg(){
|
String getTopImg() {
|
||||||
if(state.listType.value == "1"){
|
if (state.listType.value == '1') {
|
||||||
return "images/main/icon_lockDetail_checkInRanking_zd.png";
|
return 'images/main/icon_lockDetail_checkInRanking_zd.png';
|
||||||
}else if(state.listType.value == "2"){
|
} else if (state.listType.value == '2') {
|
||||||
return "images/main/icon_lockDetail_checkInRanking_cd.png";
|
return 'images/main/icon_lockDetail_checkInRanking_cd.png';
|
||||||
}else{
|
} else {
|
||||||
return "images/main/icon_lockDetail_checkInRanking_qf.png";
|
return 'images/main/icon_lockDetail_checkInRanking_qf.png';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTopTitle(){
|
String getTopTitle() {
|
||||||
if(state.listType.value == "1"){
|
if (state.listType.value == '1') {
|
||||||
return "无考勤记录";
|
return '无考勤记录';
|
||||||
}else if(state.listType.value == "2"){
|
} else if (state.listType.value == '2') {
|
||||||
return "大家干劲十足";
|
return '大家干劲十足';
|
||||||
}else{
|
} else {
|
||||||
return "工作时长未出炉";
|
return '工作时长未出炉';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
@ -22,8 +23,8 @@ class CheckingInSetPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||||
final logic = Get.put(CheckingInSetLogic());
|
final CheckingInSetLogic logic = Get.put(CheckingInSetLogic());
|
||||||
final state = Get.find<CheckingInSetLogic>().state;
|
final CheckingInSetState state = Get.find<CheckingInSetLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -31,17 +32,17 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle:
|
barTitle:
|
||||||
"${TranslationLoader.lanKeys!.checkingIn!.tr}${TranslationLoader.lanKeys!.set!.tr}",
|
'${TranslationLoader.lanKeys!.checkingIn!.tr}${TranslationLoader.lanKeys!.set!.tr}',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"公司名称".tr,
|
'公司名称'.tr,
|
||||||
// rightTitle: state.companyName.value ?? "",
|
rightTitle: state.companyName.value ?? '',
|
||||||
isHaveRightWidget: true,
|
// isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(),
|
// rightWidget: getTFWidget(),
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -53,23 +54,23 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
|
Get.toNamed(Routers.checkingInStaffManagePage, arguments: <String, Object>{
|
||||||
"getKeyInfosData": state.getKeyInfosData.value,
|
'getKeyInfosData': state.getKeyInfosData.value,
|
||||||
"companyId": state.companyId.value
|
'companyId': state.companyId.value
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
"${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,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
|
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: <String, Object>{
|
||||||
// "getKeyInfosData": state.getKeyInfosData.value,
|
// "getKeyInfosData": state.getKeyInfosData.value,
|
||||||
"companyId": state.companyId.value,
|
'companyId': state.companyId.value,
|
||||||
"pushType": "2",
|
'pushType': '2',
|
||||||
"checkingInSetInfo": state.checkingInSetInfo.value,
|
'checkingInSetInfo': state.checkingInSetInfo.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -84,30 +85,30 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}",
|
"${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,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: {
|
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: <String, Object>{
|
||||||
"getKeyInfosData": state.getKeyInfosData.value,
|
'getKeyInfosData': state.getKeyInfosData.value,
|
||||||
"companyId": state.companyId.value,
|
'companyId': state.companyId.value,
|
||||||
"pushType": "2",
|
'pushType': '2',
|
||||||
"checkingInSetInfo": state.checkingInSetInfo.value,
|
'checkingInSetInfo': state.checkingInSetInfo.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
state.isCustom.value = data["attendanceType"];
|
state.isCustom.value = data['attendanceType'];
|
||||||
state.weekDays.value = data["weekDays"];
|
state.weekDays.value = data['weekDays'];
|
||||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
state.weekDaysStr.value = state.weekDays.value.join(',');
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.holidays!.tr,
|
leftTitel: TranslationLoader.lanKeys!.holidays!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.checkingInSetHolidaysPage, arguments: {
|
Get.toNamed(Routers.checkingInSetHolidaysPage, arguments: <String, String>{
|
||||||
"companyId": state.companyId.value
|
'companyId': state.companyId.value
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -117,14 +118,14 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
visible: state.getKeyInfosData.value.isLockOwner == 1,
|
visible: state.getKeyInfosData.value.isLockOwner == 1,
|
||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName:
|
btnName:
|
||||||
"${TranslationLoader.lanKeys!.delete!.tr} ${TranslationLoader.lanKeys!.company!.tr}",
|
'${TranslationLoader.lanKeys!.delete!.tr} ${TranslationLoader.lanKeys!.company!.tr}',
|
||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
fontSize: 32.sp,
|
fontSize: 32.sp,
|
||||||
isDelete: true,
|
isDelete: true,
|
||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
||||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
ShowTipView().showIosTipWithContentDialog("是否删除?".tr, () {
|
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, () {
|
||||||
logic.deletCompanyData();
|
logic.deletCompanyData();
|
||||||
});
|
});
|
||||||
// showDeletCompanyAlertDialog(context);
|
// showDeletCompanyAlertDialog(context);
|
||||||
@ -140,12 +141,19 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title: "修改公司名字".tr,
|
title: '修改公司名字'.tr,
|
||||||
tipTitle: "",
|
tipTitle: '',
|
||||||
controller: state.changeNameController,
|
controller: state.changeNameController,
|
||||||
|
inputFormatters: <TextInputFormatter>[
|
||||||
|
LengthLimitingTextInputFormatter(30),
|
||||||
|
],
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
if(state.changeNameController.text.isEmpty){
|
if(state.changeNameController.text.isEmpty){
|
||||||
logic.showToast("请输入公司名字".tr);
|
logic.showToast('请输入公司名字'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(state.changeNameController.text.length <6){
|
||||||
|
logic.showToast('公司名字长度不能小于 6 '.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -159,7 +167,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
|
|
||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getTFWidget() {
|
Widget getTFWidget() {
|
||||||
state.nameController.text = state.companyName.value ?? "";
|
state.nameController.text = state.companyName.value ?? '';
|
||||||
return Container(
|
return Container(
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
height: 65.h,
|
height: 65.h,
|
||||||
@ -168,7 +176,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
|
|||||||
@ -6,28 +6,28 @@ import '../../../lockMian/entity/lockListInfo_entity.dart';
|
|||||||
import 'checkingInSet_entity.dart';
|
import 'checkingInSet_entity.dart';
|
||||||
|
|
||||||
class CheckingInSetState{
|
class CheckingInSetState{
|
||||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
CheckingInSetState() {
|
||||||
final companyId = "".obs;
|
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;// 工作天数
|
RxList<int> weekDays = <int>[].obs;// 工作天数
|
||||||
var weekDaysStr = "".obs;// 拼接显示的字符串天数
|
RxString weekDaysStr = ''.obs;// 拼接显示的字符串天数
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
RxString beginTime = ''.obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
RxString endTime = ''.obs;// 结束时间
|
||||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
RxString beginTimeTimestamp = ''.obs;// 开始时间时间戳
|
||||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
RxString endTimeTimestamp = ''.obs;// 结束时间时间戳
|
||||||
|
|
||||||
var staffNumber = "".obs;// 员工数量
|
RxString staffNumber = ''.obs;// 员工数量
|
||||||
var companyName = "".obs;// 公司名称
|
RxString companyName = ''.obs;// 公司名称
|
||||||
|
|
||||||
final TextEditingController changeNameController = TextEditingController();
|
final TextEditingController changeNameController = TextEditingController();
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
|
|
||||||
final checkingInSetInfo = CheckingInSetInfo().obs;
|
final Rx<CheckingInSetInfo> checkingInSetInfo = CheckingInSetInfo().obs;
|
||||||
CheckingInSetState() {
|
|
||||||
Map map = Get.arguments;
|
|
||||||
getKeyInfosData.value = map["getKeyInfosData"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -4,6 +4,8 @@ import 'dart:ffi';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.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 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
@ -23,30 +25,30 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getNumberEvent = eventBus
|
_getNumberEvent = eventBus
|
||||||
.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>()
|
.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>()
|
||||||
.listen((event) {
|
.listen((ChickInAddStaffCardAndFingerprintBlockNumberEvent event) {
|
||||||
state.attendanceWayNumber.value = event.number;
|
state.attendanceWayNumber.value = event.number;
|
||||||
isCanClickAction();
|
isCanClickAction();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加员工
|
// 添加员工
|
||||||
void addStaffLoadData() async {
|
Future<void> addStaffLoadData() async {
|
||||||
var usernameType = "1";
|
String usernameType = '1';
|
||||||
if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
|
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
||||||
usernameType = "2";
|
usernameType = '2';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
||||||
if (state.appUnHaveAccount.value &&
|
if (state.appUnHaveAccount.value &&
|
||||||
state.selectPrintingMethodType.value == "1") {
|
state.selectPrintingMethodType.value == '1') {
|
||||||
state.attendanceWayNumber.value = state.staffAccountController.text;
|
state.attendanceWayNumber.value = state.staffAccountController.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = await ApiRepository.to.addStaffData(
|
final LoginEntity entity = await ApiRepository.to.addStaffData(
|
||||||
attendanceType: state.selectPrintingMethodType.value,
|
attendanceType: state.selectPrintingMethodType.value,
|
||||||
attendanceWay: state.attendanceWayNumber.value,
|
attendanceWay: state.attendanceWayNumber.value,
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
have: state.appUnHaveAccount.value ? "2" : "1",
|
have: state.appUnHaveAccount.value ? '2' : '1',
|
||||||
staffName: state.staffNameController.text,
|
staffName: state.staffNameController.text,
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
usernameType: usernameType,
|
usernameType: usernameType,
|
||||||
@ -54,7 +56,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
eventBus.fire(RefreshCheckInSetDataEvent());
|
eventBus.fire(RefreshCheckInSetDataEvent());
|
||||||
eventBus.fire(RefreshCheckInListEvent());
|
eventBus.fire(RefreshCheckInListEvent());
|
||||||
Get.back(result: "addScuess");
|
Get.back(result: 'addScuess');
|
||||||
} else if (entity.errorCode! == 425) {
|
} else if (entity.errorCode! == 425) {
|
||||||
showToast(entity.errorMsg!);
|
showToast(entity.errorMsg!);
|
||||||
}
|
}
|
||||||
@ -62,8 +64,9 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,
|
// 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,
|
||||||
// attendanceWay分别为用户名、密码、卡号、指纹号
|
// attendanceWay分别为用户名、密码、卡号、指纹号
|
||||||
void addStaffSelectKey(KeyClickCallback kyClickCallback) async {
|
Future<void> addStaffSelectKey(KeyClickCallback kyClickCallback) async {
|
||||||
var entity = await ApiRepository.to.addStaffSelectKeyData(
|
final CheckingInAddStaffSelectKeyEntity entity =
|
||||||
|
await ApiRepository.to.addStaffSelectKeyData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
type: state.selectPrintingMethodType.value,
|
type: state.selectPrintingMethodType.value,
|
||||||
);
|
);
|
||||||
@ -74,18 +77,17 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 编辑员工
|
// 编辑员工
|
||||||
void editStaffLoadData() async {
|
Future<void> editStaffLoadData() async {
|
||||||
var usernameType = "1";
|
String usernameType = '1';
|
||||||
if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
|
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
||||||
usernameType = "2";
|
usernameType = '2';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final LoginEntity entity = await ApiRepository.to.editStaffData(
|
||||||
var entity = await ApiRepository.to.editStaffData(
|
|
||||||
attendanceType: state.selectPrintingMethodType.value,
|
attendanceType: state.selectPrintingMethodType.value,
|
||||||
attendanceWay: state.attendanceWayNumber.value,
|
attendanceWay: state.attendanceWayNumber.value,
|
||||||
staffId: state.staffListItemData.value.staffId.toString(),
|
staffId: state.staffListItemData.value.staffId.toString(),
|
||||||
have: state.appUnHaveAccount.value ? "2" : "1",
|
have: state.appUnHaveAccount.value ? '2' : '1',
|
||||||
staffName: state.staffNameController.text,
|
staffName: state.staffNameController.text,
|
||||||
countryCode: state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
usernameType: usernameType,
|
usernameType: usernameType,
|
||||||
@ -99,13 +101,13 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取密码请求
|
//获取密码请求
|
||||||
void getKeyboardPwdRequest() async {
|
Future<void> getKeyboardPwdRequest() async {
|
||||||
if (state.staffNameController.text.isEmpty) {
|
if (state.staffNameController.text.isEmpty) {
|
||||||
showToast("请输入姓名");
|
showToast('请输入姓名');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.getPasswordKey(
|
final PasswordKeyEntity entity = await ApiRepository.to.getPasswordKey(
|
||||||
endDate: "0",
|
endDate: '0',
|
||||||
keyboardPwdName: state.staffNameController.text,
|
keyboardPwdName: state.staffNameController.text,
|
||||||
keyboardPwdType: 2.toString(),
|
keyboardPwdType: 2.toString(),
|
||||||
lockId: state.getKeyInfosData.value.lockId.toString(),
|
lockId: state.getKeyInfosData.value.lockId.toString(),
|
||||||
@ -136,7 +138,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 是否能点击
|
// 是否能点击
|
||||||
void isCanClickAction() {
|
void isCanClickAction() {
|
||||||
if (state.selectPrintingMethodType.value == "1" &&
|
if (state.selectPrintingMethodType.value == '1' &&
|
||||||
state.appUnHaveAccount.value) {
|
state.appUnHaveAccount.value) {
|
||||||
// 没有账号的时候直接判断姓名和账号是否为空
|
// 没有账号的时候直接判断姓名和账号是否为空
|
||||||
state.isCanClick.value =
|
state.isCanClick.value =
|
||||||
@ -154,6 +156,8 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
_initLoadDataAction();
|
_initLoadDataAction();
|
||||||
|
|
||||||
changeInput(state.staffNameController);
|
changeInput(state.staffNameController);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSelectKey_entity.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/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart';
|
||||||
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -44,7 +46,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}',
|
||||||
state.staffNameController)),
|
state.staffNameController)),
|
||||||
// 选择打卡方式
|
// 选择打卡方式
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -59,10 +61,13 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
'卡'.tr,
|
'卡'.tr,
|
||||||
'指纹'.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);
|
list.add('人脸'.tr);
|
||||||
}
|
}
|
||||||
_showSelectClockInType(list, list, '1', '选择钥匙'.tr);
|
_showSelectClockInType(list, list, list, '1', '选择钥匙'.tr);
|
||||||
})),
|
})),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
//员工是否有App、卡、钥匙、指纹必须显示
|
//员工是否有App、卡、钥匙、指纹必须显示
|
||||||
@ -96,10 +101,8 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
))),
|
))),
|
||||||
// 当选择App时且没有钥匙的时候 显示输入账号输入框和选择国家 其他隐藏
|
// 当选择App时且没有钥匙的时候 显示输入账号输入框和选择国家 其他隐藏
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: (state.appUnHaveAccount.value &&
|
visible: state.appUnHaveAccount.value &&
|
||||||
state.selectPrintingMethodType.value == '1')
|
state.selectPrintingMethodType.value == '1',
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -166,7 +169,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final data = await Get.toNamed(
|
final dynamic data = await Get.toNamed(
|
||||||
Routers.addCardPage,
|
Routers.addCardPage,
|
||||||
arguments: <String, Object?>{
|
arguments: <String, Object?>{
|
||||||
'lockId':
|
'lockId':
|
||||||
@ -228,9 +231,14 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
// 当选择钥匙类型为有时 必显示
|
// 当选择钥匙类型为有时 必显示
|
||||||
Obx(() {
|
Obx(() {
|
||||||
final bool isPass = state.selectPrintingMethodType.value == '2';
|
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) {
|
if (isPass) {
|
||||||
rightTitle = showPass(rightTitle);
|
attendanceWayNumber = showPass(attendanceWayNumber);
|
||||||
|
}
|
||||||
|
String rightTitle = attendanceWayNumber;
|
||||||
|
if (attendanceWayName.trim() != '') {
|
||||||
|
rightTitle = '$attendanceWayName - ' + rightTitle;
|
||||||
}
|
}
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: !state.appUnHaveAccount.value,
|
visible: !state.appUnHaveAccount.value,
|
||||||
@ -243,6 +251,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
logic.addStaffSelectKey(
|
logic.addStaffSelectKey(
|
||||||
(List<CheckingInAddStaffKeyEntity> v) {
|
(List<CheckingInAddStaffKeyEntity> v) {
|
||||||
final List<String> showList = <String>[];
|
final List<String> showList = <String>[];
|
||||||
|
final List<String> nameList = <String>[];
|
||||||
final List<String> numberList = <String>[];
|
final List<String> numberList = <String>[];
|
||||||
for (final CheckingInAddStaffKeyEntity element in v) {
|
for (final CheckingInAddStaffKeyEntity element in v) {
|
||||||
final bool isPass =
|
final bool isPass =
|
||||||
@ -252,12 +261,13 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
attendanceWay = showPass(attendanceWay);
|
attendanceWay = showPass(attendanceWay);
|
||||||
}
|
}
|
||||||
final String text =
|
final String text =
|
||||||
'${element.staffName}-$attendanceWay';
|
'${element.staffName} - $attendanceWay';
|
||||||
showList.add(text);
|
showList.add(text);
|
||||||
numberList.add(element.attendanceWay ?? '');
|
numberList.add(element.attendanceWay ?? '');
|
||||||
|
nameList.add(element.staffName ?? '');
|
||||||
}
|
}
|
||||||
_showSelectClockInType(showList, numberList, '2',
|
_showSelectClockInType(showList, numberList, nameList,
|
||||||
addStaffSelectKeySelectClockInType());
|
'2', addStaffSelectKeySelectClockInType());
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -344,8 +354,8 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// type 1 打卡方式 2选择钥匙
|
// type 1 打卡方式 2选择钥匙
|
||||||
void _showSelectClockInType(List showList, List numberList,
|
void _showSelectClockInType(List<String> showList, List<String> numberList,
|
||||||
String showBottomSheetToolType, String title) {
|
List<String> nameList, String showBottomSheetToolType, String title) {
|
||||||
ShowBottomSheetTool().showSingleRowPicker(
|
ShowBottomSheetTool().showSingleRowPicker(
|
||||||
//上下文
|
//上下文
|
||||||
context,
|
context,
|
||||||
@ -364,8 +374,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
if (showBottomSheetToolType == '1') {
|
if (showBottomSheetToolType == '1') {
|
||||||
state.selectPrintingMethodType.value = (index + 1).toString();
|
state.selectPrintingMethodType.value = (index + 1).toString();
|
||||||
state.selectPrintingMethodStr.value = str.toString();
|
state.selectPrintingMethodStr.value = str.toString();
|
||||||
|
state.attendanceWayName.value = '';
|
||||||
state.attendanceWayNumber.value = '';
|
state.attendanceWayNumber.value = '';
|
||||||
} else {
|
} else {
|
||||||
|
state.attendanceWayName.value = nameList[index].toString();
|
||||||
state.attendanceWayNumber.value = numberList[index].toString();
|
state.attendanceWayNumber.value = numberList[index].toString();
|
||||||
}
|
}
|
||||||
logic.isCanClickAction();
|
logic.isCanClickAction();
|
||||||
|
|||||||
@ -6,59 +6,34 @@ import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
|
|||||||
import 'checkingInAddStaffSelectKey_entity.dart';
|
import 'checkingInAddStaffSelectKey_entity.dart';
|
||||||
|
|
||||||
class CheckingInAddStaffState {
|
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() {
|
CheckingInAddStaffState() {
|
||||||
Map map = Get.arguments;
|
final Map<dynamic, dynamic> map = Get.arguments;
|
||||||
getKeyInfosData.value = map["getKeyInfosData"];
|
getKeyInfosData.value = map['getKeyInfosData'];
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
|
|
||||||
isAdd.value = map["isAdd"];
|
isAdd.value = map['isAdd'];
|
||||||
if (isAdd.value == "2") {
|
if (isAdd.value == '2') {
|
||||||
staffListItemData.value = map["staffListItem"];
|
staffListItemData.value = map['staffListItem'];
|
||||||
staffNameController.text = staffListItemData.value.staffName!;
|
staffNameController.text = staffListItemData.value.staffName!;
|
||||||
|
|
||||||
selectPrintingMethodType.value =
|
selectPrintingMethodType.value =
|
||||||
staffListItemData.value.attendanceType.toString();
|
staffListItemData.value.attendanceType.toString();
|
||||||
switch (staffListItemData.value.attendanceType) {
|
switch (staffListItemData.value.attendanceType) {
|
||||||
case 1:
|
case 1:
|
||||||
selectPrintingMethodStr.value = "APP";
|
selectPrintingMethodStr.value = 'APP';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
selectPrintingMethodStr.value = "密码".tr;
|
selectPrintingMethodStr.value = '密码'.tr;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
selectPrintingMethodStr.value = "卡".tr;
|
selectPrintingMethodStr.value = '卡'.tr;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
selectPrintingMethodStr.value = "指纹".tr;
|
selectPrintingMethodStr.value = '指纹'.tr;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
selectPrintingMethodStr.value = '人脸'.tr;
|
||||||
break;
|
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_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.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 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
@ -23,8 +24,10 @@ class CheckingInStaffListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||||
final logic = Get.put(CheckingInStaffManageLogic());
|
final CheckingInStaffManageLogic logic =
|
||||||
final state = Get.find<CheckingInStaffManageLogic>().state;
|
Get.put(CheckingInStaffManageLogic());
|
||||||
|
final CheckingInStaffManageState state =
|
||||||
|
Get.find<CheckingInStaffManageLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -34,15 +37,17 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
barTitle: TranslationLoader.lanKeys!.staff!.tr,
|
barTitle: TranslationLoader.lanKeys!.staff!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var data = await Get.toNamed(Routers.checkingInAddStaffPage, arguments: {
|
final dynamic data = await Get.toNamed(
|
||||||
"getKeyInfosData": state.getKeyInfosData.value,
|
Routers.checkingInAddStaffPage,
|
||||||
"companyId": state.companyId.value,
|
arguments: <String, Object>{
|
||||||
"isAdd": "1",
|
'getKeyInfosData': state.getKeyInfosData.value,
|
||||||
});
|
'companyId': state.companyId.value,
|
||||||
if(data != null) {
|
'isAdd': '1',
|
||||||
|
});
|
||||||
|
if (data != null) {
|
||||||
logic.getStaffList();
|
logic.getStaffList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -58,65 +63,76 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Obx(() => state.staffListData.value.isNotEmpty ?
|
child: Obx(() => state.staffListData.isNotEmpty
|
||||||
SlidableAutoCloseBehavior(
|
? SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.staffListData.value.length,
|
itemCount: state.staffListData.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
|
final CheckingInAddStaffListItemEntity staffListItem =
|
||||||
return Slidable(
|
state.staffListData[index];
|
||||||
key:ValueKey(staffListItem.staffId),
|
return Slidable(
|
||||||
endActionPane: ActionPane(
|
key: ValueKey<int?>(staffListItem.staffId),
|
||||||
extentRatio: 0.2,
|
endActionPane: ActionPane(
|
||||||
motion: const ScrollMotion(),
|
extentRatio: 0.2,
|
||||||
children: [
|
motion: const ScrollMotion(),
|
||||||
SlidableAction(
|
children: <Widget>[
|
||||||
onPressed: (BuildContext context){
|
SlidableAction(
|
||||||
// 1APP 2密码 3卡 4指纹 5人脸
|
onPressed: (BuildContext context) {
|
||||||
if(staffListItem.attendanceType == 1){
|
// 1APP 2密码 3卡 4指纹 5人脸
|
||||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (isAllData) {
|
if (staffListItem.attendanceType == 1) {
|
||||||
logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0));
|
ShowTipView()
|
||||||
});
|
.showDeleteAdministratorIsHaveAllDataDialog(
|
||||||
}else{
|
'同时删除员工钥匙'.tr, (bool isAllData) {
|
||||||
ShowTipView().showIosTipWithContentDialog("确定要删除员工吗?".tr, () {
|
logic.deletStaff(staffListItem.staffId!,
|
||||||
logic.deletStaff(staffListItem.staffId!, 0);
|
(isAllData ? 1 : 0));
|
||||||
});
|
});
|
||||||
// showIosTipViewDialog(staffListItem.staffId!, context);
|
} else {
|
||||||
}
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
},
|
'确定要删除员工吗?'.tr, () {
|
||||||
backgroundColor: Colors.red,
|
logic.deletStaff(staffListItem.staffId!, 0);
|
||||||
foregroundColor: Colors.white,
|
});
|
||||||
label: '删除'.tr,
|
// showIosTipViewDialog(staffListItem.staffId!, context);
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
}
|
||||||
),
|
},
|
||||||
],
|
backgroundColor: Colors.red,
|
||||||
),
|
foregroundColor: Colors.white,
|
||||||
child: _checkingInStaffManageItem(staffListItem, () {
|
label: '删除'.tr,
|
||||||
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
"staffListItem": staffListItem,
|
),
|
||||||
"getKeyInfosData": state.getKeyInfosData.value,
|
],
|
||||||
"companyId": state.companyId.value,
|
),
|
||||||
});
|
child: _checkingInStaffManageItem(staffListItem, () {
|
||||||
}),
|
Get.toNamed(Routers.checkingInStaffDetailPage,
|
||||||
);
|
arguments: <String, Object>{
|
||||||
|
'staffListItem': staffListItem,
|
||||||
|
'getKeyInfosData': state.getKeyInfosData.value,
|
||||||
|
'companyId': state.companyId.value,
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// return _checkingInStaffManageItem(staffListItem, () {
|
// return _checkingInStaffManageItem(staffListItem, () {
|
||||||
// Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
|
// Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
|
||||||
// "staffListItem": staffListItem,
|
// "staffListItem": staffListItem,
|
||||||
// "getKeyInfosData": state.getKeyInfosData.value,
|
// "getKeyInfosData": state.getKeyInfosData.value,
|
||||||
// "companyId": state.companyId.value,
|
// "companyId": state.companyId.value,
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return Divider(height: 1.h, indent: 20.w, color: AppColors.greyLineColor);
|
return Divider(
|
||||||
},
|
height: 1.h,
|
||||||
),
|
indent: 20.w,
|
||||||
) : NoData()),
|
color: AppColors.greyLineColor);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: NoData()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _checkingInStaffManageItem(CheckingInAddStaffListItemEntity staffListItem, Function() action) {
|
Widget _checkingInStaffManageItem(
|
||||||
|
CheckingInAddStaffListItemEntity staffListItem, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -125,35 +141,41 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
|
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w,),
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
|
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
|
||||||
Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w),
|
Image.asset(getTypeIcon(staffListItem.attendanceType!),
|
||||||
SizedBox(width: 20.w,),
|
width: 60.w, height: 60.w),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 20.w - 60.w - 20.w - 30.w,
|
width: 1.sw - 20.w - 60.w - 20.w - 30.w,
|
||||||
child: Text(staffListItem.staffName!,
|
child: Text(staffListItem.staffName!,
|
||||||
// maxLines: 1,
|
// maxLines: 1,
|
||||||
// overflow: TextOverflow.ellipsis,
|
// overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 24.sp)
|
style: TextStyle(fontSize: 24.sp))),
|
||||||
)
|
|
||||||
),
|
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: staffListItem.cardStatus == 1 ? true : false,
|
visible: staffListItem.cardStatus == 1,
|
||||||
child: SizedBox(height: 5.h,)
|
child: SizedBox(
|
||||||
),
|
height: 5.h,
|
||||||
|
)),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: staffListItem.cardStatus == 1 ? true : false,
|
visible: staffListItem.cardStatus == 1,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
color: AppColors.openPassageModeColor,
|
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';
|
String title = 'images/controls_user.png';
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
// 蓝牙开锁
|
// 蓝牙开锁
|
||||||
title = 'images/controls_user.png';
|
title = 'images/controls_user.png';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 密码开锁
|
// 密码开锁
|
||||||
title = 'images/icon_password.png';
|
title = 'images/icon_password.png';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// ic卡
|
// ic卡
|
||||||
title = 'images/icon_card.png';
|
title = 'images/icon_card.png';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// 指纹开锁
|
// 指纹开锁
|
||||||
title = 'images/icon_fingerprint.png';
|
title = 'images/icon_fingerprint.png';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -190,23 +212,22 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void showIosTipViewDialog(int staffId, BuildContext context) {
|
// void showIosTipViewDialog(int staffId, BuildContext context) {
|
||||||
// showDialog(
|
// showDialog(
|
||||||
// context: context,
|
// context: context,
|
||||||
// builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
// return ShowIosTipView(
|
// return ShowIosTipView(
|
||||||
// title: "提示",
|
// title: "提示",
|
||||||
// tipTitle: "确定要删除员工吗?",
|
// tipTitle: "确定要删除员工吗?",
|
||||||
// sureClick: () async {
|
// sureClick: () async {
|
||||||
// Get.back();
|
// Get.back();
|
||||||
// logic.deletStaff(staffId, 0);
|
// logic.deletStaff(staffId, 0);
|
||||||
// },
|
// },
|
||||||
// cancelClick: () {
|
// cancelClick: () {
|
||||||
// Get.back();
|
// Get.back();
|
||||||
// },
|
// },
|
||||||
// );
|
// );
|
||||||
// },
|
// },
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
@ -7,6 +6,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.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';
|
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
void initReplySubscription() {
|
void initReplySubscription() {
|
||||||
state.replySubscription =
|
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) {
|
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||||
_replyOpenLock(reply);
|
_replyOpenLock(reply);
|
||||||
@ -51,7 +52,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 开门数据解析
|
// 开门数据解析
|
||||||
Future<void> _replyOpenLock(Reply reply) async {
|
Future<void> _replyOpenLock(Reply reply) async {
|
||||||
int status = reply.data[6];
|
final int status = reply.data[6];
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -62,19 +63,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
state.closedUnlockSuccessfulTimer?.cancel();
|
state.closedUnlockSuccessfulTimer?.cancel();
|
||||||
// 如果没有点击关闭弹窗,3秒后自动关闭
|
// 如果没有点击关闭弹窗,3秒后自动关闭
|
||||||
state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (timer) {
|
state.closedUnlockSuccessfulTimer =
|
||||||
|
Timer.periodic(3.seconds, (Timer timer) {
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
});
|
});
|
||||||
|
|
||||||
// 电量
|
// 电量
|
||||||
int power = reply.data[7];
|
final int power = reply.data[7];
|
||||||
state.electricQuantity.value = power;
|
state.electricQuantity.value = power;
|
||||||
|
|
||||||
// 备用电量
|
// 备用电量
|
||||||
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
|
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
|
||||||
int powerStandby = reply.data[9];
|
final int powerStandby = reply.data[9];
|
||||||
state.electricQuantityStandby.value = powerStandby;
|
state.electricQuantityStandby.value = powerStandby;
|
||||||
}
|
}
|
||||||
// 更新电量
|
// 更新电量
|
||||||
@ -85,14 +87,17 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var tokenData = reply.data.sublist(2, 6);
|
final List<int> tokenData = reply.data.sublist(2, 6);
|
||||||
var saveStrList = changeIntListToStringList(tokenData);
|
final List<String> saveStrList = changeIntListToStringList(tokenData);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
@ -110,7 +115,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
case 0x16:
|
case 0x16:
|
||||||
// 正在开锁中...
|
// 正在开锁中...
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
showToast("正在开锁中...".tr, something: () {
|
showToast('正在开锁中...'.tr, something: () {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -132,7 +137,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
// 钥匙不存在
|
// 钥匙不存在
|
||||||
showToast("钥匙不存在");
|
showToast('钥匙不存在');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -140,7 +145,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
// 钥匙数量已到上限
|
// 钥匙数量已到上限
|
||||||
showToast("钥匙数量已到上限");
|
showToast('钥匙数量已到上限');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -148,7 +153,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0e:
|
case 0x0e:
|
||||||
// 钥匙已存在
|
// 钥匙已存在
|
||||||
showToast("钥匙已存在");
|
showToast('钥匙已存在');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -156,7 +161,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
// 用户已存在
|
// 用户已存在
|
||||||
showToast("用户已存在");
|
showToast('用户已存在');
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -164,7 +169,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
AppLog.log("开锁失败");
|
AppLog.log('开锁失败');
|
||||||
// state.animationController!.stop();
|
// state.animationController!.stop();
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -183,11 +188,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 根据时间查解析数据
|
// 根据时间查解析数据
|
||||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
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");
|
// AppLog.log("dataLength:$dataLength");
|
||||||
if (dataLength > 0) {
|
if (dataLength > 0) {
|
||||||
reply.data.removeRange(0, 7);
|
reply.data.removeRange(0, 7);
|
||||||
@ -195,32 +200,32 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
if (reply.data.length < 17) {
|
if (reply.data.length < 17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var getList = splitList(reply.data, 17);
|
final List<List<int>> getList = splitList(reply.data, 17);
|
||||||
// AppLog.log("getList:$getList");
|
// AppLog.log("getList:$getList");
|
||||||
var uploadList = [];
|
final List uploadList = [];
|
||||||
for (int i = 0; i < getList.length; i++) {
|
for (int i = 0; i < getList.length; i++) {
|
||||||
var indexList = getList[i];
|
final List<int> indexList = getList[i];
|
||||||
// AppLog.log("indexList:$indexList");
|
// AppLog.log("indexList:$indexList");
|
||||||
var indexMap = {};
|
final Map indexMap = {};
|
||||||
indexMap["type"] = indexList[0].toString();
|
indexMap['type'] = indexList[0].toString();
|
||||||
int operateDate = 0;
|
int operateDate = 0;
|
||||||
if (indexList[0] == 2) {
|
if (indexList[0] == 2) {
|
||||||
var passwordData = reply.data.sublist(7, 17);
|
final List<int> passwordData = reply.data.sublist(7, 17);
|
||||||
var password = utf8String(passwordData);
|
final String password = utf8String(passwordData);
|
||||||
indexMap["user"] = password.toString();
|
indexMap['user'] = password.toString();
|
||||||
} else {
|
} else {
|
||||||
int userNo = (indexList[1] * 256) + indexList[2];
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap["user"] = userNo.toString();
|
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[4]) << 16 |
|
||||||
(0xff & indexList[5]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[6]));
|
(0xFF & indexList[6]));
|
||||||
operateDate = time * 1000;
|
operateDate = time * 1000;
|
||||||
indexMap["date"] = "$operateDate";
|
indexMap['date'] = '$operateDate';
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
|
|
||||||
if (i == getList.length - 1) {
|
if (i == getList.length - 1) {
|
||||||
@ -256,14 +261,15 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// BlueManage().stopScan();
|
// BlueManage().stopScan();
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
});
|
});
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
BlueManage()
|
BlueManage()
|
||||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
@ -303,14 +309,18 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState connectionState) async {
|
(BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<String>? publicKey =
|
||||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
await Storage.getStringList(saveBluePublicKey);
|
||||||
|
final List<int> getPublicKeyList =
|
||||||
|
changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
IoSenderManage.senderReferEventRecordTimeCommand(
|
IoSenderManage.senderReferEventRecordTimeCommand(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
@ -329,7 +339,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
void getServerDatetime() async {
|
void getServerDatetime() async {
|
||||||
var entity = await ApiRepository.to.getServerDatetimeData();
|
final GetServerDatetimeEntity entity =
|
||||||
|
await ApiRepository.to.getServerDatetimeData();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
state.differentialTime = entity.data!.date! ~/ 1000 -
|
||||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
@ -344,17 +355,17 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||||
void getLockNetToken() async {
|
void getLockNetToken() async {
|
||||||
LockNetTokenEntity entity = await ApiRepository.to
|
final LockNetTokenEntity entity = await ApiRepository.to
|
||||||
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockNetToken = entity.data!.token!.toString();
|
state.lockNetToken = entity.data!.token!.toString();
|
||||||
AppLog.log("从服务器获取联网token:${state.lockNetToken}");
|
AppLog.log('从服务器获取联网token:${state.lockNetToken}');
|
||||||
openDoorAction();
|
openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
showToast("网络访问失败,请检查网络是否正常".tr, something: () {
|
showToast('网络访问失败,请检查网络是否正常'.tr, something: () {
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.lockNetToken = "0";
|
state.lockNetToken = '0';
|
||||||
openDoorAction();
|
openDoorAction();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -362,7 +373,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//电量更新请求
|
//电量更新请求
|
||||||
Future<void> uploadElectricQuantityRequest() async {
|
Future<void> uploadElectricQuantityRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.uploadElectricQuantity(
|
.uploadElectricQuantity(
|
||||||
electricQuantity: state.electricQuantity.value.toString(),
|
electricQuantity: state.electricQuantity.value.toString(),
|
||||||
electricQuantityStandby:
|
electricQuantityStandby:
|
||||||
@ -371,15 +382,15 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
isUnShowLoading: true);
|
isUnShowLoading: true);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
void getLockRecordLastUploadDataTime() async {
|
||||||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
final LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||||
.getLockRecordLastUploadDataTime(
|
await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||||
lockId: state.keyInfos.value.lockId.toString());
|
lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||||
@ -388,14 +399,14 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 操作记录上传
|
// 操作记录上传
|
||||||
void lockRecordUploadData(List list) async {
|
Future<void> lockRecordUploadData(List list) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.lockRecordUploadData(
|
.lockRecordUploadData(
|
||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
AppLog.log(
|
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) {
|
if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) {
|
||||||
// 单次删除
|
// 单次删除
|
||||||
deletKeyData();
|
deletKeyData();
|
||||||
@ -405,10 +416,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 普通用户或者授权管理员删除钥匙
|
// 普通用户或者授权管理员删除钥匙
|
||||||
void deletKeyData() async {
|
void deletKeyData() async {
|
||||||
var entity = await ApiRepository.to.deleteElectronicKey(
|
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
.deleteElectronicKey(
|
||||||
|
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
BlueManage().connectDeviceMacAddress = "";
|
BlueManage().connectDeviceMacAddress = '';
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
});
|
});
|
||||||
@ -422,7 +434,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
|
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
|
||||||
eventBus
|
eventBus
|
||||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||||
.listen((event) {
|
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
||||||
if (event.type == 0) {
|
if (event.type == 0) {
|
||||||
// 0考勤
|
// 0考勤
|
||||||
state.isAttendance.value = int.parse(event.setResult);
|
state.isAttendance.value = int.parse(event.setResult);
|
||||||
@ -433,7 +445,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||||
int.parse(event.setResult);
|
int.parse(event.setResult);
|
||||||
state.lockNetToken = ""; // 改变开锁时是否联网状态的时候清空token
|
state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token
|
||||||
} else if (event.type == 2) {
|
} else if (event.type == 2) {
|
||||||
// 2 常开模式
|
// 2 常开模式
|
||||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||||
@ -458,7 +470,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getKeyStatusTextAndShow() {
|
String getKeyStatusTextAndShow() {
|
||||||
String text = "";
|
String text = '';
|
||||||
if (state.keyInfos.value.keyStatus ==
|
if (state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitIneffective ||
|
XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
@ -469,7 +481,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
||||||
} else {
|
} else {
|
||||||
text = state.isOpenPassageMode.value == 1
|
text = state.isOpenPassageMode.value == 1
|
||||||
? "常开模式启动!长按闭锁".tr
|
? '常开模式启动!长按闭锁'.tr
|
||||||
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
|
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
@ -477,9 +489,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
String getCurrentFormattedTime() {
|
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;
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.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/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/showTipView.dart';
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
@ -44,8 +45,8 @@ class LockDetailPage extends StatefulWidget {
|
|||||||
class _LockDetailPageState extends State<LockDetailPage>
|
class _LockDetailPageState extends State<LockDetailPage>
|
||||||
with TickerProviderStateMixin, RouteAware {
|
with TickerProviderStateMixin, RouteAware {
|
||||||
// with RouteAware
|
// with RouteAware
|
||||||
final logic = Get.put(LockDetailLogic());
|
final LockDetailLogic logic = Get.put(LockDetailLogic());
|
||||||
final state = Get.find<LockDetailLogic>().state;
|
final LockDetailState state = Get.find<LockDetailLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -75,8 +76,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
void _initRefreshLockDetailInfoDataEventAction() {
|
void _initRefreshLockDetailInfoDataEventAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockRefreshLockDetailInfoDataEvent =
|
_lockRefreshLockDetailInfoDataEvent = eventBus
|
||||||
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
.on<RefreshLockDetailInfoDataEvent>()
|
||||||
|
.listen((RefreshLockDetailInfoDataEvent event) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -114,26 +116,28 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
BlueManage().connectDeviceName =
|
BlueManage().connectDeviceName =
|
||||||
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
|
|
||||||
List<int> publicKeyData =
|
final List<int> publicKeyData =
|
||||||
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
final List<String> saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
List<int> privateKeyData =
|
final List<int> privateKeyData =
|
||||||
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
final List<String> savePrivateKeyList =
|
||||||
|
changeIntListToStringList(privateKeyData);
|
||||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
|
|
||||||
// signKey
|
// signKey
|
||||||
List<int> signKeyData =
|
final List<int> signKeyData =
|
||||||
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
||||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
final List<String> saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||||
|
|
||||||
bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
||||||
if (!ifHaveKey) {
|
if (!ifHaveKey) {
|
||||||
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
final List<String> saveTokenList =
|
||||||
|
changeIntListToStringList(<int>[0, 0, 0, 0]);
|
||||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
loadData();
|
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,
|
backgroundColor: Colors.white,
|
||||||
body: Obx(() {
|
body: Obx(() {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 35.h,
|
height: 35.h,
|
||||||
),
|
),
|
||||||
@ -193,7 +197,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(16.r),
|
borderRadius: BorderRadius.circular(16.r),
|
||||||
boxShadow: [
|
boxShadow: <BoxShadow>[
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.15),
|
color: Colors.black.withOpacity(0.15),
|
||||||
offset: const Offset(0, 0),
|
offset: const Offset(0, 0),
|
||||||
@ -202,7 +206,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
img,
|
img,
|
||||||
width: 32.r,
|
width: 32.r,
|
||||||
@ -236,7 +240,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(20.r),
|
borderRadius: BorderRadius.circular(20.r),
|
||||||
boxShadow: [
|
boxShadow: <BoxShadow>[
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.15),
|
color: Colors.black.withOpacity(0.15),
|
||||||
offset: const Offset(0, 0),
|
offset: const Offset(0, 0),
|
||||||
@ -247,19 +251,15 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: state.openDoorBtnisUneable.value == true
|
onTap: state.openDoorBtnisUneable.value == true
|
||||||
? () {
|
? isNeedRealNameAuthThenOpenLock
|
||||||
isNeedRealNameAuthThenOpenLock();
|
|
||||||
}
|
|
||||||
: null,
|
: null,
|
||||||
onLongPressStart: state.openDoorBtnisUneable.value == true
|
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||||
? (details) {
|
? (LongPressStartDetails details) {
|
||||||
setState(() {
|
setState(startUnLock);
|
||||||
startUnLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -268,7 +268,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(100.w),
|
borderRadius: BorderRadius.circular(100.w),
|
||||||
boxShadow: [
|
boxShadow: <BoxShadow>[
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.3),
|
color: Colors.black.withOpacity(0.3),
|
||||||
offset: const Offset(0, 0),
|
offset: const Offset(0, 0),
|
||||||
@ -279,42 +279,44 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
state.openDoorBtnisUneable.value == false
|
if (state.openDoorBtnisUneable.value == false)
|
||||||
? Icon(
|
Icon(
|
||||||
Icons.bluetooth_searching,
|
Icons.bluetooth_searching,
|
||||||
size: 48.r,
|
size: 48.r,
|
||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
)
|
)
|
||||||
: Image.asset(
|
else
|
||||||
state.isOpenPassageMode.value == 1
|
Image.asset(
|
||||||
? 'images/icon_lock_err.png'
|
state.isOpenPassageMode.value == 1
|
||||||
: 'images/icon_lock_fill.png',
|
? 'images/icon_lock_err.png'
|
||||||
width: 38.r,
|
: 'images/icon_lock_fill.png',
|
||||||
height: 38.r,
|
width: 38.r,
|
||||||
color: AppColors.mainColor,
|
height: 38.r,
|
||||||
),
|
color: AppColors.mainColor,
|
||||||
state.openDoorBtnisUneable.value == false
|
),
|
||||||
? Positioned(
|
if (state.openDoorBtnisUneable.value == false)
|
||||||
child: Icon(
|
Positioned(
|
||||||
Icons.bluetooth_searching,
|
child: Icon(
|
||||||
size: 96.r,
|
Icons.bluetooth_searching,
|
||||||
),
|
size: 96.r,
|
||||||
)
|
),
|
||||||
: state.openLockBtnState.value == 1
|
)
|
||||||
? xhjBuildRotationTransition(
|
else
|
||||||
width: 88.r,
|
state.openLockBtnState.value == 1
|
||||||
height: 88.r,
|
? xhjBuildRotationTransition(
|
||||||
)
|
width: 88.r,
|
||||||
: Positioned(
|
height: 88.r,
|
||||||
child: Image.asset(
|
)
|
||||||
'images/icon_circle_dotted.png',
|
: Positioned(
|
||||||
width: 88.r,
|
child: Image.asset(
|
||||||
height: 88.r,
|
'images/icon_circle_dotted.png',
|
||||||
color: state.isOpenPassageMode.value == 1
|
width: 88.r,
|
||||||
? Colors.red
|
height: 88.r,
|
||||||
: AppColors.mainColor,
|
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),
|
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
TranslationLoader
|
TranslationLoader
|
||||||
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
|
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
|
||||||
@ -341,16 +343,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
showElectricIcon(state.electricQuantity.value),
|
showElectricIcon(state.electricQuantity.value),
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 24.w),
|
height: 24.w),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("${state.electricQuantity.value}%",
|
Text('${state.electricQuantity.value}%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -368,13 +370,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
showElectricIcon(state.electricQuantity.value),
|
showElectricIcon(state.electricQuantity.value),
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
height: 24.w),
|
height: 24.w),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("--%",
|
Text('--%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -400,32 +402,30 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
//斯凯布局
|
//斯凯布局
|
||||||
Widget skWidget() {
|
Widget skWidget() {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible:
|
visible:
|
||||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
state.keyInfos.value.keyType ==
|
state.keyInfos.value.keyType ==
|
||||||
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
(DateTool().compareTimeGetDaysFromNow(
|
(DateTool().compareTimeGetDaysFromNow(
|
||||||
state.keyInfos.value.endDate!) <=
|
state.keyInfos.value.endDate!) <=
|
||||||
15 &&
|
15 &&
|
||||||
DateTool().compareTimeGetDaysFromNow(
|
DateTool().compareTimeGetDaysFromNow(
|
||||||
state.keyInfos.value.endDate!) >=
|
state.keyInfos.value.endDate!) >=
|
||||||
0) && // 0到30天
|
0) && // 0到30天
|
||||||
(state.keyInfos.value.keyStatus ==
|
(state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusNormalUse ||
|
XSConstantMacro.keyStatusNormalUse ||
|
||||||
state.keyInfos.value.keyStatus ==
|
state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||||
)
|
,
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 30.h,
|
// height: 30.h,
|
||||||
color: const Color(0xFFFBEFD4),
|
color: const Color(0xFFFBEFD4),
|
||||||
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
|
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -434,26 +434,26 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Stack(children: [
|
Stack(children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh - ScreenUtil().statusBarHeight,
|
height: 1.sh - ScreenUtil().statusBarHeight,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
topWidget(),
|
topWidget(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Obx(() => buildPageIndicator()),
|
Obx(buildPageIndicator),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
||||||
child: PageView(
|
child: PageView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
controller: state.pageController,
|
controller: state.pageController,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => bottomWidget()),
|
Obx(bottomWidget),
|
||||||
attachmentWidget(),
|
attachmentWidget(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -476,7 +476,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
F.sw(
|
F.sw(
|
||||||
defaultCall: () => SizedBox(height: 50.h),
|
defaultCall: () => SizedBox(height: 50.h),
|
||||||
xhjCall: () => Padding(
|
xhjCall: () => Padding(
|
||||||
@ -490,7 +490,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
state.lockAlias.value,
|
state.lockAlias.value,
|
||||||
@ -504,7 +504,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Positioned(
|
Positioned(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ShowTipView().showSureAlertDialog(
|
ShowTipView().showSureAlertDialog(
|
||||||
@ -512,7 +512,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
showElectricIcon(state.electricQuantity.value),
|
showElectricIcon(state.electricQuantity.value),
|
||||||
@ -520,7 +520,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
height: 24.w),
|
height: 24.w),
|
||||||
),
|
),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("${state.electricQuantity.value}%",
|
Text('${state.electricQuantity.value}%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -542,7 +542,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
1,
|
1,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
showElectricIcon(
|
showElectricIcon(
|
||||||
@ -551,7 +551,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
height: 24.w),
|
height: 24.w),
|
||||||
),
|
),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("${state.electricQuantityStandby.value}%",
|
Text('${state.electricQuantityStandby.value}%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.darkGrayTextColor)),
|
color: AppColors.darkGrayTextColor)),
|
||||||
@ -580,23 +580,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Center(
|
Center(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: state.openDoorBtnisUneable.value == true
|
onTap: state.openDoorBtnisUneable.value == true
|
||||||
? () {
|
? isNeedRealNameAuthThenOpenLock
|
||||||
isNeedRealNameAuthThenOpenLock();
|
|
||||||
}
|
|
||||||
: null,
|
: null,
|
||||||
onLongPressStart: state.openDoorBtnisUneable.value == true
|
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||||
? (details) {
|
? (LongPressStartDetails details) {
|
||||||
setState(() {
|
setState(startUnLock);
|
||||||
startUnLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
state.openDoorBtnisUneable.value == false
|
state.openDoorBtnisUneable.value == false
|
||||||
@ -609,31 +605,32 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// color: AppColors.primaryTopColor,
|
// color: AppColors.primaryTopColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
state.openDoorBtnisUneable.value == false
|
if (state.openDoorBtnisUneable.value == false)
|
||||||
? Positioned(
|
Positioned(
|
||||||
child: FlavorsImg(
|
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(
|
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,
|
width: 330.w,
|
||||||
height: 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,
|
right: 90.w,
|
||||||
bottom: 1,
|
bottom: 1,
|
||||||
child: Obx(() => Visibility(
|
child: Obx(() => Visibility(
|
||||||
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1
|
visible:
|
||||||
? true
|
state.keyInfos.value.lockSetting!.remoteUnlock == 1,
|
||||||
: false,
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ShowCupertinoAlertView().isToRemoteUnLockAlert(
|
ShowCupertinoAlertView().isToRemoteUnLockAlert(
|
||||||
@ -672,7 +668,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
logic.getKeyStatusTextAndShow(),
|
logic.getKeyStatusTextAndShow(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -685,9 +681,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
F.sw(
|
F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()),
|
||||||
defaultCall: () => adminInfoView(),
|
|
||||||
xhjCall: () => const SizedBox()),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
@ -707,7 +701,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
center ? MainAxisAlignment.center : MainAxisAlignment.start,
|
center ? MainAxisAlignment.center : MainAxisAlignment.start,
|
||||||
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/icon_electronicKey_admin.png',
|
'images/icon_electronicKey_admin.png',
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
@ -742,7 +736,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
? AppColors.mainColor
|
? AppColors.mainColor
|
||||||
: AppColors.btnDisableColor),
|
: AppColors.btnDisableColor),
|
||||||
),
|
),
|
||||||
if (add) ...[
|
if (add) ...<Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -752,7 +746,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
FlavorsImg(
|
FlavorsImg(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'images/mine/icon_mine_main_addLock.png',
|
'images/mine/icon_mine_main_addLock.png',
|
||||||
@ -823,7 +817,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Widget buildPageIndicator() {
|
Widget buildPageIndicator() {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: List.generate(2, (index) {
|
children: List.generate(2, (int index) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 10.0.w,
|
width: 10.0.w,
|
||||||
height: 10.0.w,
|
height: 10.0.w,
|
||||||
@ -855,7 +849,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
// 配件配置
|
// 配件配置
|
||||||
List<Widget> getAttachmentWidget() {
|
List<Widget> getAttachmentWidget() {
|
||||||
var showWidgetArr = <Widget>[];
|
final List<Widget> showWidgetArr = <Widget>[];
|
||||||
// 无线键盘
|
// 无线键盘
|
||||||
// if (state.isAttendance.value == 1) {
|
// if (state.isAttendance.value == 1) {
|
||||||
// showWidgetArr.add(bottomItem(
|
// showWidgetArr.add(bottomItem(
|
||||||
@ -911,7 +905,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
// 普通用户
|
// 普通用户
|
||||||
List<Widget> getNormalWidget() {
|
List<Widget> getNormalWidget() {
|
||||||
List<Widget> showWidgetArr = <Widget>[];
|
final List<Widget> showWidgetArr = <Widget>[];
|
||||||
// 考勤
|
// 考勤
|
||||||
if (state.isAttendance.value == 1) {
|
if (state.isAttendance.value == 1) {
|
||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
@ -928,15 +922,17 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.doorLockLogPage,
|
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',
|
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData
|
'isOnlyOneData': state.isOnlyOneData
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -945,7 +941,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
// 授权管理员、超级管理员字段
|
// 授权管理员、超级管理员字段
|
||||||
List<Widget> getAllWidget() {
|
List<Widget> getAllWidget() {
|
||||||
var showWidgetArr = <Widget>[];
|
final List<Widget> showWidgetArr = <Widget>[];
|
||||||
// 考勤
|
// 考勤
|
||||||
if (state.isAttendance.value == 1) {
|
if (state.isAttendance.value == 1) {
|
||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
@ -971,7 +967,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.password!.tr,
|
TranslationLoader.lanKeys!.password!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.passwordKeyListPage,
|
Get.toNamed(Routers.passwordKeyListPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: <String, LockListInfoItemEntity>{
|
||||||
|
'keyInfo': state.keyInfos.value
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// ic卡
|
// ic卡
|
||||||
@ -980,8 +978,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_main_icCard.png',
|
'images/main/icon_main_icCard.png',
|
||||||
TranslationLoader.lanKeys!.card!.tr,
|
TranslationLoader.lanKeys!.card!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.cardListPage, arguments: {
|
Get.toNamed(Routers.cardListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -992,8 +990,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_main_fingerprint.png',
|
'images/main/icon_main_fingerprint.png',
|
||||||
TranslationLoader.lanKeys!.fingerprint!.tr,
|
TranslationLoader.lanKeys!.fingerprint!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.fingerprintListPage, arguments: {
|
Get.toNamed(Routers.fingerprintListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -1015,8 +1013,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_face.png',
|
'images/main/icon_face.png',
|
||||||
TranslationLoader.lanKeys!.humanFace!.tr,
|
TranslationLoader.lanKeys!.humanFace!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.faceListPage, arguments: {
|
Get.toNamed(Routers.faceListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1027,8 +1025,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
|
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
|
||||||
() {
|
() {
|
||||||
Get.toNamed(Routers.irisListPage, arguments: {
|
Get.toNamed(Routers.irisListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1039,8 +1037,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
|
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
|
||||||
() {
|
() {
|
||||||
Get.toNamed(Routers.palmListPage, arguments: {
|
Get.toNamed(Routers.palmListPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1053,9 +1051,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_catEyes.png',
|
'images/main/icon_catEyes.png',
|
||||||
TranslationLoader.lanKeys!.monitoring!.tr,
|
TranslationLoader.lanKeys!.monitoring!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
Get.toNamed(Routers.realTimePicturePage, arguments: <String, Object?>{
|
||||||
"lockName": state.keyInfos.value.lockName,
|
'lockName': state.keyInfos.value.lockName,
|
||||||
"isMonitoring": true
|
'isMonitoring': true
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1068,11 +1066,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.authorizedAdminListPage,
|
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(
|
endWiddget.add(
|
||||||
// 操作记录
|
// 操作记录
|
||||||
bottomItem(
|
bottomItem(
|
||||||
@ -1082,7 +1082,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// Get.toNamed(Routers.lockOperatingRecordPage,
|
// Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
// arguments: {"keyInfo": state.keyInfos.value});
|
// arguments: {"keyInfo": state.keyInfos.value});
|
||||||
Get.toNamed(Routers.doorLockLogPage,
|
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',
|
'images/main/icon_lockDetail_videoLog.png',
|
||||||
TranslationLoader.lanKeys!.videoLog!.tr,
|
TranslationLoader.lanKeys!.videoLog!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.videoLogPage, arguments: {
|
Get.toNamed(Routers.videoLogPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -1103,8 +1105,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
'images/main/icon_lockDetail_messageReminding.png',
|
'images/main/icon_lockDetail_messageReminding.png',
|
||||||
TranslationLoader.lanKeys!.messageReminding!.tr,
|
TranslationLoader.lanKeys!.messageReminding!.tr,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
Get.toNamed(Routers.msgNotificationPage, arguments: <String, int?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1114,9 +1116,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
bottomItem('images/main/icon_main_set.png',
|
bottomItem('images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||||
// logic.clickItemBtnAction(10);
|
// logic.clickItemBtnAction(10);
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||||
"lockId": state.keyInfos.value.lockId,
|
'lockId': state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData,
|
'isOnlyOneData': state.isOnlyOneData,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1126,12 +1128,12 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
Widget bottomItem(
|
Widget bottomItem(
|
||||||
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
|
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
|
||||||
Widget child = F.sw(
|
final Widget child = F.sw(
|
||||||
defaultCall: () => Container(
|
defaultCall: () => Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 42.w,
|
width: 42.w,
|
||||||
height: 42.h,
|
height: 42.h,
|
||||||
@ -1164,7 +1166,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 42.w,
|
width: 42.w,
|
||||||
height: 42.h,
|
height: 42.h,
|
||||||
@ -1195,19 +1197,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
onTap: bottomBtnisEable
|
onTap: bottomBtnisEable
|
||||||
? onClick
|
? onClick
|
||||||
: () {
|
: () {
|
||||||
logic.showToast("请在锁旁边完成第一次开锁".tr);
|
logic.showToast('请在锁旁边完成第一次开锁'.tr);
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
listeningAnimations() async {
|
Future<void> listeningAnimations() async {
|
||||||
await Future.delayed(Duration.zero, () {
|
await Future<void>.delayed(Duration.zero, () {
|
||||||
state.animationController = AnimationController(
|
state.animationController = AnimationController(
|
||||||
duration: const Duration(seconds: 1), vsync: this);
|
duration: const Duration(seconds: 1), vsync: this);
|
||||||
state.animationController!.repeat();
|
state.animationController!.repeat();
|
||||||
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
||||||
state.animationController!.addStatusListener((status) {
|
state.animationController!.addStatusListener((AnimationStatus status) {
|
||||||
if (status == AnimationStatus.completed) {
|
if (status == AnimationStatus.completed) {
|
||||||
state.animationController!.reset();
|
state.animationController!.reset();
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
@ -1237,7 +1239,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Widget _unlockSuccessWidget() {
|
Widget _unlockSuccessWidget() {
|
||||||
return Center(
|
return Center(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
state.iSOpenLock.value == true
|
state.iSOpenLock.value == true
|
||||||
? 'images/main/unlocked_bg.png'
|
? 'images/main/unlocked_bg.png'
|
||||||
@ -1250,7 +1252,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
left: 55.w,
|
left: 55.w,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
state.keyInfos.value.lockAlias!,
|
state.keyInfos.value.lockAlias!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -1289,9 +1291,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
String getCurrentFormattedTime() {
|
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;
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1303,24 +1305,20 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
|
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
|
||||||
AliyunRealNameAuthProvider(
|
AliyunRealNameAuthProvider(
|
||||||
getLockInfo: state.keyInfos.value,
|
getLockInfo: state.keyInfos.value,
|
||||||
onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) {
|
onCertifyResultWithTime: (bool isSuccess, int getNextAuthTime) {
|
||||||
state.nextAuthTime.value = getNextAuthTime;
|
state.nextAuthTime.value = getNextAuthTime;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
// 认证成功,去开锁
|
// 认证成功,去开锁
|
||||||
setState(() {
|
setState(startOpenLock);
|
||||||
startOpenLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})).initAliyunRealNameAuth();
|
}).initAliyunRealNameAuth();
|
||||||
} else {
|
} else {
|
||||||
//无需认证,直接开锁
|
//无需认证,直接开锁
|
||||||
setState(() {
|
setState(startOpenLock);
|
||||||
startOpenLock();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startOpenLock() {
|
void startOpenLock() {
|
||||||
if (state.openLockBtnState.value == 1) {
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1329,21 +1327,21 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
AppLog.log("点击开锁");
|
AppLog.log('点击开锁');
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
state.openDoorModel = 0;
|
state.openDoorModel = 0;
|
||||||
AppLog.log("点击开锁 state.openDoorModel = 0 不需要联网");
|
AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
|
||||||
logic.openDoorAction();
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
state.openDoorModel = 2;
|
state.openDoorModel = 2;
|
||||||
AppLog.log("点击开锁 state.openDoorModel = 2 需要联网");
|
AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startUnLock() {
|
void startUnLock() {
|
||||||
if (state.openLockBtnState.value == 1) {
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1352,16 +1350,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
EasyLoading.showToast("正在尝试闭锁……".tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
|
||||||
AppLog.log("长按闭锁");
|
AppLog.log('长按闭锁');
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
AppLog.log("长按闭锁 state.openDoorModel = 32 不需要联网");
|
AppLog.log('长按闭锁 state.openDoorModel = 32 不需要联网');
|
||||||
state.openDoorModel = 32;
|
state.openDoorModel = 32;
|
||||||
logic.openDoorAction();
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
AppLog.log("长按闭锁 state.openDoorModel = 34 需要联网");
|
AppLog.log('长按闭锁 state.openDoorModel = 34 需要联网');
|
||||||
state.openDoorModel = 34;
|
state.openDoorModel = 34;
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,10 +15,11 @@ import 'lockMain_state.dart';
|
|||||||
class LockMainLogic extends BaseGetXController {
|
class LockMainLogic extends BaseGetXController {
|
||||||
final LockMainState state = LockMainState();
|
final LockMainState state = LockMainState();
|
||||||
|
|
||||||
Future<LockListInfoEntity> getStarLockInfo() async {
|
Future<LockListInfoEntity> getStarLockInfo({bool isUnShowLoading = false}) async {
|
||||||
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
isUnShowLoading: isUnShowLoading,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
loadMainDataLogic(entity.data!);
|
loadMainDataLogic(entity.data!);
|
||||||
|
|||||||
@ -37,14 +37,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
final logic = Get.put(LockMainLogic());
|
final logic = Get.put(LockMainLogic());
|
||||||
final state = Get.find<LockMainLogic>().state;
|
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 =
|
LockListInfoGroupEntity? lockListInfoGroupEntity =
|
||||||
await Storage.getLockMainListData();
|
await Storage.getLockMainListData();
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
var localLockListInfoGroupEntity = lockListInfoGroupEntity;
|
var localLockListInfoGroupEntity = lockListInfoGroupEntity;
|
||||||
await logic.loadMainDataLogic(localLockListInfoGroupEntity);
|
await logic.loadMainDataLogic(localLockListInfoGroupEntity);
|
||||||
}
|
}
|
||||||
await logic.getStarLockInfo();
|
await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading);
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
if (clearScanDevices) {
|
if (clearScanDevices) {
|
||||||
BlueManage().scanDevices.clear();
|
BlueManage().scanDevices.clear();
|
||||||
@ -237,7 +238,9 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData(clearScanDevices: event.clearScanDevices);
|
getHttpData(
|
||||||
|
clearScanDevices: event.clearScanDevices,
|
||||||
|
isUnShowLoading: event.isUnShowLoading);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -171,7 +171,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
'idCardNumber': idCardNumber
|
'idCardNumber': idCardNumber
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> uploadElectricQuantity(
|
Future<Response<dynamic>> uploadElectricQuantity(
|
||||||
String electricQuantity,
|
String electricQuantity,
|
||||||
String electricQuantityStandby,
|
String electricQuantityStandby,
|
||||||
String lockId,
|
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,
|
getStarLockInfoURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"pageNo": pageNo,
|
"pageNo": pageNo,
|
||||||
'pageSize': pageSize,
|
'pageSize': pageSize,
|
||||||
}));
|
}),isUnShowLoading: isUnShowLoading);
|
||||||
|
|
||||||
// 获取所有锁设置信息
|
// 获取所有锁设置信息
|
||||||
Future<Response> getLockSettingInfoData(String lockId) => post(
|
Future<Response> getLockSettingInfoData(String lockId) => post(
|
||||||
|
|||||||
@ -37,7 +37,6 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
}) async {
|
}) async {
|
||||||
AppLog.log("post: url:$url body:$body");
|
AppLog.log("post: url:$url body:$body");
|
||||||
if (isUnShowLoading == false){
|
if (isUnShowLoading == false){
|
||||||
// AppLog.log("post: url:$url show loading");
|
|
||||||
EasyLoading.show();
|
EasyLoading.show();
|
||||||
}
|
}
|
||||||
if (isUserBaseUrl == false) {
|
if (isUserBaseUrl == false) {
|
||||||
|
|||||||
@ -421,8 +421,8 @@ class ApiRepository {
|
|||||||
|
|
||||||
// 获取锁信息列表
|
// 获取锁信息列表
|
||||||
Future<LockListInfoEntity> getStarLockListInfo(
|
Future<LockListInfoEntity> getStarLockListInfo(
|
||||||
{required int pageNo, required int pageSize}) async {
|
{required int pageNo, required int pageSize,required bool isUnShowLoading}) async {
|
||||||
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize);
|
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize,isUnShowLoading:isUnShowLoading);
|
||||||
return LockListInfoEntity.fromJson(res.body);
|
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';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
class CommonItem extends StatelessWidget {
|
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? leftTitel;
|
||||||
String? rightTitle;
|
String? rightTitle;
|
||||||
bool? isHaveDirection;
|
bool? isHaveDirection;
|
||||||
@ -12,100 +27,75 @@ class CommonItem extends StatelessWidget {
|
|||||||
Function()? action;
|
Function()? action;
|
||||||
Function()? tipsImgAction;
|
Function()? tipsImgAction;
|
||||||
double? allHeight;
|
double? allHeight;
|
||||||
|
bool? setHeight;
|
||||||
bool? isTipsImg;
|
bool? isTipsImg;
|
||||||
bool? isPadding;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Column(
|
child: Container(
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
height: setHeight == true ? allHeight ?? 65.h : null,
|
||||||
children: [
|
padding: isPadding == true
|
||||||
Container(
|
? EdgeInsets.only(left: 20.w, right: 10.w)
|
||||||
height: allHeight ?? 65.h,
|
: EdgeInsets.zero,
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
padding: isPadding == true ? EdgeInsets.only(left: 20.w, right: 10.w) : EdgeInsets.zero, // , top: 20.w, bottom: 20.w
|
color: Colors.white,
|
||||||
child: Row(
|
border: isHaveLine!
|
||||||
children: [
|
? Border(
|
||||||
// SizedBox(width: 20.w),
|
bottom: BorderSide(
|
||||||
SizedBox(
|
color: AppColors.greyLineColor, // 设置边框颜色
|
||||||
// width: isHaveRightWidget! ? 100.w : 300.w,
|
width: 2.0.h, // 设置边框宽度
|
||||||
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,
|
|
||||||
)
|
)
|
||||||
: 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 {
|
class RefreshLockListInfoDataEvent {
|
||||||
//是否清除蓝牙设备列表缓存
|
//是否清除蓝牙设备列表缓存
|
||||||
bool clearScanDevices;
|
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,
|
border: InputBorder.none,
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@ -191,6 +191,8 @@ dependencies:
|
|||||||
expandable: ^5.0.1
|
expandable: ^5.0.1
|
||||||
colorfilter_generator: ^0.0.8
|
colorfilter_generator: ^0.0.8
|
||||||
file_picker: ^5.3.1
|
file_picker: ^5.3.1
|
||||||
|
# 错误日志监控
|
||||||
|
flutter_bugly_plugin: ^0.0.9
|
||||||
|
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user