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

This commit is contained in:
Daisy 2024-04-09 17:22:04 +08:00
commit a0fa267d17
66 changed files with 914 additions and 906 deletions

View File

@ -0,0 +1,2 @@
FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"
PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"

1
star_lock/.docker/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

View File

@ -0,0 +1,28 @@
# docker持续部署
构建镜像来自https://github.com/MobileDevOps/flutter-sdk-image/
## 使用方法
1. 复制.env文件并编辑其中的代理设置
```bash
cp .docker/.env.example .docker/.env
```
2. 构建命令
```bash
cd <path-to-this-repo>
# 构建sky版本APK
docker run --env-file .docker/.env --rm -it -v .:/home/mobiledevops/app mobiledevops/flutter-sdk-image:3.16.4 \
flutter build apk --release --flavor sky -t lib/main_sky_full.dart
```
3. 构建完成后APK文件在build/app/outputs/flutter-apk目录下
## 排除故障
测试谷歌连接
```bash
# flutter以及maven 下载地址是否正常
curl -i https://storage.googleapis.com/flutter_infra_release/
```

View File

@ -23,9 +23,16 @@
<!--允许写设备缓存,用于问题排查-->
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<!--允许写入扩展存储,用于写入缓存定位数据-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--允许读设备等信息,用于问题排查-->
<!--相机-->
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<!--允许麦克风权限,用于录音发送-->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
@ -34,6 +41,11 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.REORDER_TASKS"/>
<!-- 相册权限 34适配 -->
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
<application android:label="@string/app_name" android:name="android.app.Application" android:icon="@mipmap/ic_launcher">
<meta-data
android:name="flutterEmbedding"

View File

@ -312,7 +312,7 @@
"lightTouchScreenTip":"Light Touch Screen Tip",
"next":"Next",
"nearbyLock":"Nearby Lock",
"addSuccessfullyPleaseRename":"Add Successfully Please Rename",
"addSuccessfullyPleaseRename":"If you want to change the name, please rename, click OK to add lock",
"whenAddingLockThePhoneMustBeNextToTheLock":"When adding a lock, the phone must be next to the lock",
"login":"Login",
@ -538,6 +538,7 @@
"清空码": "Clear code",
"循环": "Cycle",
"工作日": "Workday",
"每日": "Daily",
"周末": "Weekend",
"周一": "Monday",
"周二": "Tuesday",
@ -548,5 +549,69 @@
"周日": "Sunday",
"确定要删除吗?": "Are you sure you want to delete?",
"该锁的密码都将被删除": "The password of the lock will be deleted",
"已过期": "Expired"
"已过期": "Expired",
"该锁的电子钥匙都将被删除": "The electronic key of the lock will be deleted",
"同时删除其发送的所有钥匙,钥匙删除后不能恢复": "Also delete all the keys sent by it, the key can not be restored after deletion",
"删除钥匙会在用户APP连网后生效": "Deleting the key will take effect after the user APP is connected to the network",
"有效时间": "Effective time",
"接收者": "Receiver",
"仅管理自己创建的用户": "Only manage users created by yourself",
"远程开锁": "Remote unlock",
"请输入钥匙名称": "Please enter the key name",
"修改成功": "Modify success",
"冻结": "Freeze",
"取消冻结": "Unfreeze",
"授权": "Authorization",
"取消授权": "Cancel authorization",
"同时解冻其发送的钥匙": "Unfreeze the keys sent by it",
"取消冻结会在用户APP连网后生效": "Unfreezing will take effect after the user APP is connected to the network",
"同时冻结其发送的钥匙": "Freeze the keys sent by it",
"冻结会在用户APP连网后生效": "Freezing will take effect after the user APP is connected to the network",
"取消授权会在用户APP连网后生效": "Canceling authorization will take effect after the user APP is connected to the network",
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码": "Authorized users have most of the permissions of the administrator, such as sending keys, sending passwords",
"失效时间需大于生效时间": "The expiration time must be greater than the effective time",
"生效时间需大于当前时间": "The effective time must be greater than the current time",
"失效日期要大于生效日期": "The expiration date must be greater than the effective date",
"失效时间要大于生效时间": "The expiration time must be greater than the effective time",
"修改有效期": "Modify the validity period",
"生效日期": "Effective date",
"失效日期": "Expiration date",
"开锁": "Unlock",
"开锁成功": "Unlock success",
"请选择锁": "Please select the lock",
"请选择接收者": "Please select the receiver",
"请选择有效期": "Please select the validity period",
"请选择发送方式": "Please select the sending method",
"请选择结束时间": "Please select the end time",
"完成": "Complete",
"有效日": "Effective day",
"发送成功": "Send success",
"请选择开始时间": "Please select the start time",
"选择用户": "Select user",
"已选中": "Selected",
"确定": "Determine",
"请选择要发送的锁": "Please select the lock to send",
"人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。": "Face real-name authentication refers to the user's need to verify his face before unlocking the phone APP, and the verification can be unlocked.",
"分享": "Share",
"请输入接收者账号": "Please enter the receiver account",
"接收者号码未注册,请重新发送": "The receiver number is not registered, please resend",
"是否发送电子钥匙给未注册账号": "Whether to send the electronic key to the unregistered account",
"取消": "Cancel",
"标记成功": "Mark success",
"微信好友": "WeChat friends",
"短信": "SMS",
"邮件": "Mail",
"更多": "More",
"您好,您的电子钥匙生成成功": "Hello, your electronic key is generated successfully",
"生效时间不能小于当前时间": "The effective time cannot be less than the current time",
"结束时间不能小于当前时间": "The end time cannot be less than the current time",
"是否是管理员": "Is it an administrator",
"已连接到锁,请将卡靠近锁的读卡区": "Connected to the lock, please put the card close to the card reading area of the lock",
"尝试连接设备...": "Trying to connect to the device...",
"地理位置": "Geographical location",
"检查以确保以下地址是正确的": "Check to make sure the following address is correct",
"地图加载中,请稍候。。": "The map is loading, please wait...",
"跳过": "Skip",
"还未获取到位置信息哦,请耐心等待一下!": "The location information has not been obtained yet, please wait patiently!",
"请填写信息": "Please fill in the information"
}

View File

@ -525,7 +525,7 @@
"隐私政策": "隐私政策",
"注册成功": "注册成功",
"你所在的": "你所在的",
"手机号": "公司已经开通了",
"手机号": "手机号",
"忘记密码": "忘记密码",
"重置成功": "重置成功",
"确定要退出吗?": "确定要退出吗?",
@ -539,6 +539,7 @@
"清空码": "清空码",
"循环": "循环",
"工作日": "工作日",
"每日": "每日",
"周末": "周末",
"周一": "周一",
"周二": "周二",
@ -549,5 +550,69 @@
"周日": "周日",
"确定要删除吗?": "确定要删除吗?",
"该锁的密码都将被删除": "该锁的密码都将被删除",
"已过期": "已过期"
"已过期": "已过期",
"该锁的电子钥匙都将被删除": "该锁的电子钥匙都将被删除",
"同时删除其发送的所有钥匙,钥匙删除后不能恢复": "同时删除其发送的所有钥匙,钥匙删除后不能恢复",
"删除钥匙会在用户APP连网后生效": "删除钥匙会在用户APP连网后生效",
"有效时间": "有效时间",
"接收者": "接收者",
"仅管理自己创建的用户": "仅管理自己创建的用户",
"远程开锁": "远程开锁",
"请输入钥匙名称": "请输入钥匙名称",
"修改成功": "修改成功",
"冻结": "冻结",
"取消冻结": "取消冻结",
"授权": "授权",
"取消授权": "取消授权",
"同时解冻其发送的钥匙": "同时解冻其发送的钥匙",
"取消冻结会在用户APP连网后生效": "取消冻结会在用户APP连网后生效",
"同时冻结其发送的钥匙": "同时冻结其发送的钥匙",
"冻结会在用户APP连网后生效": "冻结会在用户APP连网后生效",
"取消授权会在用户APP连网后生效": "取消授权会在用户APP连网后生效",
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码": "授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码",
"失效时间需大于生效时间": "失效时间需大于生效时间",
"生效时间需大于当前时间": "生效时间需大于当前时间",
"失效日期要大于生效日期": "失效日期要大于生效日期",
"失效时间要大于生效时间": "失效时间要大于生效时间",
"修改有效期": "修改有效期",
"生效日期": "生效日期",
"失效日期": "失效日期",
"开锁": "开锁",
"开锁成功": "开锁成功",
"请选择锁": "请选择锁",
"请选择接收者": "请选择接收者",
"请选择有效期": "请选择有效期",
"请选择发送方式": "请选择发送方式",
"请选择结束时间": "请选择结束时间",
"完成": "完成",
"有效日": "有效日",
"发送成功": "发送成功",
"请选择开始时间": "请选择开始时间",
"选择用户": "选择用户",
"已选中": "已选中",
"确定": "确定",
"请选择要发送的锁": "请选择要发送的锁",
"人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。": "人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。",
"分享": "分享",
"请输入接收者账号": "请输入接收者账号",
"接收者号码未注册,请重新发送": "接收者号码未注册,请重新发送",
"是否发送电子钥匙给未注册账号": "是否发送电子钥匙给未注册账号",
"取消": "取消",
"标记成功": "标记成功",
"微信好友": "微信好友",
"短信": "短信",
"邮件": "邮件",
"更多": "更多",
"您好,您的电子钥匙生成成功": "您好,您的电子钥匙生成成功",
"生效时间不能小于当前时间": "生效时间不能小于当前时间",
"结束时间不能小于当前时间": "结束时间不能小于当前时间",
"是否是管理员": "是否是管理员",
"已连接到锁,请将卡靠近锁的读卡区": "已连接到锁,请将卡靠近锁的读卡区",
"尝试连接设备...": "尝试连接设备...",
"地理位置": "地理位置",
"检查以确保以下地址是正确的": "检查以确保以下地址是正确的",
"地图加载中,请稍候。。": "地图加载中,请稍候。。",
"跳过": "跳过",
"还未获取到位置信息哦,请耐心等待一下!": "还未获取到位置信息哦,请耐心等待一下!",
"请填写信息": "请填写信息"
}

View File

@ -312,7 +312,7 @@
"lightTouchScreenTip":"摸亮触摸屏,锁进入可添加状态,点击下一步",
"next":"下一步",
"nearbyLock":"附近的锁",
"addSuccessfullyPleaseRename":"添加成功,请重命名",
"addSuccessfullyPleaseRename":"如需修改名字请重新命名,点击确定添加锁",
"whenAddingLockThePhoneMustBeNextToTheLock":"添加锁时,手机必须在锁旁边",
"login":"登录",
@ -526,7 +526,7 @@
"隐私政策": "隐私政策",
"注册成功": "注册成功",
"你所在的": "你所在的",
"手机号": "公司已经开通了",
"手机号": "手机号",
"忘记密码": "忘记密码",
"重置成功": "重置成功",
"确定要退出吗?": "确定要退出吗?",
@ -540,6 +540,7 @@
"清空码": "清空码",
"循环": "循环",
"工作日": "工作日",
"每日": "每日",
"周末": "周末",
"周一": "周一",
"周二": "周二",
@ -550,5 +551,69 @@
"周日": "周日",
"确定要删除吗?": "确定要删除吗?",
"该锁的密码都将被删除": "该锁的密码都将被删除",
"已过期": "已过期"
"已过期": "已过期",
"该锁的电子钥匙都将被删除": "该锁的电子钥匙都将被删除",
"同时删除其发送的所有钥匙,钥匙删除后不能恢复": "同时删除其发送的所有钥匙,钥匙删除后不能恢复",
"删除钥匙会在用户APP连网后生效": "删除钥匙会在用户APP连网后生效",
"有效时间": "有效时间",
"接收者": "接收者",
"仅管理自己创建的用户": "仅管理自己创建的用户",
"远程开锁": "远程开锁",
"请输入钥匙名称": "请输入钥匙名称",
"修改成功": "修改成功",
"冻结": "冻结",
"取消冻结": "取消冻结",
"授权": "授权",
"取消授权": "取消授权",
"同时解冻其发送的钥匙": "同时解冻其发送的钥匙",
"取消冻结会在用户APP连网后生效": "取消冻结会在用户APP连网后生效",
"同时冻结其发送的钥匙": "同时冻结其发送的钥匙",
"冻结会在用户APP连网后生效": "冻结会在用户APP连网后生效",
"取消授权会在用户APP连网后生效": "取消授权会在用户APP连网后生效",
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码": "授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码",
"失效时间需大于生效时间": "失效时间需大于生效时间",
"生效时间需大于当前时间": "生效时间需大于当前时间",
"失效日期要大于生效日期": "失效日期要大于生效日期",
"失效时间要大于生效时间": "失效时间要大于生效时间",
"修改有效期": "修改有效期",
"生效日期": "生效日期",
"失效日期": "失效日期",
"开锁": "开锁",
"开锁成功": "开锁成功",
"请选择锁": "请选择锁",
"请选择接收者": "请选择接收者",
"请选择有效期": "请选择有效期",
"请选择发送方式": "请选择发送方式",
"请选择结束时间": "请选择结束时间",
"完成": "完成",
"有效日": "有效日",
"发送成功": "发送成功",
"请选择开始时间": "请选择开始时间",
"选择用户": "选择用户",
"已选中": "已选中",
"确定": "确定",
"请选择要发送的锁": "请选择要发送的锁",
"人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。": "人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。",
"分享": "分享",
"请输入接收者账号": "请输入接收者账号",
"接收者号码未注册,请重新发送": "接收者号码未注册,请重新发送",
"是否发送电子钥匙给未注册账号": "是否发送电子钥匙给未注册账号",
"取消": "取消",
"标记成功": "标记成功",
"微信好友": "微信好友",
"短信": "短信",
"邮件": "邮件",
"更多": "更多",
"您好,您的电子钥匙生成成功": "您好,您的电子钥匙生成成功",
"生效时间不能小于当前时间": "生效时间不能小于当前时间",
"结束时间不能小于当前时间": "结束时间不能小于当前时间",
"是否是管理员": "是否是管理员",
"已连接到锁,请将卡靠近锁的读卡区": "已连接到锁,请将卡靠近锁的读卡区",
"尝试连接设备...": "尝试连接设备...",
"地理位置": "地理位置",
"检查以确保以下地址是正确的": "检查以确保以下地址是正确的",
"地图加载中,请稍候。。": "地图加载中,请稍候。。",
"跳过": "跳过",
"还未获取到位置信息哦,请耐心等待一下!": "还未获取到位置信息哦,请耐心等待一下!",
"请填写信息": "请填写信息"
}

View File

@ -28,6 +28,8 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>jpush.cn</key>

View File

@ -1,8 +1,8 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter_easyloading/flutter_easyloading.dart';
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:get/get.dart';
import 'io_tool/io_model.dart';
@ -20,15 +20,19 @@ class BlueManage {
// id
final Guid _serviceIdConnect = Guid("fff0");
// id
final Guid _serviceIdWrite = Guid('0000FFF0-0000-1000-8000-00805F9B34FB');
// id
final Guid _characteristicIdSubscription = Guid("fff1");
// id
final Guid _characteristicIdWrite = Guid("fff2");
//
StreamSubscription<EventSendModel>? _sendStreamSubscription;
//
// StreamSubscription? _scanSubscription;
//
@ -42,12 +46,16 @@ class BlueManage {
//
String connectDeviceName = "";
// mac地址
String connectDeviceMacAddress = "";
//
BluetoothDevice? bluetoothConnectDevice;
//
ScanResult? scanResult;
//
BluetoothConnectionState? bluetoothConnectionState = BluetoothConnectionState.disconnected;
@ -55,7 +63,8 @@ class BlueManage {
StreamSubscription<BluetoothAdapterState>? _adapterStateStateSubscription;
static BlueManage? _manager;
BlueManage._init(){
BlueManage._init() {
_initBlue();
}
@ -66,9 +75,10 @@ class BlueManage {
}
factory BlueManage() => shareManager()!;
BlueManage? get manager => shareManager();
void _initBlue(){
void _initBlue() {
Get.log("蓝牙功能初始化监听");
_initSendStreamSubscription();
_initAdapterStateStateSubscription();
@ -79,7 +89,7 @@ class BlueManage {
void _initGetMtuSubscription() {
_mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((value) {
_mtuSize = value - 3;
Get.log('mtuSize:$_mtuSize');
Get.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
});
}
@ -90,42 +100,42 @@ class BlueManage {
}
// void _initListenscanResults() {
// var subscription = FlutterBluePlus.scanResults.listen((results) {
// scanDevices.clear();
// for (var scanResult in results) {
// //
// // if (scanResult.device.advName.isEmpty) {
// // return;
// // }
// print("scanResult.device.advName:${scanResult.device.advName}"
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
// " rssi:${scanResult.rssi}");
// if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
// // id相同的元素
// final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
// // -1
// if (knownDeviceIndex >= 0) {
// scanDevices[knownDeviceIndex] = scanResult;
// } else {
// scanDevices.add(scanResult);
// }
// }
// }
// EventBusManager().eventBusFir(scanDevices);
// // FlutterBluePlus.stopScan();
// }, onError: (e) {
// print("Scan Error:$e", );
// });
//
// FlutterBluePlus.cancelWhenScanComplete(subscription);
// var subscription = FlutterBluePlus.scanResults.listen((results) {
// scanDevices.clear();
// for (var scanResult in results) {
// //
// // if (scanResult.device.advName.isEmpty) {
// // return;
// // }
// print("scanResult.device.advName:${scanResult.device.advName}"
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
// " rssi:${scanResult.rssi}");
// if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
// // id相同的元素
// final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
// // -1
// if (knownDeviceIndex >= 0) {
// scanDevices[knownDeviceIndex] = scanResult;
// } else {
// scanDevices.add(scanResult);
// }
// }
// }
// EventBusManager().eventBusFir(scanDevices);
// // FlutterBluePlus.stopScan();
// }, onError: (e) {
// print("Scan Error:$e", );
// });
//
// FlutterBluePlus.cancelWhenScanComplete(subscription);
// FlutterBluePlus.isScanning.listen((state) {
// if (state) {
// print('Scanning');
// } else {
// print('Not scanning');
// }
// });
// FlutterBluePlus.isScanning.listen((state) {
// if (state) {
// print('Scanning');
// } else {
// print('Not scanning');
// }
// });
// }
void _initListenConnectionState() {
@ -148,9 +158,7 @@ class BlueManage {
writeCharacteristicWithResponse(model.data);
} else {
try {
if (Platform.isAndroid) {
await FlutterBluePlus.turnOn();
}
} catch (e) {
Get.log("Error Turning On:");
}
@ -163,27 +171,27 @@ class BlueManage {
});
}
///
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack, {List<Guid>? idList}) async {
///
Future<void> startScanSingle(String deviceName, int timeout, ScanDevicesCallBack scanDevicesCallBack) async {
FlutterBluePlus.isSupported.then((isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
try {
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
var subscription = FlutterBluePlus.scanResults.listen((results) {
scanDevices.clear();
if (_adapterState == BluetoothAdapterState.on) {
try {
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
Completer<dynamic> completer = Completer<dynamic>();
var subscription = FlutterBluePlus.scanResults.listen((results) {
bool isExit = results.any((element) => element.device.platformName == deviceName);
if (isExit) {
for (var scanResult in results) {
//
// if (scanResult.device.advName.isEmpty) {
// return;
// }
// Get.log("scanResult.device.advName:${scanResult.device.advName}"
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
// " rssi:${scanResult.rssi}");
if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
? scanResult.advertisementData.serviceUuids[0]
: "")
.toString()
.contains("758824")) &&
(scanResult.rssi >= -100)) {
// id相同的元素
final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
final knownDeviceIndex = scanDevices
.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
// -1
if (knownDeviceIndex >= 0) {
scanDevices[knownDeviceIndex] = scanResult;
@ -192,49 +200,19 @@ class BlueManage {
}
}
}
scanDevicesCallBack(scanDevices);
// EventBusManager().eventBusFir(scanDevices);
// FlutterBluePlus.stopScan();
}, onError: (e) {
Get.log("Scan Error:$e", );
});
FlutterBluePlus.cancelWhenScanComplete(subscription);
} catch (e) {
Get.log("扫描失败");
}
} else {
try {
if (Platform.isAndroid) {
await FlutterBluePlus.turnOn();
completer.complete();
}
} catch (e) {
Get.log("Error Turning On:");
}
};
} else {
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
}
});
}
///
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
FlutterBluePlus.isSupported.then((isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
//
if(bluetoothConnectionState != BluetoothConnectionState.connected){
_connect(deviceName, (state){
// if(bluetoothConnectionState != BluetoothConnectionState.connected){
// stateCallBack(bluetoothConnectionState!);
// }else{
// stateCallBack(bluetoothConnectionState!);
// }
stateCallBack(bluetoothConnectionState!);
}, isAddEquipment: isAddEquipment);
}else{
stateCallBack(bluetoothConnectionState!);
}, onError: (e) {
Get.log(
"Scan Error:$e",
);
});
FlutterBluePlus.cancelWhenScanComplete(subscription);
await completer.future;
scanDevicesCallBack(scanDevices);
subscription.cancel();
} catch (e) {
Get.log("扫描失败");
}
} else {
try {
@ -244,7 +222,104 @@ class BlueManage {
} catch (e) {
Get.log("Error Turning On:");
}
};
}
} else {
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
}
});
}
///
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack, {List<Guid>? idList}) async {
FlutterBluePlus.isSupported.then((isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
try {
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
var subscription = FlutterBluePlus.scanResults.listen((results) {
scanDevices.clear();
for (var scanResult in results) {
//
// if (scanResult.device.advName.isEmpty) {
// return;
// }
// Get.log("scanResult.device.advName:${scanResult.device.advName}"
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
// " rssi:${scanResult.rssi}");
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
? scanResult.advertisementData.serviceUuids[0]
: "")
.toString()
.contains("758824")) &&
(scanResult.rssi >= -100)) {
// id相同的元素
final knownDeviceIndex = scanDevices
.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
// -1
if (knownDeviceIndex >= 0) {
scanDevices[knownDeviceIndex] = scanResult;
} else {
scanDevices.add(scanResult);
}
}
}
scanDevicesCallBack(scanDevices);
// EventBusManager().eventBusFir(scanDevices);
// FlutterBluePlus.stopScan();
}, onError: (e) {
Get.log(
"Scan Error:$e",
);
});
FlutterBluePlus.cancelWhenScanComplete(subscription);
} catch (e) {
Get.log("扫描失败");
}
} else {
try {
if (Platform.isAndroid) {
await FlutterBluePlus.turnOn();
}
} catch (e) {
Get.log("Error Turning On:");
}
}
;
} else {
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
}
});
}
///
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack,
{bool isAddEquipment = false}) async {
FlutterBluePlus.isSupported.then((isAvailable) async {
if (isAvailable) {
if (_adapterState == BluetoothAdapterState.on) {
//
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
_connect(deviceName, (state) {
// if(bluetoothConnectionState != BluetoothConnectionState.connected){
// stateCallBack(bluetoothConnectionState!);
// }else{
// stateCallBack(bluetoothConnectionState!);
// }
stateCallBack(bluetoothConnectionState!);
}, isAddEquipment: isAddEquipment);
} else {
stateCallBack(bluetoothConnectionState!);
}
} else {
try {
stateCallBack(BluetoothConnectionState.disconnected);
openBlue();
} catch (e) {
Get.log("Error Turning On:");
}
}
} else {
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
}
@ -252,21 +327,26 @@ class BlueManage {
}
///
Future<void> _connect(String deviceName, ConnectStateCallBack connectStateCallBack, {bool isAddEquipment = false}) async {
Future<void> _connect(String deviceName, ConnectStateCallBack connectStateCallBack,
{bool isAddEquipment = false}) async {
connectDeviceName = deviceName;
List<ScanResult> devicesList = scanDevices;
if(isAddEquipment == false){
startScan(10, (List<ScanResult> scanDevices){
//
bool isExistDevice = scanDevices.any((element) => element.device.platformName == connectDeviceName);
if (isAddEquipment == false && isExistDevice == false) {
startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
Get.log("扫描到的设备:$scanDevices");
devicesList = scanDevices;
_connectDevice(devicesList, deviceName, connectStateCallBack, isAddEquipment: isAddEquipment);
});
}else{
} else {
_connectDevice(devicesList, deviceName, connectStateCallBack, isAddEquipment: isAddEquipment);
}
}
Future<void> _connectDevice( List<ScanResult> devicesList, String deviceName, ConnectStateCallBack connectStateCallBack, {bool isAddEquipment = false}) async {
Future<void> _connectDevice(
List<ScanResult> devicesList, String deviceName, ConnectStateCallBack connectStateCallBack,
{bool isAddEquipment = false}) async {
//
Get.log("devicesList:$devicesList");
final knownDeviceIndex = devicesList.indexWhere((d) => d.advertisementData.advName == deviceName);
@ -292,7 +372,7 @@ class BlueManage {
await stopScan();
if ((scanResult!.advertisementData.serviceUuids[0].toString()[31] == "0") && isAddEquipment == false) {
connectStateCallBack(BluetoothConnectionState.disconnected!);
connectStateCallBack(BluetoothConnectionState.disconnected);
EasyLoading.showToast("该锁已被重置", duration: 2000.milliseconds);
return;
}
@ -315,7 +395,7 @@ class BlueManage {
if (attempt >= maxAttempts) {
Get.log('Failed to connect after $maxAttempts attempts.');
connectStateCallBack(BluetoothConnectionState.disconnected!);
connectStateCallBack(BluetoothConnectionState.disconnected);
}
// await bluetoothConnectDevice!.connect();
@ -323,20 +403,18 @@ class BlueManage {
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
try {
bluetoothConnectDevice!.discoverServices().then((services) {
Get.log("333333333");
for (BluetoothService service in services) {
// Get.log("11111service.remoteId:${service.remoteId}"
// " service.uuid:${service.uuid}"
// " service.characteristics:${service.characteristics}"
// " service.includedServices:${service.includedServices}");
if(service.uuid == _serviceIdConnect){
if (service.uuid == _serviceIdConnect) {
for (BluetoothCharacteristic characteristic in service.characteristics) {
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
// " characteristic.uuid:${characteristic.uuid}"
// " characteristic.secondaryServiceUuid:${characteristic.secondaryServiceUuid}"
// " characteristic.characteristicUuid:${characteristic.characteristicUuid}");
if (characteristic.characteristicUuid == _characteristicIdSubscription) {
Get.log("44444444");
_subScribeToCharacteristic(characteristic);
Get.log('Discovering services finished');
bluetoothConnectionState = BluetoothConnectionState.connected;
@ -358,16 +436,18 @@ class BlueManage {
// ,
var allData = <int>[];
//
var lastTimeData = <int>[];
int? dataLen;
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
final subscription = characteristic.onValueReceived.listen((data) {
Get.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
Get.log("订阅获取的数据:$data");
if(data == lastTimeData || data.isEmpty){
if (data == lastTimeData || data.isEmpty) {
return;
}else{
} else {
lastTimeData = data;
}
// code to handle incoming data
@ -463,8 +543,7 @@ class BlueManage {
// " service.characteristics:${service.characteristics}\n\n"
// " service.includedServices:${service.includedServices}");
if (service.uuid == _serviceIdConnect) {
for (BluetoothCharacteristic characteristic in service
.characteristics) {
for (BluetoothCharacteristic characteristic in service.characteristics) {
// print("44444 characteristic.remoteId:${characteristic.remoteId}"
// " characteristic.uuid:${characteristic.uuid}\n\n"
// " characteristic.secondaryServiceUuid:${characteristic
@ -475,8 +554,7 @@ class BlueManage {
try {
List<int> valueList = value;
List subData = splitList(valueList, _mtuSize!);
Get.log(
'writeCharacteristicWithResponse 得到的分割数据:$subData');
Get.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
for (int i = 0; i < subData.length; i++) {
await characteristic.write(subData[i]).then((value) async {
@ -522,17 +600,17 @@ class BlueManage {
//
// Future<List<int>> _readCharacteristic(QualifiedCharacteristic characteristic) async {
// try {
// final result =
// await _flutterReactiveBle!.readCharacteristic(characteristic);
// print("readListresult$result");
// return result;
// } on Exception catch (e, s) {
// print(
// 'Error occurred when reading ${characteristic.characteristicId} : $e',
// );
// rethrow;
// }
// try {
// final result =
// await _flutterReactiveBle!.readCharacteristic(characteristic);
// print("readListresult$result");
// return result;
// } on Exception catch (e, s) {
// print(
// 'Error occurred when reading ${characteristic.characteristicId} : $e',
// );
// rethrow;
// }
// }
// Future<void> writeCharacteristicWithoutResponse(
@ -560,11 +638,11 @@ class BlueManage {
Future<void> disconnect() async {
try {
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
connectDeviceMacAddress = "";
if(bluetoothConnectionState == BluetoothConnectionState.connected){
await bluetoothConnectDevice!.disconnect();
Get.log("断开连接成功");
}
connectDeviceMacAddress = "";
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
await bluetoothConnectDevice!.disconnect();
Get.log("断开连接成功");
}
// }
} on Exception catch (e, _) {
Get.log("Error disconnecting from a device: $e");
@ -573,6 +651,15 @@ class BlueManage {
}
}
openBlue() async {
if (Platform.isAndroid) {
await FlutterBluePlus.turnOn();
}
if (Platform.isIOS) {
EasyLoading.showToast("请开启蓝牙", duration: 2000.milliseconds);
}
}
disposed() {
_sendStreamSubscription?.cancel();
_mtuSubscription!.cancel();

View File

@ -47,7 +47,7 @@ class _StarLockForgetPasswordPageState
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
print("路由返回值: ${result}, countryCode:${state.countryName.value} ,state.countryName.value:${state.countryName.value}");
},
child: SizedBox(
height: 70.h,
@ -185,7 +185,7 @@ class _StarLockForgetPasswordPageState
var result = await Navigator.pushNamed(
context, Routers.safetyVerificationPage,
arguments: {
"countryCode": "86",
"countryCode": state.countryCode.value,
"account": state.phoneStr.value
});
logic.state.xWidth.value =

View File

@ -8,6 +8,7 @@ import 'package:star_lock/tools/xs_jPhush.dart';
import '../../mine/mine/starLockMine_logic.dart';
import '../../network/api_repository.dart';
import '../../tools/eventBusEventManage.dart';
import '../../tools/storage.dart';
import 'starLock_login_state.dart';
@ -20,6 +21,7 @@ class StarLockLoginLogic extends BaseGetXController {
.login("1", state.pwd.value, "+86", state.emailOrPhone.value);
if (entity.errorCode!.codeIsSuccessful) {
Storage.saveLoginData(entity.data);
eventBus.fire(MineInfoChangeRefreshUI());
// Get.back();
// Get.toNamed(Routers.starLockMain);
XSJPushProvider().initJPushService();

View File

@ -285,7 +285,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
onClick: () {
state.isSendSuccess.value = false;
Navigator.pop(context, true);

View File

@ -398,7 +398,7 @@ class _VolumeAuthorizationLockPageState
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
onClick: () {
_isSendSuccess = false;
Navigator.pop(context, true);

View File

@ -31,11 +31,11 @@ class AddCardTypeLogic extends BaseGetXController{
endTime = "0";
if (startDate.isEmpty) {
showToast("请选择开始时间");
showToast("请选择开始时间".tr);
return;
}
if (endDate.isEmpty) {
showToast("请选择结束时间");
showToast("请选择结束时间".tr);
return;
}
@ -45,12 +45,12 @@ class AddCardTypeLogic extends BaseGetXController{
// }
if (int.parse(startDate) >= int.parse(endDate)) {
showToast("失效时间要大于生效时间");
showToast("失效时间要大于生效时间".tr);
return;
}
} else if (state.selectType.value == "2") {
if (state.beginTime.value.isEmpty) {
showToast("请选择有效期");
showToast("请选择有效期".tr);
return;
}
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
@ -61,7 +61,6 @@ class AddCardTypeLogic extends BaseGetXController{
}
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1: 2:
print("addOtherType startDate:$startDate endDate:$endDate");
Get.toNamed(Routers.addICCardPage, arguments: {
"lockId": state.lockId.value,
"endDate": endDate,

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -70,7 +71,6 @@ class _AddCardPageState extends State<AddCardPage> {
case 0:
{
//
// return sendElectronicKeySucceed();
return Column(
children: [
perpetualKeyWidget(
@ -214,7 +214,7 @@ class _AddCardPageState extends State<AddCardPage> {
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间",
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
@ -244,7 +244,7 @@ class _AddCardPageState extends State<AddCardPage> {
return Column(
children: [
Obx(() => CommonItem(
leftTitel: "是否是管理员",
leftTitel: "是否是管理员".tr,
rightTitle: "",
isTipsImg: false,
isHaveRightWidget: true,
@ -266,90 +266,20 @@ class _AddCardPageState extends State<AddCardPage> {
if (isDemoMode == false) {
// print("state.selectType:${state.selectType.value}");
if (state.nameController.text.isEmpty) {
logic.showToast("请输入姓名");
logic.showToast("请输入姓名".tr);
return;
}
logic.checkCardNameDuplicated(state.nameController.text);
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
logic.showToast("演示模式".tr);
}
}),
],
);
}
//
Widget sendElectronicKeySucceed() {
return Column(
children: [
Container(
height: 300.h,
width: 1.sw,
color: Colors.white,
child: Column(
children: [
SizedBox(
height: 30.h,
),
Image.asset(
'images/main/icon_main_addLock.png',
width: 150.w,
height: 150.w,
color: AppColors.mainColor,
),
SizedBox(
height: 20.h,
),
Text(
"操作成功,密码为",
style: TextStyle(
fontSize: 32.sp,
color: Colors.black,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 10.h,
),
Text(
"62689876",
style: TextStyle(
fontSize: 60.sp,
color: Colors.black,
fontWeight: FontWeight.w500),
),
],
),
),
SizedBox(
height: 20.h,
),
SubmitBtn(
btnName: '完成',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
SubmitBtn(
btnName: '分享',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
SubmitBtn(
btnName: '标记为:已入住',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
],
);
}
String getAppBarTitle(int type) {
String title;
switch (type) {

View File

@ -50,15 +50,13 @@ class AddICCardLogic extends BaseGetXController{
switch(status){
case 0x00:
//
print("${reply.commandType!.typeValue} 数据解析成功");
//
// state.cardNumber.value = reply.data.last.toString();
cancelBlueConnetctToastTimer();
state.ifConnectScuess.value = true;
break;
case 0x06:
//
print("${reply.commandType!.typeValue} 需要鉴权");
//
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -67,7 +65,6 @@ class AddICCardLogic extends BaseGetXController{
var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token);
print("_replyAddFingerprintReplyToken:$token");
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderAddFingerprintCommand(
@ -75,8 +72,6 @@ class AddICCardLogic extends BaseGetXController{
userID:await Storage.getUid(),
fingerNo:1,
useCountLimit:0xff,
// startTime:0x11223344,
// endTime:0x11223344,
startTime:int.parse(state.startDate.value)~/1000,
endTime:int.parse(state.endDate.value)~/1000,
needAuthor:1,
@ -86,32 +81,27 @@ class AddICCardLogic extends BaseGetXController{
);
break;
case 0x07:
//
print("${reply.commandType!.typeValue} 用户无权限");
//
Get.log("${reply.commandType!.typeValue} 用户无权限");
break;
case 0x09:
//
print("${reply.commandType!.typeValue} 权限校验错误");
//
Get.log("${reply.commandType!.typeValue} 权限校验错误");
break;
default:
//
print("${reply.commandType!.typeValue} 失败");
//
Get.log("${reply.commandType!.typeValue} 失败");
break;
}
}
Future<void> _replyAddICCardConfirmation(Reply reply) async {
int status = reply.data[2];
print("_replyAddFingerprintstatus:$status");
Get.log("_replyAddFingerprintstatus:$status");
switch(status){
case 0x00:
//
print("${reply.commandType!.typeValue} 数据解析成功");
// print("添加指纹确认成功,调用添加指纹接口");
//
if(state.cardNumber.value == (reply.data[6]).toString()){
return;
}else{
@ -133,23 +123,22 @@ class AddICCardLogic extends BaseGetXController{
}
break;
case 0x06:
//
//
break;
case 0x07:
//
print("${reply.commandType!.typeValue} 用户无权限");
//
Get.log("${reply.commandType!.typeValue} 用户无权限");
break;
case 0x09:
//
print("${reply.commandType!.typeValue} 权限校验错误");
//
Get.log("${reply.commandType!.typeValue} 权限校验错误");
break;
default:
//
print("${reply.commandType!.typeValue} 失败");
//
Get.log("${reply.commandType!.typeValue} 失败");
break;
}
}
@ -161,9 +150,8 @@ class AddICCardLogic extends BaseGetXController{
switch(status){
case 0x00:
//
print("${reply.commandType!.typeValue} 数据解析成功");
// print("添加指纹确认成功,调用添加指纹接口");
//
Get.log("${reply.commandType!.typeValue} 数据解析成功");
addICCardData();
break;
case 0x06:
@ -179,7 +167,6 @@ class AddICCardLogic extends BaseGetXController{
var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token);
print("_replyAddICCardConfirmationReplyToken:$token");
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderAddStressICCardCommand(
@ -188,8 +175,6 @@ class AddICCardLogic extends BaseGetXController{
icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
cardType:1,
useCountLimit:1,
// startTime:0x11223344,
// endTime:0x11223344,
startTime:int.parse(state.startDate.value)~/1000,
endTime:int.parse(state.endDate.value)~/1000,
needAuthor:1,
@ -200,19 +185,18 @@ class AddICCardLogic extends BaseGetXController{
);
break;
case 0x07:
//
print("${reply.commandType!.typeValue} 用户无权限");
//
Get.log("${reply.commandType!.typeValue} 用户无权限");
break;
case 0x09:
//
print("${reply.commandType!.typeValue} 权限校验错误");
//
Get.log("${reply.commandType!.typeValue} 权限校验错误");
break;
default:
//
print("${reply.commandType!.typeValue} 失败");
//
Get.log("${reply.commandType!.typeValue} 失败");
break;
}
}
@ -220,7 +204,6 @@ class AddICCardLogic extends BaseGetXController{
//
Future<void> senderAddICCard() async {
showBlueConnetctToastTimer(action: (){
print("没有任何响应");
Get.close(1);
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
@ -234,14 +217,12 @@ class AddICCardLogic extends BaseGetXController{
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList");
IoSenderManage.senderAddICCardCommand(
keyID:"1",
userID:await Storage.getUid(),
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
useCountLimit:0xff,
// startTime:0x11223344,
// endTime:0x11223344,
startTime:int.parse(state.startDate.value)~/1000,
endTime:int.parse(state.endDate.value)~/1000,
needAuthor:1,
@ -274,7 +255,6 @@ class AddICCardLogic extends BaseGetXController{
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList");
IoSenderManage.senderAddStressICCardCommand(
keyID:"1",
@ -297,7 +277,6 @@ class AddICCardLogic extends BaseGetXController{
}
void addICCardData() async {
print("state.startDate.value:${state.startDate.value} state.effectiveDateTime.value:${state.effectiveDateTime.value} state.failureDateTime.value:${state.failureDateTime.value}");
var entity = await ApiRepository.to.addICCardData(
lockId: state.lockId.value.toString(),
endDate: state.endDate.value,
@ -308,8 +287,8 @@ class AddICCardLogic extends BaseGetXController{
startDate: state.startDate.value,
isCoerced: state.isCoerced.value.toString(),
weekDay: state.weekDay.value,
startTime: int.parse(state.effectiveDateTime.value),
endTime: int.parse(state.failureDateTime.value),
startTime: int.parse(state.effectiveDateTime.value),
endTime: int.parse(state.failureDateTime.value),
cardRight: state.isAdministrator.value == "2" ? 1 : 0,
);
if (entity.errorCode!.codeIsSuccessful) {
@ -324,14 +303,7 @@ class AddICCardLogic extends BaseGetXController{
cardUserNo: state.cardNumber.value,
);
if(entity.errorCode!.codeIsSuccessful){
// Toast.show(msg: "添加成功");
// if(state.fromType.value == 2){
// //
// eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(cardId));
// }else if(state.fromType.value == 1){
// eventBus.fire(OtherTypeRefreshListEvent());
// }
// Get.close(2);
showToast("添加成功");
if(state.fromType.value == 2){
//

View File

@ -32,8 +32,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
backgroundColor: AppColors.mainColor,
),
body: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 200.h),
Center(
@ -63,8 +61,8 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
child: Center(
child: Obx(() => Text(
state.ifConnectScuess.value
? "已连接到锁,请将卡靠近锁的读卡区"
: "尝试连接设备...",
? "已连接到锁,请将卡靠近锁的读卡区".tr
: "尝试连接设备...".tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
),
],

View File

@ -38,14 +38,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
barTitle: "卡详情",
haveBack: true,
backgroundColor: AppColors.mainColor,
// actionsList: [
// TextButton(
// child: Text(TranslationLoader.lanKeys!.share!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),),
// onPressed: () {
//
// },
// ),
// ],
),
body: ListView(
children: [

View File

@ -20,7 +20,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> modifyKeyNameRequest() async {
if (state.changeNameController.text.isEmpty) {
showToast("请输入钥匙名称");
showToast("请输入钥匙名称".tr);
return;
}
KeyOperationRecordEntity entity = await ApiRepository.to
@ -30,7 +30,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
state.itemData.value.keyName = state.changeNameController.text;
state.keyName.value = state.itemData.value.keyName!;
Get.back();
showToast("修改成功", something: () {
showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
});
@ -56,7 +56,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
// }else if(updateType == 2){
// state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
// }
showToast("修改成功", something: () {
showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
});
@ -70,8 +70,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
includeUnderlings: includeUnderlings
);
if (entity.errorCode!.codeIsSuccessful) {
print("删除电子钥匙成功");
showToast("删除成功", something: () {
showToast("删除成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
@ -85,7 +84,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
keyId:state.itemData.value.keyId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功", something: () {
showToast("设置成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
@ -99,7 +98,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
keyId:state.itemData.value.keyId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功", something: () {
showToast("设置成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
@ -114,7 +113,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
includeUnderlings: includeUnderlings
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功", something: () {
showToast("设置成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
@ -129,7 +128,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
includeUnderlings: includeUnderlings
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功", something: () {
showToast("设置成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
@ -140,11 +139,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
String getKeyTypeShowDateTime(){
String useDateStr = '';
if(state.keyType.value == 1){
useDateStr = "永久";
useDateStr = "永久".tr;
}else if(state.keyType.value == 2){
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
}else if(state.keyType.value == 3){
useDateStr = "单次";
useDateStr = "单次".tr;
}else if(state.keyType.value == 4){
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
}
@ -154,9 +153,9 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Future openModalBottomSheet(BuildContext context) async {
var textList = <String>[];
if(state.keyType.value == 1 || state.keyType.value == 2){
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结", state.itemData.value.keyRight == 1 ? '取消授权' : '授权'];
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr];
} else if(state.keyType.value == 4){
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"];
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr];
}
showModalBottomSheet(
context: context,
@ -173,26 +172,22 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
if(state.itemData.value.keyRight == 1){
//
print("管理员 调用取消冻结");
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙'.tr, (isAllData) {
cancelFreeze(isAllData ? 1 : 0);
});
}else{
print("普通用户 调用取消冻结");
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效", (){
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效".tr, (){
cancelFreeze(0);
});
}
}else{
if(state.itemData.value.keyRight == 1){
//
print("管理员 调用冻结");
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
freezeKey(isAllData ? 1 : 0);
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时冻结其发送的钥匙'.tr, (isAllData) {
freezeKey(isAllData ? 1 : 0);
});
}else{
print("普通用户 调用冻结");
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效", (){
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效".tr, (){
freezeKey(0);
});
}
@ -201,13 +196,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
// /
if(state.itemData.value.keyRight == 1){
//
print("管理员 调用取消授权管理员接口");
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, (){
cancelAdministrator();
});
}else{
print("普通用户 调用授权管理员接口");
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码", (){
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码".tr, (){
setAdministrator();
});
}
@ -217,82 +210,15 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
});
}
// showPopMenus(BuildContext context){
// var textList = [];
// // keyType // :1;23:4
// // itemData.keyRight == 1 // 1: 2:
// // indexEntity.keyStatus! 110405: 110412: 110408: 110410:
// if(state.keyType.value == 1 || state.keyType.value == 2){
// textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}, {'text': state.itemData.value.keyRight == 1 ? '取消授权' : '授权'}];
// } else if(state.keyType.value == 4){
// textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}];
// }
// JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
// print('选中index: $index');
// print('选中text: $selText');
// Navigator.pop(context, true);
// Future.delayed(const Duration(seconds: 1));
//
// if(index == 0){
// if(state.itemData.value.keyStatus == 110405){
// //
// if(state.itemData.value.keyRight == 1){
// //
// print("管理员 调用取消冻结");
// ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
// cancelFreeze();
// });
// }else{
// print("普通用户 调用取消冻结");
// ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效", (){
// cancelFreeze();
// });
// }
// }else{
// if(state.itemData.value.keyRight == 1){
// //
// print("管理员 调用冻结");
// // ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
// // freezeKey();
// // });
// // showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
// // freezeKey();
// // });
// showToast("fasdfasdfasdf");
// }else{
// print("普通用户 调用冻结");
// ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效", (){
// freezeKey();
// });
// }
// }
// }else{
// // /
// if(state.itemData.value.keyRight == 1){
// //
// print("管理员 调用取消授权管理员接口");
// ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
// cancelAdministrator();
// });
// }else{
// print("普通用户 调用授权管理员接口");
// ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码", (){
// setAdministrator();
// });
// }
// }
// }, listData: textList);
// }
deletKeyLogic(){
if(state.itemData.value.keyRight == 1){
//
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
deleteKeyRequest(isAllData ? 1 : 0);
});
}else{
//
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效",(){
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
deleteKeyRequest(0);
});
}

View File

@ -126,7 +126,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false,
child: Obx(() => CommonItem(
leftTitel: "有效时间",
leftTitel: "有效时间".tr,
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
isHaveDirection: true,
action: () async {
@ -146,7 +146,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
})))),
Container(height: 10.h),
CommonItem(
leftTitel: "接收者",
leftTitel: "接收者".tr,
rightTitle: state.itemData.value.username ?? ""),
const SizedBox(height: 1),
CommonItem(
@ -161,7 +161,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Visibility(
visible: state.itemData.value.keyRight == 1 ? true:false,
child: CommonItem(
leftTitel: "仅管理自己创建的用户",
leftTitel: "仅管理自己创建的用户".tr,
rightTitle: "",
isHaveRightWidget: true,
isHaveLine: true,
@ -169,10 +169,10 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
width: 60.w,
child: _onlyManageYouCreatesUserSwitch())),
),
Visibility(
visible: (state.itemData.value.keyRight == 1 && state.keyInfo.value.lockSetting!.remoteUnlock == 1) ? false:true,
Visibility(// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true:false,
child: CommonItem(
leftTitel: "远程开锁",
leftTitel: "远程开锁".tr,
rightTitle: "",
isHaveRightWidget: true,
isHaveLine: true,
@ -217,149 +217,6 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
);
}
//
// Widget getPeriodValidityWidget() {
// int? dateType = state.keyType.value;
// Get.log('dateType:$dateType');
// if (dateType == XSConstantMacro.keyTypeLong) {
// return getLongTypeDateWidget();
// } else if (dateType == XSConstantMacro.keyTypeTime) {
// return getTimeLimitTypeDateWidget();
// } else if (dateType == XSConstantMacro.keyTypeOnce) {
// return getOnceTypeDateWidget();
// } else if (dateType == XSConstantMacro.keyTypeLoop) {
// return getLoopTypeDateWidget();
// }
// return Container();
// }
//
// //
// Widget getLongTypeDateWidget() {
// return CommonItem(
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
// rightTitle: '永久',
// isHaveDirection: true,
// action: () {
// Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
// arguments: {"itemData": state.itemData.value});
// });
// }
//
// //
// Widget getTimeLimitTypeDateWidget() {
// return CommonItem(
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
// allHeight: 90.h,
// rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
// isHaveDirection: true,
// action: () async {
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate,
// arguments: {"itemData": state.itemData.value});
// if (data != null) {
//
// // print("state.beginTime.value:${state.beginTime.value}"
// // "state.endTime.value:${state.endTime.value}"
// // "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
// // "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
// setState(() {
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
// state.beginTime.value = DateTool()
// .dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
// state.endTime.value = DateTool()
// .dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
// state.keyType.value = 2;
// Get.log("2222222222222");
// });
// Get.log("1111111111111");
// }
// });
// }
//
// //
// Widget getOnceTypeDateWidget() {
// return CommonItem(
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
// rightTitle: '单次',
// isHaveDirection: false,
// );
// }
//
// //
// Widget getLoopTypeDateWidget() {
// DateTime startDateStr =
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
// DateTime endDateStr =
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
// String useDateStr =
// '${startDateStr.toLocal().toString().substring(0, 16)} \n ${endDateStr.toLocal().toString().substring(0, 16)}';
//
// List getEffectiveDateList = [];
// List weekDaysList = state.itemData.value.weekDays!;
// if (weekDaysList.isNotEmpty) {
// String effectiveDateStr = '';
// for (int i = 0; i < weekDaysList.length; i++) {
// if (weekDaysList[i] == 1) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// } else if (weekDaysList[i] == 2) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// } else if (weekDaysList[i] == 3) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// } else if (weekDaysList[i] == 4) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// } else if (weekDaysList[i] == 5) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// } else if (weekDaysList[i] == 6) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// } else if (weekDaysList[i] == 7) {
// effectiveDateStr = '';
// getEffectiveDateList.add(effectiveDateStr);
// }
// }
// }
//
// return Column(
// children: [
// CommonItem(
// leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
// allHeight: 90.h,
// rightTitle: useDateStr,
// isHaveDirection: true,
// isHaveLine: true,
// action: () {
// Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
// "itemData": state.itemData.value,
// "keyType": 1
// });
// }),
// CommonItem(
// leftTitel: '有效日',
// rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
// isHaveDirection: true,
// isHaveLine: true,
// action: () {
// Navigator.pushNamed(
// context, Routers.electronicKeyPeriodValidityPage);
// }),
// ],
// );
// }
//
// //
// String getSenderDate(ElectronicKeyListItem indexEntity) {
// String senderDate = '';
// DateTime dateStr =
// DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
// senderDate = dateStr.toLocal().toString().substring(0, 16);
// return senderDate;
// }
CupertinoSwitch _switch(isOn) {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,

View File

@ -17,12 +17,12 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
showToast("失效时间需大于生效时间".tr);
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
showToast("生效时间需大于当前时间");
showToast("生效时间需大于当前时间".tr);
return;
}
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
@ -38,7 +38,7 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
remoteEnable: state.remoteEnable!.value
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: () {
showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back(result: {

View File

@ -19,12 +19,12 @@ class ElectronicKeyPeriodValidityLogic extends BaseGetXController {
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
if (starDateTimestamp >= endDateTimestamp) {
showToast("失效日期要大于生效日期");
showToast("失效日期要大于生效日期".tr);
return;
}
if (starTimeTimestamp >= endTimeTimestamp) {
showToast("失效时间要大于生效时间");
showToast("失效时间要大于生效时间".tr);
return;
}
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
@ -39,7 +39,7 @@ class ElectronicKeyPeriodValidityLogic extends BaseGetXController {
isOnlyManageSelf: state.isOnlyManageSelf.value!,
remoteEnable: state.remoteEnable.value!);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: () {
showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back(result: {

View File

@ -29,7 +29,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "修改有效期",
barTitle: "修改有效期".tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: ListView(
@ -63,7 +63,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
child: Column(
children: [
Obx(() => CommonItem(
leftTitel: "生效日期",
leftTitel: "生效日期".tr,
rightTitle: state.starDate.value,
isHaveDirection: true,
isHaveLine: true,
@ -74,7 +74,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
});
})),
Obx(() => CommonItem(
leftTitel: "失效日期",
leftTitel: "失效日期".tr,
rightTitle: state.endDate.value,
isHaveDirection: true,
action: () {

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_state.dart';
import 'package:star_lock/network/api_repository.dart';
@ -201,7 +202,7 @@ class KeyOperationRecordLogic extends BaseGetXController {
cardId:state.cardId.value,
fingerprintId:state.fingerprintId.value);
if (entity.errorCode!.codeIsSuccessful) {
print("操作记录列表成功:${entity.data?.itemList}");
// print("操作记录列表成功:${entity.data?.itemList}");
state.dataList.value = entity.data!.itemList!;
}
}
@ -231,7 +232,7 @@ class KeyOperationRecordLogic extends BaseGetXController {
KeyOperationRecordEntity entity =
await ApiRepository.to.clearOperationRecord('28');
if (entity.errorCode!.codeIsSuccessful) {
showToast("清除数据成功");
showToast("清除数据成功".tr);
}
}

View File

@ -42,7 +42,7 @@ class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
int? operateDate = dataItem.operateDate;
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
String operateDateStr =
'${dateStr.toLocal().toString().substring(0, 16)} 开锁';
'${dateStr.toLocal().toString().substring(0, 16)} ${"开锁".tr}';
return _electronicKeyItem(operateDateStr, () {});
},

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
@ -42,8 +43,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
ElectronicKeyListEntity entity = await ApiRepository.to
.resetElectronicKey(state.keyInfo.value.lockId.toString(), '0');
if (entity.errorCode!.codeIsSuccessful) {
print("重置电子钥匙成功啦啦啦啦啦");
showToast("重置成功", something: (){
showToast("重置成功".tr, something: (){
pageNo = 1;
mockNetworkDataRequest();
});
@ -58,8 +58,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
includeUnderlings:includeUnderlings
);
if (entity.errorCode!.codeIsSuccessful) {
print("删除电子钥匙成功");
showToast("删除成功",something: (){
showToast("删除成功".tr,something: (){
pageNo = 1;
mockNetworkDataRequest();
});
@ -69,12 +68,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
if(electronicKeyListItem.keyRight == 1){
//
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
});
}else{
//
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效",(){
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
});
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -14,6 +13,7 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
@ -64,9 +64,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
//
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
_showDialog();
ShowTipView().showIosTipWithContentDialog("该锁的电子钥匙都将被删除".tr, (){
logic.resetElectronicKeyListRequest();
});
} else {
logic.showToast("演示模式");
logic.showToast("演示模式".tr);
}
},
),
@ -164,7 +166,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
@ -215,14 +217,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久';
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
useDateStr = "单次";
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次';
useDateStr = "单次".tr;
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';
useDateStr = '循环'.tr;
}
return useDateStr;
@ -314,31 +316,4 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
);
}
//
void _showDialog() {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('该锁的电子钥匙都将被删除'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.reset!.tr),
onPressed: () {
Navigator.of(context).pop();
logic.resetElectronicKeyListRequest();
setState(() {});
},
),
],
);
},
);
}
}

View File

@ -1,4 +1,5 @@
import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../../../network/api_repository.dart';
@ -16,12 +17,12 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
}
if(state.lockIdList.isEmpty){
showToast("请选择锁");
showToast("请选择锁".tr);
return;
}
if(state.receiverList.isEmpty){
showToast("请选择接收者");
showToast("请选择接收者".tr);
return;
}
var entity = await ApiRepository.to.canSendKey(
@ -56,11 +57,11 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
endTime = "0";
if (startDate.isEmpty) {
showToast("请选择开始时间");
showToast("请选择开始时间".tr);
return;
}
if (endDate.isEmpty) {
showToast("请选择结束时间");
showToast("请选择结束时间".tr);
return;
}
@ -70,7 +71,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
// }
if (int.parse(startDate) >= int.parse(endDate)) {
showToast("失效时间要大于生效时间");
showToast("失效时间要大于生效时间".tr);
return;
}
}
@ -84,7 +85,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
case 3:
typeValue = XSConstantMacro.keyTypeLoop;
if (state.beginTime.value.isEmpty) {
showToast("请选择有效期");
showToast("请选择有效期".tr);
return;
}
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
@ -113,21 +114,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
remoteUnlockSwitch: state.isRemoteUnlock.value ? 1 : 2,
keyRight: 0
);
// var entity = await ApiRepository.to.batchSendKey(
// endDate:getFailureDateTime,
// keyGroupIdList:[],
// lockIdList:state.lockIdList,
// createUser:state.isCreateUser.value == true ? '1' : '0',
// isRemoteUnlock:state.isRemoteUnlock.value ? '1' : '2',
// keyNameForAdmin:receiverUserID,
// receiverUsername:receiverUserID,
// startDate:getEffectiveDateTime,
// countryCode:state.countryCode.value,
// usernameType:'1',
// weekDays:state.weekdaysList);
if (entity.errorCode!.codeIsSuccessful) {
print('群发电子钥匙成功');
state.isSendSuccess.value = true;
resetData();
} else {

View File

@ -124,7 +124,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"发送成功",
"发送成功".tr,
style: TextStyle(
fontSize: 26.sp,
color: Colors.black,
@ -139,7 +139,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
onClick: () {
state.isSendSuccess.value = false;
Get.back();
@ -284,13 +284,13 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
state.endTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
// Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
}
})),
Obx(() => Visibility(
visible: state.weekdaysList.isNotEmpty ? true : false,
child: CommonItem(
leftTitel: "有效日",
leftTitel: "有效日".tr,
rightTitle: state.weekdaysList.value.join(",").toString(),
isHaveDirection: true,
isHaveLine: true,
@ -315,7 +315,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间",
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {

View File

@ -19,7 +19,7 @@ class MassSendElectronicKeyState{
var type = ''.obs;//
var isSendSuccess = false.obs;
var countryName = '中国'.obs;
var countryName = '中国'.tr.obs;
var countryCode = '86'.obs;
var isCreateUser = false.obs; //1 0

View File

@ -35,7 +35,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
appBar: AppBar(
backgroundColor: AppColors.mainColor,
title: Text(
'选择用户',
'选择用户'.tr,
style: TextStyle(
color: Colors.white,
fontSize: 28.sp,
@ -78,7 +78,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
child: Row(
children: [
Text(
'已选中${selectUserIdList.length}',
'${"已选中".tr}${selectUserIdList.length}',
style: TextStyle(color: Colors.black, fontSize: 24.sp),
),
Expanded(
@ -89,7 +89,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
width: 120.w,
height: 60.h,
child: SubmitBtn(
btnName: '确定',
btnName: '确定'.tr,
onClick: () {
Map<String, dynamic> resultMap = {};
resultMap['lockUserList'] = selectDataList;

View File

@ -60,7 +60,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
Container(
width: ScreenUtil().screenWidth,
margin: EdgeInsets.only(left: 20.w),
child: Text('请选择要发送的锁',
child: Text('请选择要发送的锁'.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
),
@ -69,7 +69,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
),
Expanded(child: _buildListView(context, lockGroupList)),
SubmitBtn(
btnName: '确定',
btnName: '确定'.tr,
onClick: () {
// print('得到lockid为$selectLockIdList ');
Map<String, dynamic> resultMap = {};
@ -86,7 +86,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
//
Future<List<GroupListItem>> mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('2');
List<GroupListItem> dataList = [];
if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) {
@ -137,7 +137,6 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
}
}
setState(() {});
print('选中了么0');
},
typeImgList: const [],
groupItem: itemData,

View File

@ -16,7 +16,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
//
Future<void> sendElectronicKeyRequest() async {
if (state.emailOrPhoneController.text.isEmpty) {
showToast("请输入接收者账号");
showToast("请输入接收者账号".tr);
return;
}
//
@ -42,11 +42,11 @@ class SendElectronicKeyLogic extends BaseGetXController {
endTime = "0";
if (startDate.isEmpty) {
showToast("请选择开始时间");
showToast("请选择开始时间".tr);
return;
}
if (endDate.isEmpty) {
showToast("请选择结束时间");
showToast("请选择结束时间".tr);
return;
}
@ -56,7 +56,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
// }
if (int.parse(startDate) >= int.parse(endDate)) {
showToast("失效时间要大于生效时间");
showToast("失效时间要大于生效时间".tr);
return;
}
}
@ -70,7 +70,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
case 3:
typeValue = XSConstantMacro.keyTypeLoop;
if (state.beginTime.value.isEmpty) {
showToast("请选择有效期");
showToast("请选择有效期".tr);
return;
}
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
@ -107,7 +107,6 @@ class SendElectronicKeyLogic extends BaseGetXController {
endTime: int.parse(endTime),
isOnlyManageSelf: 0);
if (entity.errorCode!.codeIsSuccessful) {
print('发送电子钥匙成功');
state.isSendSuccess.value = true;
state.sendSucceedType.value = int.parse(state.type.value);
resetData();
@ -144,7 +143,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('接收者号码未注册,请重新发送'),
title: Text('接收者号码未注册,请重新发送'.tr),
actions: [
CupertinoDialogAction(
child: Text(
@ -185,7 +184,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: Text('是否发送电子钥匙给未注册账号\n${state.emailOrPhoneController.text}'),
title: Text('${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}'),
actions: [
CupertinoDialogAction(
child: Text(

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -202,7 +203,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
rightTitle: "",
isTipsImg: true,
tipsImgAction: () {
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。");
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。".tr);
},
isHaveRightWidget: true,
rightWidget: SizedBox(
@ -244,7 +245,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
Obx(() => Visibility(
visible: state.weekdaysList.isNotEmpty ? true : false,
child: CommonItem(
leftTitel: "有效日",
leftTitel: "有效日".tr,
rightTitle: state.weekdaysList.value.join(",").toString(),
isHaveDirection: true,
isHaveLine: true,
@ -269,7 +270,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间",
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
@ -321,7 +322,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
setState(() {});
} else {
//
logic.showToast("演示模式");
logic.showToast("演示模式".tr);
}
}),
Container(
@ -337,7 +338,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
Navigator.pushNamed(
context, Routers.massSendElectronicKeyManagePage);
} else {
logic.showToast("演示模式");
logic.showToast("演示模式".tr);
}
},
child: Text(
@ -377,7 +378,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"发送成功",
"发送成功".tr,
style: TextStyle(
fontSize: 26.sp,
color: Colors.black,
@ -392,7 +393,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
onClick: () {
state.isSendSuccess.value = false;
logic.resetData();
@ -401,7 +402,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
height: 10.h,
),
OutLineBtn(
btnName: '分享',
btnName: '分享'.tr,
onClick: () {
// Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
_openModalBottomSheet();
@ -444,8 +445,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
roomStatus: 1,
);
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
logic.showToast("标记成功");
logic.showToast("标记成功".tr);
}
}
@ -605,7 +605,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消',
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
@ -621,10 +621,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友'.tr, 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信'.tr, 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件'.tr, 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多'.tr, 3));
return widgetList;
}
@ -666,14 +666,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
case 0:
//
{
String pwdShareStr = '您好,您的电子钥匙生成成功';
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
}
break;
case 1:
//
{
String pwdShareStr = '您好,您的电子钥匙生成成功';
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
}
break;
@ -686,7 +686,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
case 3:
//
{
String pwdShareStr = '您好,您的电子钥匙生成成功';
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
}
break;

View File

@ -24,7 +24,7 @@ class SendElectronicKeyState {
var type = ''.obs;//
var isSendSuccess = false.obs;
var countryName = '中国'.obs;
var countryName = '中国'.tr.obs;
var countryCode = '86'.obs;
var isCreateUser = false.obs; //1 0

View File

@ -12,8 +12,7 @@ class SendEmailNotificationPage extends StatefulWidget {
const SendEmailNotificationPage({Key? key}) : super(key: key);
@override
State<SendEmailNotificationPage> createState() =>
_SendEmailNotificationPageState();
State<SendEmailNotificationPage> createState() => _SendEmailNotificationPageState();
}
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
@ -21,87 +20,80 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
@override
Widget build(BuildContext context) {
_emailController.text =
"亲爱的用户 \n\n你收到电子钥匙请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
_emailController.text = "亲爱的用户 \n\n你收到电子钥匙请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "邮件通知",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: "786612630@qq.com",
isHaveLine: true,
),
CommonItem(
leftTitel: "类型",
rightTitle: "个人邮件",
isHaveDirection: true,
),
Container(height: 10.h),
CommonItem(
leftTitel: "模板",
rightTitle: "默认模板",
appBar: TitleAppBar(barTitle: "邮件通知", haveBack: true, backgroundColor: AppColors.mainColor),
body: SingleChildScrollView(
child: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: "786612630@qq.com",
isHaveLine: true,
),
CommonItem(
leftTitel: "类型",
rightTitle: "个人邮件",
isHaveDirection: true,
isHaveLine: true),
Container(
height: 360.h,
color: Colors.white,
padding: EdgeInsets.only(
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
child: TextField(
maxLines: 8,
maxLength: 1000,
textAlign: TextAlign.start,
controller: _emailController,
style: TextStyle(
color: Colors.black,
fontSize: 22.sp,
),
decoration: InputDecoration(
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 0.5,
),
),
Container(height: 10.h),
CommonItem(leftTitel: "模板", rightTitle: "默认模板", isHaveDirection: true, isHaveLine: true),
Container(
height: 360.h,
color: Colors.white,
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
child: TextField(
maxLines: 8,
maxLength: 1000,
textAlign: TextAlign.start,
controller: _emailController,
style: TextStyle(
color: Colors.black,
fontSize: 22.sp,
),
decoration: InputDecoration(
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 0.5,
),
),
///
width: 1,
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 1,
),
),
),
),
),
),
Container(height: 40.h),
SubmitBtn(
btnName: '发送',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
],
Container(height: 40.h),
SubmitBtn(
btnName: '发送',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
],
),
),
);
}

View File

@ -251,7 +251,7 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),

View File

@ -49,7 +49,7 @@ class AddFingerprintTypeLogic extends BaseGetXController{
}
} else if (state.selectType.value == "2") {
if (state.beginTime.value.isEmpty) {
showToast("请选择有效期");
showToast("请选择有效期".tr);
return;
}
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();

View File

@ -325,7 +325,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),

View File

@ -34,7 +34,7 @@ class LockDetailLogic extends BaseGetXController {
void initReplySubscription() {
state.replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
// Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
//
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
_replyOpenLock(reply);

View File

@ -15,7 +15,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
state.itemData.value.keyboardPwdId.toString(),
1);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功", something: (){
showToast("删除成功".tr, something: (){
Get.back(result: "deletScuess");
});
}
@ -37,7 +37,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
keyboardPwdType: state.itemData.value.keyboardPwdType!);
if (entity.errorCode!.codeIsSuccessful) {
Get.back();
showToast("修改成功", something: (){
showToast("修改成功".tr, something: (){
if(changType == 1){
//
state.keyboardPwdName.value = state.inputNameController.text;
@ -45,7 +45,6 @@ class PasswordKeyDetailLogic extends BaseGetXController {
//
state.keyboardPwd.value = state.inputPwdController.text;
}
print("state.itemData.value.keyboardPwd:${state.itemData.value.keyboardPwd} state.itemData.value.keyboardPwdName:${state.itemData.value.keyboardPwdName}");
eventBus.fire(GetPasswordListRefreshUI());
});
}

View File

@ -87,7 +87,7 @@ class PasswordKeyListLogic extends BaseGetXController {
break;
case 4:
// 4 使使
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
useDateStr = '${endDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
break;
case 5:
// 5
@ -97,7 +97,7 @@ class PasswordKeyListLogic extends BaseGetXController {
case 6:
// 6
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"".tr}$starHour:00-$endHour:00 ${"循环"}';
'${endDateStr.toLocal().toString().substring(0, 16)} ${"".tr}$starHour:00-$endHour:00 ${"循环"}';
break;
case 7:
// 7
@ -137,7 +137,7 @@ class PasswordKeyListLogic extends BaseGetXController {
case 14:
// 14
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${endDateStr.toLocal().toString().substring(0, 16)} ${"".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
default:

View File

@ -1,4 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -11,7 +11,6 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
@ -125,10 +124,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
itemCount: state.itemDataList.value.length,
itemBuilder: (c, index) {
PasswordKeyListItem passwordKeyListItem = state.itemDataList.value[index];
String useDateStr = ''; //使
String useDateStr = logic.getUseDateStr(passwordKeyListItem);// 使
//使
useDateStr = logic.getUseDateStr(passwordKeyListItem);
return Slidable(
key:ValueKey(passwordKeyListItem.keyboardPwdId),
endActionPane: ActionPane(

View File

@ -1,3 +1,5 @@
// ignore_for_file: slash_for_doc_comments
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
@ -22,20 +24,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
///
/**
1 6使
2 24使
3 24使
4 使使
5
6
7
8
9
10
11
12
13
14
1 6使
2 24使
3 24使
4 使使
5
6
7
8
9
10
11
12
13
14
*/
//
Future<void> getKeyboardPwdRequest() async {
@ -45,14 +47,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
String getKeyType = state.widgetType.value.toString();
if (state.nameController.text.isEmpty) {
showToast("请输入姓名");
showToast("请输入姓名".tr);
return;
}
//
if (state.widgetType.value == 4) {
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间");
showToast("生效时间不能小于当前时间".tr);
return;
}
}
@ -62,12 +64,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
} else if (state.widgetType.value == 1) {
//
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间");
showToast("生效时间不能小于当前时间".tr);
return;
}
if (startDate >= endDate) {
showToast("失效时间要大于生效时间");
showToast("失效时间要大于生效时间".tr);
return;
}
getKeyType = '3';
@ -80,7 +82,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
//
//
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("结束时间不能小于当前时间");
showToast("结束时间不能小于当前时间".tr);
return;
}
@ -119,7 +121,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
endHours: state.loopEndHours.value,
isCoerced: 1);
if (entity.errorCode!.codeIsSuccessful) {
print('获取密码成功');
state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value;
state.pwdNameStr = state.nameController.text;
@ -155,7 +156,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
getFailureDateTime,
'1');
if (entity.errorCode!.codeIsSuccessful) {
print('获取密码成功');
state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value;
state.pwdNameStr = state.nameController.text;
@ -170,6 +170,26 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
}
}
Future<void> checkKeyboardpwdNameRequest() async {
if (state.nameController.text.isEmpty) {
showToast("请输入姓名");
return;
}
if (state.pwdController.text.isEmpty) {
showToast("请输入密码");
return;
}
var entity = await ApiRepository.to.checkKeyboardpwdName(
lockId:state.keyInfo.value.lockId.toString(),
keyboardPwdName:state.nameController.text,
keyboardPwd:state.pwdController.text,);
if (entity.errorCode!.codeIsSuccessful) {
senderCustomPasswords();
} else {
showToast('${entity.errorMsg}');
}
}
// late DateTime getStartDateTime;
//
late StreamSubscription<Reply> _replySubscription;
@ -220,17 +240,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 0x07:
//
print("${reply.commandType!.typeValue} 用户无权限");
cancelBlueConnetctToastTimer();
break;
case 0x09:
//
print("${reply.commandType!.typeValue} 权限校验错误");
cancelBlueConnetctToastTimer();
break;
default:
//
print("${reply.commandType!.typeValue} 失败");
cancelBlueConnetctToastTimer();
break;
}
}
@ -243,16 +263,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
//
Future<void> senderCustomPasswords() async {
if (state.nameController.text.isEmpty) {
showToast("请输入姓名");
return;
}
if (state.pwdController.text.isEmpty) {
showToast("请输入密码");
return;
}
var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
var endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
//

View File

@ -363,7 +363,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
if (isDemoMode == false) {
//
if (state.widgetType.value == 3) {
logic.senderCustomPasswords();
logic.checkKeyboardpwdNameRequest();
} else {
logic.getKeyboardPwdRequest();
}
@ -417,7 +417,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
onClick: () {
state.isSendSuccess.value = false;
state.nameController.text = "";
@ -428,7 +428,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
height: 10.h,
),
OutLineBtn(
btnName: '分享',
btnName: '分享'.tr,
onClick: () {
_openModalBottomSheet();
},
@ -547,7 +547,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消',
'取消'.tr,
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
@ -563,10 +563,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友'.tr, 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信'.tr, 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件'.tr, 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多'.tr, 3));
return widgetList;
}

View File

@ -1,4 +1,4 @@
import 'package:date_format/date_format.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';

View File

@ -228,7 +228,7 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),

View File

@ -72,7 +72,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
}
switch (status) {
case PermissionStatus.denied:
print("拒绝");
// print("拒绝");
break;
case PermissionStatus.granted:
if(Platform.isIOS){
@ -84,16 +84,16 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
}
break;
case PermissionStatus.limited:
print("限制");
// print("限制");
break;
case PermissionStatus.permanentlyDenied:
print("永久的否认");
// print("永久的否认");
break;
case PermissionStatus.provisional:
print("临时");
// print("临时");
break;
default:
print("其他状态");
// print("其他状态");
// requestLocation();
break;
}
@ -101,7 +101,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
Future<void> requestAndroidLocation() async {
location.onLocationChanged().listen((event) {
print("listenLocationChanged$event");
// print("listenLocationChanged$event");
// EasyLoading.dismiss();
if (event.isNotEmpty) {
setState(() {
@ -116,7 +116,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
location = AMapFlutterLocation()
..setLocationOption(AMapLocationOption())
..onLocationChanged().listen((event) {
print("listenLocationChanged$event");
// print("listenLocationChanged$event");
// EasyLoading.dismiss();
if (event.isNotEmpty) {
setState(() {
@ -163,7 +163,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("地理位置", style: TextStyle(fontSize: 50.sp)),
Text("地理位置".tr, style: TextStyle(fontSize: 50.sp)),
],
),
),
@ -202,12 +202,11 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
),
Container(
// color: Colors.red,
height: 45.h,
margin: EdgeInsets.only(left: 25.w, top: 20.h, right: 25.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("检查以确保以下地址是正确的", style: TextStyle(fontSize: 24.sp)),
Flexible(child: Text("检查以确保以下地址是正确的".tr, style: TextStyle(fontSize: 24.sp))),
],
),
),
@ -233,7 +232,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
],
) : SizedBox(
height: 1.sw/5*4 + 65.h*2,
child: const Center(child: Text('地图加载中,请稍候。。。')))
child: Center(child: Text('地图加载中,请稍候。。。'.tr)))
,
),
SizedBox(height:200.h),
@ -242,7 +241,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
children: [
TextButton(
child: Text(
"跳过",
"跳过".tr,
style: TextStyle(color: Colors.black, fontSize: 24.sp),
),
onPressed: () {
@ -263,7 +262,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
),
onPressed: () {
if(addressInfo!.isEmpty){
logic.showToast("还未获取到位置信息哦,请耐心等待一下!");
logic.showToast("还未获取到位置信息哦,请耐心等待一下!".tr);
return;
}
Get.toNamed(Routers.saveLockPage, arguments: {

View File

@ -32,11 +32,17 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 80.h,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500),),
],
Container(
margin: EdgeInsets.only(left: 50.w, right: 50.w),
width: 1.sw,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500))
),
],
),
),
SizedBox(height: 80.h,),
Container(
@ -54,7 +60,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
],
// style:TextStyle(height: 1.1, fontSize: 36.sp, fontWeight: FontWeight.w400, color:AppColors.mainColor),
decoration: InputDecoration(
hintText: '请填写信息',
hintText: '请填写信息'.tr,
hintStyle: TextStyle(
// height: 1.1,
fontSize: 24.sp,

View File

@ -33,6 +33,8 @@ class StarLockMineLogic extends BaseGetXController {
state.userNickName.value = (await Storage.getNickname())!;
state.userMobile.value = (await Storage.getMobile())! ?? '';
state.userEmail.value = (await Storage.getEmail())!;
state.userHeadUrl.value = (await Storage.getHeadUrl())!;
Get.log("userNickName:${state.userNickName.value} userMobile:${state.userMobile.value} userEmail:${state.userEmail.value}");
}
}

View File

@ -6,6 +6,7 @@ import 'package:star_lock/flavors.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
import '../../baseWidget.dart';
import '../../tools/customNetworkImage.dart';
import '../../tools/submitBtn.dart';
import '../../translations/trans_lib.dart';
import 'starLockMine_logic.dart';
@ -71,17 +72,21 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
child: Container(
width: 105.w,
height: 105.w,
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(52.5.w)),
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.all(Radius.circular(52.5.w)),
// ),
child: ClipRRect(
borderRadius: BorderRadius.circular(52.5.w),
child: CustomNetworkImage(url:state.userHeadUrl.value??"", width:105.w, height:105.h),
),
child:
// state.headUrl().isNotEmpty ?
// Image(image: NetworkImage(state.loginData.value.data!.headUrl!)) :
Image.asset(
'images/mine/icon_mine_main_defaultAvatar.png',
width: 60.w,
height: 60.w)),
// Image.asset(
// 'images/mine/icon_mine_main_defaultAvatar.png',
// width: 60.w,
// height: 60.w)
),
),
SizedBox(
height: 20.h,

View File

@ -6,6 +6,6 @@ class StarLockMineState {
var userNickName = "".obs;
var userMobile = "".obs;
var userEmail = "".obs;
var userHeadUrl = "".obs;
void onClose() {}
}

View File

@ -13,7 +13,6 @@ class MinePersonInfoLogic extends GetConnect {
Future<void> getUserInfoRequest() async {
MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo("");
if (entity.errorCode!.codeIsSuccessful) {
print('到了这里么');
state.mineInfoData.value = entity.data!;
}
}
@ -33,9 +32,7 @@ class MinePersonInfoLogic extends GetConnect {
}
//
void uploadFile(
MinePersonGetUploadFileInfoEntity
minePersonGetUploadFileInfoEntity) async {
void uploadFile(MinePersonGetUploadFileInfoEntity minePersonGetUploadFileInfoEntity) async {
// String json = JsonDecoder(minePersonGetUploadFileInfoEntity.data!.formData!);
// var formData = FormData();
@ -45,10 +42,8 @@ class MinePersonInfoLogic extends GetConnect {
// MultipartFile(state.image!.path, filename: 'b'),
// ));
Map<String, dynamic> user =
minePersonGetUploadFileInfoEntity.data!.formData!;
user[minePersonGetUploadFileInfoEntity.data!.fileField!] =
state.image!.path;
Map<String, dynamic> user = minePersonGetUploadFileInfoEntity.data!.formData!;
user[minePersonGetUploadFileInfoEntity.data!.fileField!] = state.image!.path;
final form = FormData(user);
var entity = await ApiRepository.to.uploadFile(
url: minePersonGetUploadFileInfoEntity.data!.uploadUrl!, body: form);
@ -93,7 +88,6 @@ class MinePersonInfoLogic extends GetConnect {
// TODO: implement onInit
super.onInit();
getUserInfoRequest();
}
@override

View File

@ -7,12 +7,14 @@ import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../appRouters.dart';
import '../../../tools/commonItem.dart';
import '../../../tools/customNetworkImage.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
@ -24,23 +26,18 @@ class MinePersonInfoPage extends StatefulWidget {
}
class _MinePersonInfoPageState extends State<MinePersonInfoPage>
with WidgetsBindingObserver {
// with WidgetsBindingObserver
{
final logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state;
@override
initState() {
super.initState();
WidgetsBinding.instance.addObserver(this); //
logic.getUserInfoRequest();
_checkCameraPermission();
_checkPhotoPermission();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this); //
super.dispose();
// WidgetsBinding.instance.addObserver(this); //
// logic.getUserInfoRequest();
// _checkCameraPermission();
// _checkPhotoPermission();
}
// //
@ -70,26 +67,33 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
isHaveLine: true,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: ClipOval(
child: state.image != null
? Image.file(
File(state.image!.path),
width: 72.w,
height: 72.w,
fit: BoxFit.fill,
)
: Image.asset(
'images/controls_user.png',
width: 72.w,
height: 72.w,
fit: BoxFit.fill,
),
rightWidget:
Container(
// color: Colors.orange,
child: ClipRRect(
borderRadius: BorderRadius.circular(36.w),
child: CustomNetworkImage(url:"https://ui-avatars.com/api/?name=%E6%98%B5&color=7F9CF5&background=EBF4FF", width:72.w, height:72.w),
),
),
// ClipOval(
// child: state.image != null
// ? Image.file(
// File(state.image!.path),
// width: 72.w,
// height: 72.w,
// fit: BoxFit.fill,
// )
// : Image.asset(
// 'images/controls_user.png',
// width: 72.w,
// height: 72.w,
// fit: BoxFit.fill,
// ),
// ),
action: () async {
//
if (Platform.isAndroid) {
AppFirstEnterHandle()
.getAppFirstEnter(context, isAgreeCamera);
AppFirstEnterHandle().getAppFirstEnter(context, isAgreeCamera);
var getFlag = await Storage.getString(isAgreeCamera);
if (getFlag == isAgreeCamera) {
_openModalBottomSheet();
@ -101,16 +105,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! : "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage, arguments: {
'nickName': state.mineInfoData.value.nickname
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.minePersonInfoEditNamePage,
arguments: {'nickName': state.mineInfoData.value.nickname})
.then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
@ -122,16 +123,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
action: () {
// isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
.then((value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
@ -144,18 +142,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
action: () {
// isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
.then((value) => logic.getUserInfoRequest());
}
})),
CommonItem(
@ -164,30 +157,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
Navigator.pushNamed(context, Routers.minePersonInfoResetPasswordPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle:
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage)
Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoViewSafetyProblemPage);
Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage);
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! : "",
isHaveLine: false,
isHaveDirection: false)),
],
@ -221,7 +208,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
}
Future<void> _requestPhotoPermission() async {
var status = await Permission.photos.request();
//andriud33以下的设备兼容
bool isAndroid33 = AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
var status = isAndroid33 ? await Permission.photos.request() : await Permission.storage.request();
if (status.isGranted) {
setState(() {
state.hasPhotoPermission.value = true; //
@ -230,6 +219,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
//
showPermissionDeniedDialog();
}
//
// PermissionStatus photosStatus = await Permission.photos.request();
//
// if (photosStatus.isGranted) {
// //
// state.hasPhotoPermission.value = true;
// } else {
// //
// showPermissionDeniedDialog();
// }
}
// Future<void> requestPhotoPermission() async {
@ -271,8 +271,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
shape: RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.circular(10)),
builder: (BuildContext context) {
return AlertBottomWidget(
topTitle: '',
@ -281,13 +280,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
int getSelectIndex = value;
if (getSelectIndex == 0) {
//
state.hasCameraPermission.value == true
? selectCamera()
: _requestCameraPermission();
state.hasCameraPermission.value == true ? selectCamera() : _requestCameraPermission();
} else if (getSelectIndex == 1) {
state.hasPhotoPermission.value == true
? selectImage()
: _requestPhotoPermission();
state.hasPhotoPermission.value == true ? selectImage() : _requestPhotoPermission();
}
},
);
@ -296,8 +291,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
///
selectCamera() async {
XFile? photo = await state.imagePicker.pickImage(
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
XFile? photo = await state.imagePicker.pickImage(source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
if (photo != null) {
state.image = photo;
// logic.getUpTokenRequest();
@ -349,4 +343,10 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
});
}
}
@override
void dispose() {
// WidgetsBinding.instance.removeObserver(this); //
super.dispose();
}
}

View File

@ -14,6 +14,12 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
if (entity.errorCode!.codeIsSuccessful) {
dataList = entity.data!.list!;
state.lockItemList.value = dataList;
for (int i = 0; i < dataList.length; i++) {
var itemData = dataList[i];
if (itemData.appUnlockOnline == 1) {
state.selectLockIdList.add(itemData.lockId);
}
}
}
return dataList;
}

View File

@ -24,7 +24,7 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
}
if(state.lockIdList.isEmpty){
showToast("请选择锁");
showToast("请选择锁".tr);
return;
}

View File

@ -399,7 +399,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
height: 20.h,
),
SubmitBtn(
btnName: '完成',
btnName: '完成'.tr,
onClick: () {
state.isSendSuccess.value = false;
Navigator.pop(context, true);

View File

@ -12,7 +12,7 @@ class GroupEditLockLogic extends BaseGetXController {
//
Future<void> lockGroupAddLock(List lockIds) async {
if(lockIds.isEmpty){
showToast("请选择锁");
showToast("请选择锁".tr);
return;
}
var entity = await ApiRepository.to.lockGroupAddLock(
@ -29,7 +29,7 @@ class GroupEditLockLogic extends BaseGetXController {
//
Future<void> lockGroupDeletLock(List lockIds) async {
if(lockIds.isEmpty){
showToast("请选择锁");
showToast("请选择锁".tr);
return;
}
var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds);

View File

@ -12,7 +12,7 @@ class LockGroupListLogic extends BaseGetXController {
//
void mockNetworkDataRequest() async {
var entity = await ApiRepository.to.lockGroupList('1');
var entity = await ApiRepository.to.lockGroupList('0');
if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) {
state.lockNum = 0;

View File

@ -146,7 +146,7 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
}
}
if(isCanNext == false){
logic.showToast("请选择锁");
logic.showToast("请选择锁".tr);
return;
}
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {

View File

@ -151,7 +151,7 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
}
}
if(isCanNext == false){
logic.showToast("请选择锁");
logic.showToast("请选择锁".tr);
return;
}
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {

View File

@ -45,6 +45,7 @@ abstract class Api {
final String passwordKeyGetURL = '/keyboardPwd/get'; //
final String passwordKeyAddURL = '/keyboardPwd/add'; //
final String passwordKeyCheckKeyboardpwdNameURL = '/keyboardPwd/checkKeyboardpwdName'; //
final String updatePasswordKeyURL = '/keyboardPwd/update'; //
final String clearOperationRecordURL = '/lockRecords/clear'; //
final String addlockGroupURL = '/keyGroup/add'; //

View File

@ -451,6 +451,20 @@ class ApiProvider extends BaseProvider {
'addType': addType,
}));
//
Future<Response> checkKeyboardpwdName(
String lockId,
String keyboardPwdName,
String keyboardPwd
) =>
post(
passwordKeyCheckKeyboardpwdNameURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyboardPwdName': keyboardPwdName,
'keyboardPwd': keyboardPwd,
}));
Future<Response> updateKeyboardPwd(
int lockId,
String keyboardPwdId,

View File

@ -450,6 +450,18 @@ class ApiRepository {
return PasswordKeyEntity.fromJson(res.body);
}
//
Future<PasswordKeyEntity> checkKeyboardpwdName(
{
required String lockId,
required String keyboardPwdName,
required String keyboardPwd
}) async {
final res = await apiProvider.checkKeyboardpwdName(lockId, keyboardPwdName,
keyboardPwd);
return PasswordKeyEntity.fromJson(res.body);
}
//
Future<PasswordKeyEntity> updatePasswordKey(
{required int lockId,

View File

@ -175,6 +175,12 @@ class Storage {
return nickname;
}
static Future<String?> getHeadUrl() async {
LoginData? loginData = await getLoginData();
String? headUrl = loginData!.headUrl;
return headUrl;
}
static Future<LoginData?> getLoginData() async {
LoginData? loginData;
final data = await Storage.getString(saveUserLoginData);

View File

@ -27,8 +27,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.22+202404031、打包预发布环境给欧阳测试
# 1.0.23+202404061、打包预发布环境给欧阳测试
# 1.0.24+202404071、打包预发布环境给欧阳测试
# 1.0.25+20240407021、打包预发布环境给欧阳测试
# 1.0.26+20240408打包预发布环境给欧阳测试
version: 1.0.24+20240407
version: 1.0.26+20240408
environment:
sdk: '>=2.12.0 <3.0.0'
@ -109,7 +111,7 @@ dependencies:
#高德地图定位
amap_flutter_location: ^3.0.0
#权限使用
permission_handler: ^10.4.3
permission_handler: ^11.3.1
#高德地图地图
amap_flutter_map: ^3.0.0