添加项目中未国际化字段到类addFace_state.dart

This commit is contained in:
魏少阳 2024-08-21 14:12:15 +08:00
parent e817883575
commit 5afd588b5c
198 changed files with 1656 additions and 1593 deletions

View File

@ -871,5 +871,102 @@
"密码失效": "Password invalid", "密码失效": "Password invalid",
"门锁时间异常": "Door lock time abnormal", "门锁时间异常": "Door lock time abnormal",
"APP(手机)未联网": "APP (mobile phone) is not connected to the Internet", "APP(手机)未联网": "APP (mobile phone) is not connected to the Internet",
"数据不存在": "Data does not exist" "数据不存在": "Data does not exist",
"待接收": "BeReceived",
"已冻结": "Frozen",
"已删除": "Deleted",
"未知": "Unknown",
"拖动下方滑块完成拼图": "Drag the slider below to complete the puzzle",
"验证成功": "Verification success",
"验证失败": "Verification failed",
"向右拖动滑块填充拼图": "Drag the slider to the right to fill the puzzle",
"请先获取到位置信息哦": "Please get the location information first",
"请选择国家": "Please select a country",
"获取锁信息": "Get lock information",
"锁数据异常,请重试": "Lock data is abnormal, please try again",
"连接设备中...": "Connecting device...",
"把锁": "Lock",
"条": "strip",
"封": "seal",
"次": "times",
"支付成功": "Pay success",
"查看详情": "View details",
"请输入模板名称": "Please enter the template name",
"模版类型": "Template type",
"再返回一次退出": "Exit again",
"请先添加锁": "Please add the lock first",
"可视对讲": "Visual intercom",
"详细日志": "Detailed log",
"已复制到剪切板": "Copied to clipboard",
"拍照": "Photo",
"从相册选择": "Choose from album",
"选择问题": "Select a question",
"确认长度不足8位": "Confirm length less than 8 digits",
"新密码长度不足8位": "New password length less than 8 digits",
"两次密码不一致": "The two passwords do not match",
"请点击获取验证码,验证码将发送到": "Please click to get the verification code, the verification code will be sent to",
"切换": "Switch",
"验证": "Verification",
"验证成功,账号已删除": "Verification successful, account deleted",
"该密码不是自定义密码,无法修改": "This password is not a custom password and cannot be modified",
"请选择设备要关联哪些姓名": "Please select which names the device should be associated with",
"请选择姓名要关联哪些设备": "Please select which devices the name should be associated with",
"确定要移除所选中的坏锁吗?": "Are you sure you want to remove the selected bad lock?",
"邮件通知": "Email notification",
"短信通知": "SMS notification",
"您好,您的授权管理员生成成功": "Hello, your authorized administrator has been generated successfully",
"请输入接收者姓名": "Please enter the recipient's name",
"版本更新": "Version update",
"下次再说": "Next time",
"配网成功": "Network distribution success",
"配网失败": "Network distribution failed",
"该锁的无线键盘都将被删除": "The wireless keyboard of the lock will be deleted",
"实时画面": "Real-time picture",
"适合门口较为安全的环境。": "Suitable for relatively safe environments at the door.",
"仅发生特定事件才录像,并可查看实时画面。": "Only specific events are recorded and the real-time picture can be viewed.",
"一般情况下满电可使用7-8个月": "Under normal circumstances, it can be used for 7-8 months when fully charged",
"有人逗留或发生特定事件才录像,可随时查看": "Someone stays or specific events are recorded, and can be viewed at any time",
"实时画面。": "Real-time picture.",
"一般情况下满电可使用5~6个月。": "Under normal circumstances, it can be used for 5~6 months when fully charged.",
"适合门口人员复杂、较不安全的环境。": "Suitable for complex and relatively unsafe environments at the door.",
"有人出现就录像,可随时查看实时画面。": "Record when someone appears, and view the real-time picture at any time.",
"一般情况下满电可使用2~4个月。": "Under normal circumstances, it can be used for 2~4 months when fully charged.",
"根据您家门口实际情况设置录像和实时画面功能。": "Set the video and real-time picture functions according to the actual situation at your door.",
"可使用时长由具体设置决定。": "The duration of use is determined by the specific settings.",
"查看": "View",
"有人按门铃或发生": "Someone rings the doorbell or",
"异常事件时": "abnormal event",
"不录像": "No video",
"有人出现、按门铃": "Someone appears, rings the doorbell",
"或发生异常事件时": "or an abnormal event occurs",
"逗留达到10秒": "Stay for 10 seconds",
"约1.5米": "About 1.5 meters",
"随时":"Anytime",
"立即录像": "Record immediately",
"录像时机": "Video timing",
"有人出现时录像": "Record when someone appears",
"人体侦测距离": "Human detection distance",
"查看实时画面": "View real-time picture",
"自定义时间": "Custom time",
"当日": "Today",
"次日": "Next day",
"自定义时段": "Custom time period",
"发生事件时查看": "View when an event occurs",
"实时查看": "Real-time view",
"有人在门口出现10秒后开始录像。": "Someone appears at the door for 10 seconds before recording.",
"有人按门铃时立即录像。": "Record immediately when someone rings the doorbell.",
"有人出现在门前1.5米范围时启动录像": "Start recording when someone appears within 1.5 meters in front of the door",
"约0.8米": "About 0.8 meters",
"约3.0米": "About 3.0 meters",
"添加指纹失败": "Failed to add fingerprint",
"项": "items",
"播放中": "Playing",
"下载": "Download",
"暂无下载内容": "No download content",
"亮度": "Brightness",
"音量": "Volume",
"快进至": "Fast forward to",
"快退至": "Rewind to",
"暂无视频信息": "No video information",
"加载出错": "Loading error"
} }

View File

@ -903,5 +903,102 @@
"密码失效": "密码失效", "密码失效": "密码失效",
"门锁时间异常": "门锁时间异常", "门锁时间异常": "门锁时间异常",
"APP(手机)未联网": "APP(手机)未联网", "APP(手机)未联网": "APP(手机)未联网",
"数据不存在": "数据不存在" "数据不存在": "数据不存在",
"待接收": "待接收",
"已冻结": "已冻结",
"已删除": "已删除",
"未知": "未知",
"拖动下方滑块完成拼图": "拖动下方滑块完成拼图",
"验证成功": "验证成功",
"验证失败": "验证失败",
"向右拖动滑块填充拼图": "向右拖动滑块填充拼图",
"请先获取到位置信息哦": "请先获取到位置信息哦",
"请选择国家": "请选择国家",
"获取锁信息": "获取锁信息",
"锁数据异常,请重试": "锁数据异常,请重试",
"连接设备中...": "连接设备中...",
"把锁": "把锁",
"条": "条",
"封": "封",
"次": "次",
"支付成功": "支付成功",
"查看详情": "查看详情",
"请输入模板名称": "请输入模板名称",
"模版类型": "模版类型",
"再返回一次退出": "再返回一次退出",
"请先添加锁": "请先添加锁",
"可视对讲": "可视对讲",
"详细日志": "详细日志",
"已复制到剪切板": "已复制到剪切板",
"拍照": "拍照",
"从相册选择": "从相册选择",
"选择问题": "选择问题",
"确认长度不足8位": "确认长度不足8位",
"新密码长度不足8位": "新密码长度不足8位",
"两次密码不一致": "两次密码不一致",
"请点击获取验证码,验证码将发送到": "请点击获取验证码,验证码将发送到",
"切换": "切换",
"验证": "验证",
"验证成功,账号已删除": "验证成功,账号已删除",
"该密码不是自定义密码,无法修改": "该密码不是自定义密码,无法修改",
"请选择设备要关联哪些姓名": "请选择设备要关联哪些姓名",
"请选择姓名要关联哪些设备": "请选择姓名要关联哪些设备",
"确定要移除所选中的坏锁吗?": "确定要移除所选中的坏锁吗?",
"邮件通知": "邮件通知",
"短信通知": "短信通知",
"您好,您的授权管理员生成成功": "您好,您的授权管理员生成成功",
"请输入接收者姓名": "请输入接收者姓名",
"版本更新": "版本更新",
"下次再说": "下次再说",
"配网成功": "配网成功",
"配网失败": "配网失败",
"该锁的无线键盘都将被删除": "该锁的无线键盘都将被删除",
"实时画面": "实时画面",
"适合门口较为安全的环境。": "适合门口较为安全的环境。",
"仅发生特定事件才录像,并可查看实时画面。": "仅发生特定事件才录像,并可查看实时画面。",
"一般情况下满电可使用7-8个月": "一般情况下满电可使用7-8个月",
"有人逗留或发生特定事件才录像,可随时查看": "有人逗留或发生特定事件才录像,可随时查看",
"实时画面。": "实时画面。",
"一般情况下满电可使用5~6个月。": "一般情况下满电可使用5~6个月。",
"适合门口人员复杂、较不安全的环境。": "适合门口人员复杂、较不安全的环境。",
"有人出现就录像,可随时查看实时画面。": "有人出现就录像,可随时查看实时画面。",
"一般情况下满电可使用2~4个月。": "一般情况下满电可使用2~4个月。",
"根据您家门口实际情况设置录像和实时画面功能。": "根据您家门口实际情况设置录像和实时画面功能。",
"可使用时长由具体设置决定。": "可使用时长由具体设置决定。",
"查看": "查看",
"有人按门铃或发生": "有人按门铃或发生",
"异常事件时": "异常事件时",
"不录像": "不录像",
"有人出现、按门铃": "有人出现、按门铃",
"或发生异常事件时": "或发生异常事件时",
"逗留达到10秒": "逗留达到10秒",
"约1.5米": "约1.5米",
"随时":"随时",
"立即录像": "立即录像",
"录像时机": "录像时机",
"有人出现时录像": "有人出现时录像",
"人体侦测距离": "人体侦测距离",
"查看实时画面": "查看实时画面",
"自定义时间": "自定义时间",
"当日": "当日",
"次日": "次日",
"自定义时段": "自定义时段",
"发生事件时查看": "发生事件时查看",
"实时查看": "实时查看",
"有人在门口出现10秒后开始录像。": "有人在门口出现10秒后开始录像。",
"有人按门铃时立即录像。": "有人按门铃时立即录像。",
"有人出现在门前1.5米范围时启动录像": "有人出现在门前1.5米范围时启动录像",
"约0.8米": "约0.8米",
"约3.0米": "约3.0米",
"添加指纹失败": "添加指纹失败",
"项": "项",
"播放中": "播放中",
"下载": "下载",
"暂无下载内容": "暂无下载内容",
"亮度": "亮度",
"音量": "音量",
"快进至": "快进至",
"快退至": "快退至",
"暂无视频信息": "暂无视频信息",
"加载出错": "加载出错"
} }

View File

@ -869,5 +869,102 @@
"密码失效": "密码失效", "密码失效": "密码失效",
"门锁时间异常": "门锁时间异常", "门锁时间异常": "门锁时间异常",
"APP(手机)未联网": "APP(手机)未联网", "APP(手机)未联网": "APP(手机)未联网",
"数据不存在": "数据不存在" "数据不存在": "数据不存在",
"待接收": "待接收",
"已冻结": "已冻结",
"已删除": "已删除",
"未知": "未知",
"拖动下方滑块完成拼图": "拖动下方滑块完成拼图",
"验证成功": "验证成功",
"验证失败": "验证失败",
"向右拖动滑块填充拼图": "向右拖动滑块填充拼图",
"请先获取到位置信息哦": "请先获取到位置信息哦",
"请选择国家": "请选择国家",
"获取锁信息": "获取锁信息",
"锁数据异常,请重试": "锁数据异常,请重试",
"连接设备中...": "连接设备中...",
"把锁": "把锁",
"条": "条",
"封": "封",
"次": "次",
"支付成功": "支付成功",
"查看详情": "查看详情",
"请输入模板名称": "请输入模板名称",
"模版类型": "模版类型",
"再返回一次退出": "再返回一次退出",
"请先添加锁": "请先添加锁",
"可视对讲": "可视对讲",
"详细日志": "详细日志",
"已复制到剪切板": "已复制到剪切板",
"拍照": "拍照",
"从相册选择": "从相册选择",
"选择问题": "选择问题",
"确认长度不足8位": "确认长度不足8位",
"新密码长度不足8位": "新密码长度不足8位",
"两次密码不一致": "两次密码不一致",
"请点击获取验证码,验证码将发送到": "请点击获取验证码,验证码将发送到",
"切换": "切换",
"验证": "验证",
"验证成功,账号已删除": "验证成功,账号已删除",
"该密码不是自定义密码,无法修改": "该密码不是自定义密码,无法修改",
"请选择设备要关联哪些姓名": "请选择设备要关联哪些姓名",
"请选择姓名要关联哪些设备": "请选择姓名要关联哪些设备",
"确定要移除所选中的坏锁吗?": "确定要移除所选中的坏锁吗?",
"邮件通知": "邮件通知",
"短信通知": "短信通知",
"您好,您的授权管理员生成成功": "您好,您的授权管理员生成成功",
"请输入接收者姓名": "请输入接收者姓名",
"版本更新": "版本更新",
"下次再说": "下次再说",
"配网成功": "配网成功",
"配网失败": "配网失败",
"该锁的无线键盘都将被删除": "该锁的无线键盘都将被删除",
"实时画面": "实时画面",
"适合门口较为安全的环境。": "适合门口较为安全的环境。",
"仅发生特定事件才录像,并可查看实时画面。": "仅发生特定事件才录像,并可查看实时画面。",
"一般情况下满电可使用7-8个月": "一般情况下满电可使用7-8个月",
"有人逗留或发生特定事件才录像,可随时查看": "有人逗留或发生特定事件才录像,可随时查看",
"实时画面。": "实时画面。",
"一般情况下满电可使用5~6个月。": "一般情况下满电可使用5~6个月。",
"适合门口人员复杂、较不安全的环境。": "适合门口人员复杂、较不安全的环境。",
"有人出现就录像,可随时查看实时画面。": "有人出现就录像,可随时查看实时画面。",
"一般情况下满电可使用2~4个月。": "一般情况下满电可使用2~4个月。",
"根据您家门口实际情况设置录像和实时画面功能。": "根据您家门口实际情况设置录像和实时画面功能。",
"可使用时长由具体设置决定。": "可使用时长由具体设置决定。",
"查看": "查看",
"有人按门铃或发生": "有人按门铃或发生",
"异常事件时": "异常事件时",
"不录像": "不录像",
"有人出现、按门铃": "有人出现、按门铃",
"或发生异常事件时": "或发生异常事件时",
"逗留达到10秒": "逗留达到10秒",
"约1.5米": "约1.5米",
"随时":"随时",
"立即录像": "立即录像",
"录像时机": "录像时机",
"有人出现时录像": "有人出现时录像",
"人体侦测距离": "人体侦测距离",
"查看实时画面": "查看实时画面",
"自定义时间": "自定义时间",
"当日": "当日",
"次日": "次日",
"自定义时段": "自定义时段",
"发生事件时查看": "发生事件时查看",
"实时查看": "实时查看",
"有人在门口出现10秒后开始录像。": "有人在门口出现10秒后开始录像。",
"有人按门铃时立即录像。": "有人按门铃时立即录像。",
"有人出现在门前1.5米范围时启动录像": "有人出现在门前1.5米范围时启动录像",
"约0.8米": "约0.8米",
"约3.0米": "约3.0米",
"添加指纹失败": "添加指纹失败",
"项": "项",
"播放中": "播放中",
"下载": "下载",
"暂无下载内容": "暂无下载内容",
"亮度": "亮度",
"音量": "音量",
"快进至": "快进至",
"快退至": "快退至",
"暂无视频信息": "暂无视频信息",
"加载出错": "加载出错"
} }

View File

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:get/get.dart';
import '../../flavors.dart'; import '../../flavors.dart';
@ -46,19 +47,19 @@ class XSConstantMacro {
// 使 // 使
return ''; return '';
case 110402: case 110402:
return '待接收'; return '待接收'.tr;
case 110403: case 110403:
return '未生效'; return '未生效'.tr;
case 110405: case 110405:
return '已冻结'; return '已冻结'.tr;
case 110408: case 110408:
return '已删除'; return '已删除'.tr;
// case 110410: // case 110410:
// return "已重置"; // return "已重置";
case 110412: case 110412:
return '已过期'; return '已过期'.tr;
default: default:
return '未知'; return '未知'.tr;
} }
} }

View File

@ -1,15 +1,19 @@
import 'dart:convert';
import 'dart:math';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import 'package:star_lock/common/safetyVerification/entity/SafetyVerificationEntity.dart';
import 'package:star_lock/common/safetyVerification/safetyVerification_logic.dart'; import 'package:star_lock/common/safetyVerification/safetyVerification_logic.dart';
import 'dart:convert'; import 'package:star_lock/common/safetyVerification/safetyVerification_state.dart';
import 'dart:math';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
import '../../network/api_repository.dart'; import '../../network/api_repository.dart';
import '../../tools/titleAppBar.dart'; import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart';
class SafetyVerificationPage extends StatefulWidget { class SafetyVerificationPage extends StatefulWidget {
const SafetyVerificationPage({Key? key}) : super(key: key); const SafetyVerificationPage({Key? key}) : super(key: key);
@ -20,11 +24,11 @@ class SafetyVerificationPage extends StatefulWidget {
class _SafetyVerificationPageState extends State<SafetyVerificationPage> with TickerProviderStateMixin { class _SafetyVerificationPageState extends State<SafetyVerificationPage> with TickerProviderStateMixin {
final logic = Get.put(SafetyVerificationLogic()); final SafetyVerificationLogic logic = Get.put(SafetyVerificationLogic());
final state = Get.find<SafetyVerificationLogic>().state; final SafetyVerificationState state = Get.find<SafetyVerificationLogic>().state;
String baseImageBase64 = ""; String baseImageBase64 = '';
String slideImageBase64 = ""; String slideImageBase64 = '';
Size baseSize = Size.zero; // Size baseSize = Size.zero; //
Size slideSize = Size.zero; // Size slideSize = Size.zero; //
@ -51,7 +55,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
checkResultAfterDrag = false; checkResultAfterDrag = false;
}); });
var entity = await ApiRepository.to.getSliderVerifyImg(state.getData["countryCode"].toString(), state.getData["account"].toString()); final SafetyVerificationEntity entity = await ApiRepository.to.getSliderVerifyImg(state.getData['countryCode'].toString(), state.getData['account'].toString());
if(entity.errorCode! == 0){ if(entity.errorCode! == 0){
state.sliderXMoved.value = 0; state.sliderXMoved.value = 0;
sliderStartX = 0; sliderStartX = 0;
@ -60,11 +64,11 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
baseImageBase64 = entity.data!.bigImg!; baseImageBase64 = entity.data!.bigImg!;
slideImageBase64 = entity.data!.smallImg!; slideImageBase64 = entity.data!.smallImg!;
var baseR = await WidgetUtil.getImageWH( final Rect baseR = await WidgetUtil.getImageWH(
image: Image.memory(const Base64Decoder().convert(baseImageBase64))); image: Image.memory(const Base64Decoder().convert(baseImageBase64)));
baseSize = baseR.size; baseSize = baseR.size;
var silderR = await WidgetUtil.getImageWH( final Rect silderR = await WidgetUtil.getImageWH(
image: Image.memory(const Base64Decoder().convert(slideImageBase64))); image: Image.memory(const Base64Decoder().convert(slideImageBase64)));
slideSize = silderR.size; slideSize = silderR.size;
@ -80,9 +84,9 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
sliderMoveFinish = true; sliderMoveFinish = true;
}); });
var entity = await ApiRepository.to.checkSliderVerifyImg(state.getData["countryCode"].toString(), state.getData["account"].toString(), sliderMovedX.toString()); final CheckSafetyVerificationEntity entity = await ApiRepository.to.checkSliderVerifyImg(state.getData['countryCode'].toString(), state.getData['account'].toString(), sliderMovedX.toString());
if(entity.errorCode! == 0){ if(entity.errorCode! == 0){
checkSuccess("captchaVerification"); checkSuccess('captchaVerification');
}else{ }else{
state.sliderXMoved.value = 0; state.sliderXMoved.value = 0;
sliderStartX = 0; sliderStartX = 0;
@ -112,7 +116,6 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
@override @override
void didUpdateWidget(SafetyVerificationPage oldWidget) { void didUpdateWidget(SafetyVerificationPage oldWidget) {
// TODO: implement didUpdateWidget
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
} }
@ -125,8 +128,8 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
} }
Widget buildContent(BuildContext context) { Widget buildContent(BuildContext context) {
var mediaQuery = MediaQuery.of(context); final MediaQueryData mediaQuery = MediaQuery.of(context);
var dialogWidth = 0.9 * mediaQuery.size.width; double dialogWidth = 0.9 * mediaQuery.size.width;
if (dialogWidth < 330) { if (dialogWidth < 330) {
dialogWidth = mediaQuery.size.width; dialogWidth = mediaQuery.size.width;
} }
@ -134,7 +137,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "安全验证", barTitle: '安全验证'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Container( body: Container(
@ -171,7 +174,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
_showTimeLine = false; _showTimeLine = false;
}); });
// //
Navigator.pop(context, {'xWidth': state.sliderXMoved.value.toString()}); Navigator.pop(context, <String, String>{'xWidth': state.sliderXMoved.value.toString()});
}); });
}); });
} }
@ -186,7 +189,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
_forwardAnimation(); _forwardAnimation();
// //
Future.delayed(Duration(milliseconds: 1000)).then((v) { Future.delayed(const Duration(milliseconds: 1000)).then((v) {
_reverseAnimation().then((v) { _reverseAnimation().then((v) {
setState(() { setState(() {
_showTimeLine = false; _showTimeLine = false;
@ -221,15 +224,12 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Text('拖动下方滑块完成拼图', style: TextStyle(fontSize: 26.sp),), Text('拖动下方滑块完成拼图'.tr, style: TextStyle(fontSize: 26.sp),),
IconButton( IconButton(
icon: const Icon(Icons.refresh), icon: const Icon(Icons.refresh),
iconSize: 30, iconSize: 30,
color: Colors.black54, color: Colors.black54,
onPressed: () { onPressed: loadCaptcha),
//
loadCaptcha();
}),
], ],
), ),
); );
@ -242,14 +242,12 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
/// 310*155 /// 310*155
baseImageBase64.isNotEmpty ? if (baseImageBase64.isNotEmpty) Image.memory(
Image.memory(
const Base64Decoder().convert(baseImageBase64), const Base64Decoder().convert(baseImageBase64),
fit: BoxFit.fitWidth, fit: BoxFit.fitWidth,
// key: _baseImageKey, // key: _baseImageKey,
gaplessPlayback: true, gaplessPlayback: true,
): ) else Container(
Container(
width: 310, width: 310,
height: 155, height: 155,
alignment: Alignment.center, alignment: Alignment.center,
@ -257,15 +255,14 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
), ),
/// ///
slideImageBase64.isNotEmpty ? if (slideImageBase64.isNotEmpty) Obx(() => Container(
Obx(() => Container(
margin: EdgeInsets.fromLTRB(state.sliderXMoved.value, 0, 0, 0), margin: EdgeInsets.fromLTRB(state.sliderXMoved.value, 0, 0, 0),
child: Image.memory(const Base64Decoder().convert(slideImageBase64), child: Image.memory(const Base64Decoder().convert(slideImageBase64),
fit: BoxFit.fitHeight, fit: BoxFit.fitHeight,
// key: _slideImageKey, // key: _slideImageKey,
gaplessPlayback: true, gaplessPlayback: true,
), ),
)) : Container(), )) else Container(),
Positioned( Positioned(
bottom: 0, bottom: 0,
left: -10, left: -10,
@ -281,8 +278,8 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
_checkSuccess _checkSuccess
? "${(_checkMilliseconds / (60.0 * 12)).toStringAsFixed(2)}s验证成功" ? '${(_checkMilliseconds / (60.0 * 12)).toStringAsFixed(2)}s${'验证成功'.tr}'
: "验证失败", : '验证失败',
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),
@ -306,9 +303,9 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
} }
/// ///
_bottomContainer() { Widget _bottomContainer() {
return baseSize.width >0 ? return baseSize.width >0 ?
Container( SizedBox(
height: 70, height: 70,
width: baseSize.width, width: baseSize.width,
child: Stack( child: Stack(
@ -326,7 +323,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
), ),
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Text('向右拖动滑块填充拼图', style: TextStyle(fontSize: 16),), child: Text('向右拖动滑块填充拼图'.tr, style: const TextStyle(fontSize: 16),),
), ),
Obx(() => Container( Obx(() => Container(
width: state.sliderXMoved.value, width: state.sliderXMoved.value,
@ -334,12 +331,12 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
color: const Color(0xfff3fef1), color: const Color(0xfff3fef1),
)), )),
GestureDetector( GestureDetector(
onPanStart: (startDetails) { onPanStart: (DragStartDetails startDetails) {
/// ///
_checkMilliseconds = DateTime.now().millisecondsSinceEpoch; _checkMilliseconds = DateTime.now().millisecondsSinceEpoch;
sliderStartX = startDetails.localPosition.dx; sliderStartX = startDetails.localPosition.dx;
}, },
onPanUpdate: (updateDetails) { onPanUpdate: (DragUpdateDetails updateDetails) {
/// ///
double offset = updateDetails.localPosition.dx - sliderStartX; double offset = updateDetails.localPosition.dx - sliderStartX;
if(offset < 0){ if(offset < 0){
@ -349,9 +346,9 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
state.sliderXMoved.value = offset; state.sliderXMoved.value = offset;
}); });
}, },
onPanEnd: (endDetails) { // onPanEnd: (DragEndDetails endDetails) { //
checkCaptcha(state.sliderXMoved.value); checkCaptcha(state.sliderXMoved.value);
int nowTime = DateTime.now().millisecondsSinceEpoch; final int nowTime = DateTime.now().millisecondsSinceEpoch;
_checkMilliseconds = nowTime - _checkMilliseconds; _checkMilliseconds = nowTime - _checkMilliseconds;
}, },
child: Obx(() { child: Obx(() {
@ -389,15 +386,14 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
class MaxScaleTextWidget extends StatelessWidget { class MaxScaleTextWidget extends StatelessWidget {
const MaxScaleTextWidget({Key? key, this.max = 1.0, required this.child}) : super(key: key);
final double max; final double max;
final Widget child; final Widget child;
const MaxScaleTextWidget({Key? key, this.max = 1.0, required this.child}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var data = MediaQuery.of(context); final MediaQueryData data = MediaQuery.of(context);
var textScaleFactor = min(max, data.textScaleFactor); final double textScaleFactor = min(max, data.textScaleFactor);
return MediaQuery(data: data.copyWith(textScaleFactor: textScaleFactor), child: child); return MediaQuery(data: data.copyWith(textScaleFactor: textScaleFactor), child: child);
} }
} }

View File

@ -68,7 +68,7 @@ class AddICCardLogic extends BaseGetXController{
final List<int> token = reply.data.sublist(5, 9); final List<int> token = reply.data.sublist(5, 9);
final List<String> saveStrList = changeIntListToStringList(token); final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
AppLog.log('添加卡token:$token'); // AppLog.log('添加卡token:$token');
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand( IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
keyID:'1', keyID:'1',

View File

@ -229,40 +229,6 @@ class CardListLogic extends BaseGetXController {
return keyDateTypeStr; return keyDateTypeStr;
} }
void signBlue(){
// final authCode = crypto.md5.convert([48,50,57,52,102,179,68,85,170,30,0,0,111,9,183,38,188,37,220,154,158,173,242,98]);
// AppLog.log('authCode:$authCode');
// final ebcData = SM4.encrypt([48, 145, 84, 77, 72, 95, 49, 101, 48, 54, 56, 57, 97, 56, 56, 54, 102, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 57, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 179, 68, 85, 32, 98, 99, 101, 101, 56, 97, 50, 51, 51, 99, 102, 51, 52, 53, 48, 101, 57, 53, 52, 51, 98, 49, 51, 56, 53, 52, 49, 48, 57, 100, 56, 54], key: utf8.encode('TMH_1e0689a886f8'), mode: SM4CryptoMode.ECB);
// AppLog.log('ebcData:$ebcData');
// final oriDataList = SM4.decrypt([103, 213, 54, 227, 120, 57, 155, 4, 31, 95, 214, 233, 229, 100, 85, 18], key: utf8.encode('TMH_1e0689a886f8'), mode: SM4CryptoMode.ECB);
// AppLog.log('oriDataList:$oriDataList');
final List<int> authCodeData = [];
//authUserID
authCodeData.addAll(utf8.encode('294'));
//KeyID
authCodeData.addAll(utf8.encode('0'));
//NowTime 4
// DateTime now = DateTime.now();
// int timestamp = now.millisecondsSinceEpoch;
var nowTime = 1723083753;
authCodeData.add((nowTime & 0xff000000) >> 24);
authCodeData.add((nowTime & 0xff0000) >> 16);
authCodeData.add((nowTime & 0xff00) >> 8);
authCodeData.add(nowTime & 0xff);
authCodeData.addAll([168, 37, 0, 0, 190, 240, 188, 129, 150, 249, 113, 15, 44, 243, 227, 30]);
AppLog.log('authCodeData:$authCodeData');
// KeyIDauthUserIDmd5加密之后就是authCode
final authCode = crypto.md5.convert(authCodeData);
AppLog.log('authCode:$authCode authCode.bytes.length:${authCode.bytes.length} authCode.bytes:${authCode.bytes}');
}
@override @override
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();
@ -274,8 +240,6 @@ class CardListLogic extends BaseGetXController {
_initRefreshAction(); _initRefreshAction();
} }
// signBlue();
} }
@override @override

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -15,7 +16,6 @@ import '../../../../tools/showTipView.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/lockMain/lockMain_logic.dart'; import '../../../lockMian/lockMain/lockMain_logic.dart';
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart'; import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'cardList_logic.dart'; import 'cardList_logic.dart';

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -12,7 +13,6 @@ import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'otherTypeKeyChangeValidityDate_logic.dart'; import 'otherTypeKeyChangeValidityDate_logic.dart';
class OtherTypeKeyChangeValidityDatePage extends StatefulWidget { class OtherTypeKeyChangeValidityDatePage extends StatefulWidget {

View File

@ -3,33 +3,7 @@ import 'package:get/get.dart';
import '../../../../tools/commonDataManage.dart'; import '../../../../tools/commonDataManage.dart';
class AddFaceState { class AddFaceState { // 0 1 2
RxBool ifCurrentScreen = true.obs; // ,
RxBool ifAddState = false.obs;//
RxBool ifConnectScuess = false.obs;
RxInt maxRegCount = 0.obs; //
RxInt regIndex = 0.obs; //
RxString faceNumber = ''.obs;
final RxInt lockId = 0.obs;
final RxString endDate = ''.obs;
final RxString addType = ''.obs;
final RxString faceName = ''.obs;
final RxInt faceType = 0.obs;
// final cyclicConfig = [].obs;
final RxString featureData = ''.obs;
final RxBool isClickAddFace = false.obs;
final RxString isCoerced = ''.obs;
final RxString isAdministrator = ''.obs;
final RxString startDate = ''.obs;
final RxList weekDay = [].obs;
final RxInt fromType = 0.obs;
final RxString effectiveDateTime = ''.obs; //
final RxString failureDateTime = ''.obs; //
final RxString selectType = '0'.obs; // 0 1 2
AddFaceState() { AddFaceState() {
Map map = Get.arguments; Map map = Get.arguments;
@ -56,4 +30,30 @@ class AddFaceState {
endDate.value = map['endDate']; endDate.value = map['endDate'];
} }
} }
RxBool ifCurrentScreen = true.obs; // ,
RxBool ifAddState = false.obs;//
RxBool ifConnectScuess = false.obs;
RxInt maxRegCount = 0.obs; //
RxInt regIndex = 0.obs; //
RxString faceNumber = ''.obs;
final RxInt lockId = 0.obs;
final RxString endDate = ''.obs;
final RxString addType = ''.obs;
final RxString faceName = ''.obs;
final RxInt faceType = 0.obs;
// final cyclicConfig = [].obs;
final RxString featureData = ''.obs;
final RxBool isClickAddFace = false.obs;
final RxString isCoerced = ''.obs;
final RxString isAdministrator = ''.obs;
final RxString startDate = ''.obs;
final RxList weekDay = [].obs;
final RxInt fromType = 0.obs;
final RxString effectiveDateTime = ''.obs; //
final RxString failureDateTime = ''.obs; //
final RxString selectType = '0'.obs;
} }

View File

@ -94,7 +94,7 @@ class AddFingerprintLogic extends BaseGetXController {
default: default:
// //
state.ifAddState.value = false; state.ifAddState.value = false;
showToast('添加指纹失败', something: (){ showToast('添加指纹失败'.tr, something: (){
Get.back(); Get.back();
}); });
break; break;

View File

@ -6,7 +6,6 @@ import 'package:star_lock/main/lockDetail/fingerprint/addFingerprint/addFingerpr
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import 'addFingerprint_logic.dart'; import 'addFingerprint_logic.dart';
@ -35,7 +34,7 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> with RouteAware
height: 50.h, height: 50.h,
), ),
Obx(() => Visibility( Obx(() => Visibility(
visible: logic.state.ifConnectScuess.value, visible: state.ifConnectScuess.value,
child: Container( child: Container(
padding: EdgeInsets.only(left: 20.w, right: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w),
child: Column( child: Column(
@ -68,7 +67,7 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> with RouteAware
), ),
)), )),
Obx(() => Visibility( Obx(() => Visibility(
visible: !logic.state.ifConnectScuess.value, visible: !state.ifConnectScuess.value,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -17,7 +18,6 @@ import '../../../../tools/dateTool.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'addFingerprintType_logic.dart'; import 'addFingerprintType_logic.dart';
class AddFingerprintTypePage extends StatefulWidget { class AddFingerprintTypePage extends StatefulWidget {

View File

@ -14,7 +14,6 @@ import '../../../../tools/dateTool.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/lockMain/lockMain_logic.dart'; import '../../../lockMian/lockMain/lockMain_logic.dart';
import 'fingerprintDetail_logic.dart'; import 'fingerprintDetail_logic.dart';

View File

@ -1,10 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart'; import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart'; import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -16,7 +17,6 @@ import '../../../../tools/showTipView.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'fingerprintListData_entity.dart'; import 'fingerprintListData_entity.dart';
import 'fingerprintList_logic.dart'; import 'fingerprintList_logic.dart';

View File

@ -207,11 +207,6 @@ class AutomaticBlockingLogic extends BaseGetXController {
.then((String value) => state.timeController.text = value); .then((String value) => state.timeController.text = value);
} }
@override
void onInit() {
super.onInit();
}
@override @override
void onClose() { void onClose() {
super.onClose(); super.onClose();

View File

@ -49,8 +49,8 @@ class BasicInformationLogic extends BaseGetXController {
void onReady() { void onReady() {
super.onReady(); super.onReady();
AppLog.log( // AppLog.log(
'厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}'); // '厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}');
} }
@override @override

View File

@ -52,11 +52,6 @@ class LockSelectGroupingLogic extends BaseGetXController {
mockNetworkDataRequest(); mockNetworkDataRequest();
} }
@override
void onInit() {
super.onInit();
}
@override @override
void onClose() { void onClose() {
super.onClose(); super.onClose();

View File

@ -165,11 +165,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// getServerDatetime(); // getServerDatetime();
} }
@override
void onInit() {
super.onInit();
}
@override @override
void onClose() { void onClose() {
super.onClose(); super.onClose();

View File

@ -5,6 +5,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart'; import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_reply.dart'; import '../../../../blue/io_reply.dart';
@ -21,7 +22,7 @@ class BurglarAlarmLogic extends BaseGetXController{
// -> // ->
Future<void> _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setBurglarAlarmData( final LoginEntity entity = await ApiRepository.to.setBurglarAlarmData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
antiPrySwitch:state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-2-; antiPrySwitch:state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-2-;
); );
@ -30,7 +31,7 @@ class BurglarAlarmLogic extends BaseGetXController{
state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 0 : 1; state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch = state.burglarAlarmEnable.value; state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch = state.burglarAlarmEnable.value;
showToast("操作成功".tr, something: (){ showToast('操作成功'.tr, something: (){
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
}); });
} }
@ -39,7 +40,7 @@ class BurglarAlarmLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SetSupportFunctionsNoParametersReply) { if(reply is SetSupportFunctionsNoParametersReply) {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
} }
@ -69,7 +70,7 @@ class BurglarAlarmLogic extends BaseGetXController{
// //
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async { Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
@ -102,14 +103,14 @@ class BurglarAlarmLogic extends BaseGetXController{
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand( IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -133,7 +134,6 @@ class BurglarAlarmLogic extends BaseGetXController{
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -141,7 +141,6 @@ class BurglarAlarmLogic extends BaseGetXController{
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// _readSupportFunctionsNoParameters(); // _readSupportFunctionsNoParameters();
@ -149,7 +148,6 @@ class BurglarAlarmLogic extends BaseGetXController{
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();

View File

@ -3,19 +3,18 @@ import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class BurglarAlarmState{ class BurglarAlarmState{// 0() 1()
var lockSetInfoData = LockSetInfoData().obs;
var burglarAlarmEnable = 0.obs;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
BurglarAlarmState() { BurglarAlarmState() {
var map = Get.arguments; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
burglarAlarmEnable.value = lockSetInfoData.value.lockSettingInfo!.antiPrySwitch!; burglarAlarmEnable.value = lockSetInfoData.value.lockSettingInfo!.antiPrySwitch!;
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxInt burglarAlarmEnable = 0.obs;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
} }

View File

@ -1,3 +1,4 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
@ -8,7 +9,7 @@ class CatEyeCustomModeLogic extends BaseGetXController {
// //
Future<LockSetInfoEntity> getLockSettingInfoData() async { Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -19,9 +20,9 @@ class CatEyeCustomModeLogic extends BaseGetXController {
if (state.catEyeConfigData.value.catEyeModeConfig != null) { if (state.catEyeConfigData.value.catEyeModeConfig != null) {
if (state.catEyeConfigData.value.catEyeModeConfig!.recordMode == 1) { if (state.catEyeConfigData.value.catEyeModeConfig!.recordMode == 1) {
state.selectVideoSlot.value = '自定义时段'; state.selectVideoSlot.value = '自定义时段'.tr;
} else { } else {
state.selectVideoSlot.value = '全天'; state.selectVideoSlot.value = '全天'.tr;
} }
state.recordTime.value = state.recordTime.value =
@ -31,8 +32,8 @@ class CatEyeCustomModeLogic extends BaseGetXController {
''; '';
state.realTimeMode.value = state.realTimeMode.value =
state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode == 0 state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode == 0
? '发生事件时查看' ? '发生事件时查看'.tr
: '实时查看'; : '实时查看'.tr;
} }
} }
} }
@ -67,7 +68,7 @@ class CatEyeCustomModeLogic extends BaseGetXController {
], ],
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功'); showToast('设置成功'.tr);
} }
} }
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -8,7 +9,6 @@ import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/cat
import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart';
import 'package:star_lock/tools/titleAppBar.dart'; import 'package:star_lock/tools/titleAppBar.dart';
import 'package:star_lock/translations/trans_lib.dart';
class CatEyeCustomModePage extends StatefulWidget { class CatEyeCustomModePage extends StatefulWidget {
const CatEyeCustomModePage({Key? key}) : super(key: key); const CatEyeCustomModePage({Key? key}) : super(key: key);
@ -65,14 +65,14 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
}, },
), ),
), ),
_buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像', _buildSubTitleItem('有人出现时录像'.tr, '有人在门口出现10秒后开始录像。'.tr + '\n' + '有人按门铃时立即录像'.tr,
state.recordTime.value, () { state.recordTime.value, () {
_openBottomItemSheet(state.showsUpVideoList.value, 0); _openBottomItemSheet(state.showsUpVideoList.value, 0);
}), }),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildSubTitleItem('人体侦测距离', '有人出现在门前1.5米范围时启动录像', _buildSubTitleItem('人体侦测距离'.tr, '有人出现在门前1.5米范围时启动录像'.tr,
state.detectionDistance.value, () { state.detectionDistance.value, () {
_openBottomItemSheet(state.detectionRangeList.value, 1); _openBottomItemSheet(state.detectionRangeList.value, 1);
}), }),
@ -82,7 +82,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
Container( Container(
margin: EdgeInsets.only(left: 20.w), margin: EdgeInsets.only(left: 20.w),
child: CommonItem( child: CommonItem(
leftTitel: '实时画面', leftTitel: '实时画面'.tr,
rightTitle: state.realTimeMode.value, rightTitle: state.realTimeMode.value,
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,

View File

@ -23,15 +23,15 @@ class CatEyeCustomModeState { //实时画面 0发生事件事查看 1实时查
// var showsUpVideo = '10${TranslationLoader.lanKeys!.second!.tr}'.obs; // // var showsUpVideo = '10${TranslationLoader.lanKeys!.second!.tr}'.obs; //
// var detectionRange = '约1.5米'.obs; // // var detectionRange = '约1.5米'.obs; //
RxList<String> showsUpVideoList = <String>[ RxList<String> showsUpVideoList = <String>[
'不录像', '不录像'.tr,
'立即录像', '立即录像'.tr,
'5${"".tr}', '5${"".tr}',
'10${"".tr}', '10${"".tr}',
'15${"".tr}', '15${"".tr}',
'30${"".tr}', '30${"".tr}',
'60${"".tr}' '60${"".tr}'
].obs; ].obs;
RxList<String> detectionRangeList = <String>['约0.8米', '约1.5米', '约3.0米'].obs; RxList<String> detectionRangeList = <String>['约0.8米'.tr, '约1.5米'.tr, '约3.0米'.tr].obs;
// //
final TextStyle titleStyle = TextStyle( final TextStyle titleStyle = TextStyle(
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500); color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);

View File

@ -3,6 +3,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
import 'catEyeSet_state.dart'; import 'catEyeSet_state.dart';
@ -10,8 +11,8 @@ class CatEyeSetLogic extends BaseGetXController {
final CatEyeSetState state = CatEyeSetState(); final CatEyeSetState state = CatEyeSetState();
// //
void updateAutoLightScreenConfig() async { Future<void> updateAutoLightScreenConfig() async {
var entity = await ApiRepository.to.updateAutoLightScreenConfig( final VersionUndateEntity entity = await ApiRepository.to.updateAutoLightScreenConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
autoLightScreen: state.isAutoBright.value == true ? 1 : 0, autoLightScreen: state.isAutoBright.value == true ? 1 : 0,
); );
@ -21,8 +22,8 @@ class CatEyeSetLogic extends BaseGetXController {
} }
// //
void updateLightScreenTimeConfig() async { Future<void> updateLightScreenTimeConfig() async {
var entity = await ApiRepository.to.updateLightScreenTimeConfig( final VersionUndateEntity entity = await ApiRepository.to.updateLightScreenTimeConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
autoLightScreenTime: autoLightScreenTime:
int.parse(state.selectBrightDuration.value.replaceAll(''.tr, '')), int.parse(state.selectBrightDuration.value.replaceAll(''.tr, '')),
@ -33,8 +34,8 @@ class CatEyeSetLogic extends BaseGetXController {
} }
// //
void updateStayWarnConfig() async { Future<void> updateStayWarnConfig() async {
var entity = await ApiRepository.to.updateStayWarnConfig( final VersionUndateEntity entity = await ApiRepository.to.updateStayWarnConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
stayWarn: state.isStayWarning.value == true ? 1 : 0, stayWarn: state.isStayWarning.value == true ? 1 : 0,
); );
@ -44,8 +45,8 @@ class CatEyeSetLogic extends BaseGetXController {
} }
// //
void updateAbnormalWarnConfig() async { Future<void> updateAbnormalWarnConfig() async {
var entity = await ApiRepository.to.updateAbnormalWarnConfig( final VersionUndateEntity entity = await ApiRepository.to.updateAbnormalWarnConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
abnormalWarn: state.isExceptionWarning.value == true ? 1 : 0, abnormalWarn: state.isExceptionWarning.value == true ? 1 : 0,
); );
@ -56,25 +57,34 @@ class CatEyeSetLogic extends BaseGetXController {
// //
Future<LockSetInfoEntity> getLockSettingInfoData() async { Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!; state.lockSetInfoData.value = entity.data!;
state.selectBrightDuration.value = state.selectBrightDuration.value = '${state.lockSetInfoData.value.lockSettingInfo!.autoLightScreenTime}${''.tr}'; //
'${state.lockSetInfoData.value.lockSettingInfo!.autoLightScreenTime}'; //
state.isAutoBright.value = if (state.lockSetInfoData.value.lockSettingInfo!.autoLightScreen == 0) {
state.lockSetInfoData.value.lockSettingInfo!.autoLightScreen == 0 state.isAutoBright.value = false;
? false } else {
: true; // state.isAutoBright.value = true;
state.isStayWarning.value = }
state.lockSetInfoData.value.lockSettingInfo!.stayWarn == 0
? false //
: true; // if (state.lockSetInfoData.value.lockSettingInfo!.stayWarn == 0) {
state.isExceptionWarning.value = state.isStayWarning.value = false;
state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn == 0 } else {
? false state.isStayWarning.value = true;
: true; // }
//
if (state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn == 0) {
state.isExceptionWarning.value = false;
} else {
state.isExceptionWarning.value = true;
}
//
state.selectCatEyeWorkMode.value = ''; // state.selectCatEyeWorkMode.value = ''; //
// selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!; // selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!;

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_logic.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_logic.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_state.dart';
import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart';
@ -18,8 +19,8 @@ class CatEyeSetPage extends StatefulWidget {
} }
class _CatEyeSetPageState extends State<CatEyeSetPage> { class _CatEyeSetPageState extends State<CatEyeSetPage> {
final logic = Get.put(CatEyeSetLogic()); final CatEyeSetLogic logic = Get.put(CatEyeSetLogic());
final state = Get.find<CatEyeSetLogic>().state; final CatEyeSetState state = Get.find<CatEyeSetLogic>().state;
@override @override
void initState() { void initState() {
@ -37,7 +38,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '猫眼工作模式'.tr, leftTitel: '猫眼工作模式'.tr,
rightTitle: state.selectCatEyeWorkMode.value, rightTitle: state.selectCatEyeWorkMode.value,
@ -46,20 +47,20 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Routers.catEyeWorkModePage, Navigator.pushNamed(context, Routers.catEyeWorkModePage,
arguments: { arguments: <String, Object?>{
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value 'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty .lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo! ? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0] .catEyeConfig![0]
: null : null
}).then((value) { }).then((Object? value) {
logic.getLockSettingInfoData(); logic.getLockSettingInfoData();
}); });
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '自动亮屏'.tr, leftTitel: '自动亮屏'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: false, isHaveDirection: false,
isHaveRightWidget: true, isHaveRightWidget: true,
@ -74,14 +75,14 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '逗留警告'.tr, leftTitel: '逗留警告'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _otherToDoSwitch(2), rightWidget: _otherToDoSwitch(2),
)), )),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '异常警告'.tr, leftTitel: '异常警告'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _otherToDoSwitch(3))), rightWidget: _otherToDoSwitch(3))),
@ -108,7 +109,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: isCheck, value: isCheck,
onChanged: (value) { onChanged: (bool value) {
switch (clickIndex) { switch (clickIndex) {
case 1: // case 1: //
{ {
@ -144,7 +145,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
return AlertBottomWidget( return AlertBottomWidget(
topTitle: '', topTitle: '',
items: state.brightDurationTimeList, items: state.brightDurationTimeList,
chooseCallback: (value) { chooseCallback: (int value) {
state.selectBrightDuration.value = state.selectBrightDuration.value =
state.brightDurationTimeList[value]; state.brightDurationTimeList[value];
logic.updateLightScreenTimeConfig(); logic.updateLightScreenTimeConfig();

View File

@ -1,24 +1,17 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeSetState { class CatEyeSetState {
var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs;
var selectBrightDuration = '10 秒'.obs; //
var isAutoBright = false.obs; //
var isStayWarning = false.obs; //
var isExceptionWarning = false.obs; //
var lockSetInfoData = LockSetInfoData().obs;
var selectCatEyeWorkMode = ''.obs; //
final String settingSuccess = '设置成功'.tr;
CatEyeSetState() { CatEyeSetState() {
Map map = Get.arguments; Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
if (lockSetInfoData.value != null && if (lockSetInfoData.value != null &&
lockSetInfoData.value.lockSettingInfo != null) { lockSetInfoData.value.lockSettingInfo != null) {
selectBrightDuration.value = selectBrightDuration.value =
'${lockSetInfoData.value.lockSettingInfo?.autoLightScreenTime} '; '${lockSetInfoData.value.lockSettingInfo?.autoLightScreenTime} ${''.tr}';
if (lockSetInfoData.value.lockSettingInfo?.autoLightScreen == 1) { if (lockSetInfoData.value.lockSettingInfo?.autoLightScreen == 1) {
isAutoBright.value = true; isAutoBright.value = true;
} else { } else {
@ -38,4 +31,12 @@ class CatEyeSetState {
} }
} }
} }
RxList<String> brightDurationTimeList = <String>['10${''.tr}', '15${''.tr}', '20${''.tr}'].obs;
RxString selectBrightDuration = '10 ${''.tr}'.obs; //
RxBool isAutoBright = false.obs; //
RxBool isStayWarning = false.obs; //
RxBool isExceptionWarning = false.obs; //
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxString selectCatEyeWorkMode = ''.obs; //
final String settingSuccess = '设置成功'.tr;
} }

View File

@ -1,21 +1,23 @@
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
class CatEyeWorkModeLogic extends BaseGetXController { class CatEyeWorkModeLogic extends BaseGetXController {
final CatEyeWorkModeState state = CatEyeWorkModeState(); final CatEyeWorkModeState state = CatEyeWorkModeState();
// //
void updateCatEyeModeConfig() async { Future<void> updateCatEyeModeConfig() async {
var entity = await ApiRepository.to.updateCatEyeModeConfig( final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [ catEyeConfig: [
{ <String, Object>{
'catEyeMode': 'catEyeMode':
state.boolList.indexWhere((element) => element == true) + 1, state.boolList.indexWhere((bool element) => element == true) + 1,
'catEyeModeConfig': { 'catEyeModeConfig': <String, Object?>{
'recordMode': state.lockSetInfoData.value.lockSettingInfo! 'recordMode': state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig!.isNotEmpty .catEyeConfig!.isNotEmpty
? state.catEyeConfigData.value.catEyeModeConfig?.recordMode ? state.catEyeConfigData.value.catEyeModeConfig?.recordMode
@ -46,14 +48,14 @@ class CatEyeWorkModeLogic extends BaseGetXController {
], ],
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功'); showToast('设置成功'.tr);
getLockSettingInfoData(); getLockSettingInfoData();
} }
} }
// //
void getLockSettingInfoData() async { Future<void> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -65,16 +67,16 @@ class CatEyeWorkModeLogic extends BaseGetXController {
if (state.catEyeConfigData.value.catEyeMode == if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModePowerSaving) { XSConstantMacro.catEyeWorkModePowerSaving) {
state.boolList.value = [true, false, false, false]; state.boolList.value = <bool>[true, false, false, false];
} else if (state.catEyeConfigData.value.catEyeMode == } else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeStayCapture) { XSConstantMacro.catEyeWorkModeStayCapture) {
state.boolList.value = [false, true, false, false]; state.boolList.value = <bool>[false, true, false, false];
} else if (state.catEyeConfigData.value.catEyeMode == } else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeRealTimeMonitoring) { XSConstantMacro.catEyeWorkModeRealTimeMonitoring) {
state.boolList.value = [false, false, true, false]; state.boolList.value = <bool>[false, false, true, false];
} else if (state.catEyeConfigData.value.catEyeMode == } else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeCustom) { XSConstantMacro.catEyeWorkModeCustom) {
state.boolList.value = [false, false, false, true]; state.boolList.value = <bool>[false, false, false, true];
} }
} }
} }

View File

@ -1,8 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
@ -15,8 +18,8 @@ class CatEyeWorkModePage extends StatefulWidget {
} }
class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> { class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
final logic = Get.put(CatEyeWorkModeLogic()); final CatEyeWorkModeLogic logic = Get.put(CatEyeWorkModeLogic());
final state = Get.find<CatEyeWorkModeLogic>().state; final CatEyeWorkModeState state = Get.find<CatEyeWorkModeLogic>().state;
@override @override
initState() { initState() {
@ -29,36 +32,38 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '猫眼工作模式', barTitle: '猫眼工作模式'.tr,
haveBack: true, haveBack: true,
backAction: () { backAction: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Obx(() => Column( body: Obx(() => Column(
children: [ children: <Widget>[
SizedBox(
height: 30.h,
),
_buildTipsView('省电模式:\n',
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', 0),
SizedBox(
height: 30.h,
),
_buildTipsView('逗留抓拍模式:\n',
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。', 1),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView( _buildTipsView(
'实时监控模式:\n', '省电模式'.tr + '\n',
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。', '适合门口较为安全的环境。'.tr + '\n' + '仅发生特定事件才录像,并可查看实时画面。'.tr + '\n' + '一般情况下满电可使用7-8个月'.tr,
0),
SizedBox(
height: 30.h,
),
_buildTipsView('逗留抓拍模式'.tr + '\n',
'有人逗留或发生特定事件才录像,可随时查看'.tr + '\n' + '实时画面。'.tr + '\n' + '一般情况下满电可使用5~6个月。'.tr, 1),
SizedBox(
height: 30.h,
),
_buildTipsView(
'实时监控模式'.tr + '\n',
'适合门口人员复杂、较不安全的环境。'.tr + '\n' + '有人出现就录像,可随时查看实时画面。'.tr + '\n' + '一般情况下满电可使用2~4个月。'.tr,
2), 2),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView( _buildTipsView(
'自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3) '自定义模式'.tr + '\n', '根据您家门口实际情况设置录像和实时画面功能。'.tr + '\n' + '可使用时长由具体设置决定。'.tr, 3)
], ],
))); )));
} }
@ -78,14 +83,12 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: <Widget>[
state.boolList.value[clickIndex] if (state.boolList.value[clickIndex]) Image.asset(
? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
) ) else SizedBox(
: SizedBox(
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
), ),
@ -109,7 +112,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
), ),
child: Center( child: Center(
child: Text( child: Text(
clickIndex == 3 ? '设置' : '查看', clickIndex == 3 ? '设置'.tr : '查看'.tr,
style: TextStyle( style: TextStyle(
color: AppColors.placeholderTextColor, color: AppColors.placeholderTextColor,
fontSize: 20.sp), fontSize: 20.sp),
@ -121,9 +124,9 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
if (clickIndex == 3) { if (clickIndex == 3) {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.catEyeCustomModePage, context, Routers.catEyeCustomModePage,
arguments: { arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
}).then((value) => logic.getLockSettingInfoData()); }).then((Object? value) => logic.getLockSettingInfoData());
} else { } else {
// //
showBottomSheet(context, clickIndex); showBottomSheet(context, clickIndex);
@ -158,7 +161,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
: AppColors.placeholderTextColor, : AppColors.placeholderTextColor,
fontSize: 20.sp); fontSize: 20.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [ late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle), TextSpan(text: titleStr, style: titleStyle),
TextSpan(text: subTitle, style: subTipsStyle), TextSpan(text: subTitle, style: subTipsStyle),
]); ]);
@ -171,14 +174,14 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
builder: (BuildContext context) { builder: (BuildContext context) {
// //
if (clickIndex == 0) { if (clickIndex == 0) {
return _buildBottomSheetWidget(context, '省电模式', '有人按门铃或发生\n异常事件时', return _buildBottomSheetWidget(context, '省电模式'.tr, '有人按门铃或发生'.tr + '\n' + '异常事件时'.tr,
'不录像', '/', '有人按门铃或发生\n异常事件时'); '不录像'.tr, '/', '有人按门铃或发生'.tr + '\n' + '异常事件时'.tr);
} else if (clickIndex == 1) { } else if (clickIndex == 1) {
return _buildBottomSheetWidget(context, '逗留抓拍模式', return _buildBottomSheetWidget(context, '逗留抓拍模式'.tr,
'有人出现、按门铃\n或发生异常事件时', '逗留达到10秒', '约1.5米', '随时'); '有人出现、按门铃'.tr + '\n' + '或发生异常事件时'.tr, '逗留达到10秒'.tr, '约1.5米'.tr, '随时'.tr);
} else if (clickIndex == 2) { } else if (clickIndex == 2) {
return _buildBottomSheetWidget( return _buildBottomSheetWidget(
context, '实时监控模式', '有人出现、按门铃\n或发生异常事件时', '立即录像', '约1.5米', '随时'); context, '实时监控模式'.tr, '有人出现、按门铃'.tr + '\n' + '或发生异常事件时'.tr, '立即录像'.tr, '约1.5米'.tr, '随时'.tr);
} else { } else {
return Container(); return Container();
} }
@ -191,9 +194,9 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
return Container( return Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h), margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h),
child: Column( child: Column(
children: [ children: <Widget>[
Row( Row(
children: [ children: <Widget>[
// //
Expanded( Expanded(
child: Center( child: Center(
@ -211,10 +214,10 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
SizedBox( SizedBox(
height: 40.h, height: 40.h,
), ),
_buildRowWidget('录像时机', tips1), _buildRowWidget('录像时机'.tr, tips1),
_buildRowWidget('有人出现时录像', tips2), _buildRowWidget('有人出现时录像'.tr, tips2),
_buildRowWidget('人体侦测距离', tips3), _buildRowWidget('人体侦测距离'.tr, tips3),
_buildRowWidget('查看实时画面', tips4), _buildRowWidget('查看实时画面'.tr, tips4),
_buildIKnowBtn(), _buildIKnowBtn(),
], ],
), ),
@ -227,7 +230,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
child: Row( child: Row(
//Row两端对齐的方法 //Row两端对齐的方法
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: <Widget>[
Text( Text(
titleStr, titleStr,
style: TextStyle( style: TextStyle(
@ -268,7 +271,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
), ),
child: Center( child: Center(
child: Text( child: Text(
'我知道了', '我知道了'.tr,
style: TextStyle( style: TextStyle(
color: AppColors.darkGrayTextColor, color: AppColors.darkGrayTextColor,
fontSize: 24.sp, fontSize: 24.sp,

View File

@ -2,14 +2,10 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeWorkModeState { class CatEyeWorkModeState {
var lockSetInfoData = LockSetInfoData().obs;
// var selectCatEyeWorkMode = 0.obs; //
var boolList = [false, false, false, false].obs;
var catEyeConfigData = CatEyeConfig().obs;
CatEyeWorkModeState() { CatEyeWorkModeState() {
Map map = Get.arguments; Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
// if (map['catEyeConfigData'] != null) { // if (map['catEyeConfigData'] != null) {
// catEyeConfigData.value = map['catEyeConfigData']; // catEyeConfigData.value = map['catEyeConfigData'];
// selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!; // selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!;
@ -31,4 +27,8 @@ class CatEyeWorkModeState {
// catEyeConfigData.value = CatEyeConfig(); // catEyeConfigData.value = CatEyeConfig();
// } // }
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
// var selectCatEyeWorkMode = 0.obs; //
RxList<bool> boolList = <bool>[false, false, false, false].obs;
Rx<CatEyeConfig> catEyeConfigData = CatEyeConfig().obs;
} }

View File

@ -1,16 +1,18 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
class VideoSlotLogic extends BaseGetXController { class VideoSlotLogic extends BaseGetXController {
final VideoSlotState state = VideoSlotState(); final VideoSlotState state = VideoSlotState();
// //
Future<LockSetInfoEntity> getLockSettingInfoData() async { Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -39,7 +41,7 @@ class VideoSlotLogic extends BaseGetXController {
} }
// //
void updateCatEyeModeConfig() async { Future<void> updateCatEyeModeConfig() async {
state.isCustom.value == false state.isCustom.value == false
? state.recordMode.value = 0 ? state.recordMode.value = 0
: state.recordMode.value = 1; : state.recordMode.value = 1;
@ -48,13 +50,13 @@ class VideoSlotLogic extends BaseGetXController {
state.recordStartTime.value = state.recordStartTime.value =
DateTool().dateToTimestamp(state.startDate.value, 0); DateTool().dateToTimestamp(state.startDate.value, 0);
// //
DateTime tomorrow = final DateTime tomorrow =
DateTime(DateTool().dateToTimestamp(state.startDate.value, 0)) DateTime(DateTool().dateToTimestamp(state.startDate.value, 0))
.add(const Duration(days: 1)); .add(const Duration(days: 1));
// //
state.recordEndTime.value = tomorrow.millisecondsSinceEpoch; state.recordEndTime.value = tomorrow.millisecondsSinceEpoch;
} }
var entity = await ApiRepository.to.updateCatEyeModeConfig( final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [ catEyeConfig: [
{ {
@ -74,7 +76,7 @@ class VideoSlotLogic extends BaseGetXController {
], ],
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功'); showToast('设置成功'.tr);
Get.back(); Get.back();
} }
} }

View File

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart'; import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart'; import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
@ -19,8 +19,8 @@ class VideoSlotPage extends StatefulWidget {
} }
class _VideoSlotPageState extends State<VideoSlotPage> { class _VideoSlotPageState extends State<VideoSlotPage> {
final logic = Get.put(VideoSlotLogic()); final VideoSlotLogic logic = Get.put(VideoSlotLogic());
final state = Get.find<VideoSlotLogic>().state; final VideoSlotState state = Get.find<VideoSlotLogic>().state;
@override @override
initState() { initState() {
@ -33,34 +33,32 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '录像时段', barTitle: '录像时段'.tr,
haveBack: true, haveBack: true,
backAction: () { backAction: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
'保存'.tr, '保存'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: logic.updateCatEyeModeConfig,
logic.updateCatEyeModeConfig();
},
), ),
], ],
), ),
body: Obx(() => Column( body: Obx(() => Column(
children: [ children: <Widget>[
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView('全天', 0), _buildTipsView('全天'.tr, 0),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildCustomTimeView('自定义时间', 1), _buildCustomTimeView('自定义时间'.tr, 1),
], ],
))); )));
} }
@ -81,14 +79,12 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: <Widget>[
state.isCustom.value == false if (state.isCustom.value == false) Image.asset(
? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
) ) else SizedBox(
: SizedBox(
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
), ),
@ -128,22 +124,20 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Column( child: Column(
children: [ children: <Widget>[
Row( Row(
children: [ children: <Widget>[
state.isCustom.value == true if (state.isCustom.value == true) Image.asset(
? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
) ) else SizedBox(
: SizedBox(
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
), ),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Expanded( Expanded(
child: _buildRichText('自定义时间', state.isCustom.value), child: _buildRichText('自定义时间'.tr, state.isCustom.value),
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
@ -151,9 +145,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
], ],
), ),
// //
state.isCustom.value == false if (state.isCustom.value == false) Container() else Container(
? Container()
: Container(
height: 1, height: 1,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 20.w, left: 20.w,
@ -164,17 +156,11 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
? AppColors.blueTextTipsColor ? AppColors.blueTextTipsColor
: Colors.black, : Colors.black,
), ),
state.isCustom.value == false if (state.isCustom.value == false) Container() else startAndEndTimeRow(false),
? Container() if (state.isCustom.value == false) Container() else SizedBox(
: startAndEndTimeRow(false),
state.isCustom.value == false
? Container()
: SizedBox(
height: 30.h, height: 30.h,
), ),
state.isCustom.value == false if (state.isCustom.value == false) Container() else startAndEndTimeRow(true),
? Container()
: startAndEndTimeRow(true),
], ],
)), )),
)), )),
@ -192,12 +178,12 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
Widget startAndEndTimeRow(bool isEndTime) { Widget startAndEndTimeRow(bool isEndTime) {
return GestureDetector( return GestureDetector(
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 20.w, width: 20.w,
), ),
Text( Text(
isEndTime == false ? '开始时间' : '结束时间', isEndTime == false ? '开始时间'.tr : '结束时间'.tr,
style: TextStyle( style: TextStyle(
color: state.isCustom.value == true color: state.isCustom.value == true
? AppColors.blueTextTipsColor ? AppColors.blueTextTipsColor
@ -210,8 +196,8 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
)), )),
Obx(() => Text( Obx(() => Text(
isEndTime == false isEndTime == false
? '当日${state.startDate.value}' ? '${'当日'.tr}${state.startDate.value}'
: '次日${state.endDate.value}', : '${'次日'.tr}${state.endDate.value}',
style: TextStyle( style: TextStyle(
color: state.isCustom.value == true color: state.isCustom.value == true
? AppColors.blueTextTipsColor ? AppColors.blueTextTipsColor
@ -232,7 +218,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
PDuration selectDate = PDuration.parse(DateTime.tryParse( PDuration selectDate = PDuration.parse(DateTime.tryParse(
isEndTime == false ? state.startDate.value : state.endDate.value)); isEndTime == false ? state.startDate.value : state.endDate.value));
Pickers.showDatePicker(context, Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) { selectDate: selectDate, mode: DateMode.HM, onConfirm: (PDuration p) {
if (isEndTime == false) { if (isEndTime == false) {
state.startDate.value = DateTool().getYMDHNDateString(p, 3); state.startDate.value = DateTool().getYMDHNDateString(p, 3);
} else { } else {
@ -250,7 +236,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
fontSize: 24.sp, fontSize: 24.sp,
fontWeight: FontWeight.w500); fontWeight: FontWeight.w500);
late InlineSpan tipsPreviewSpan = TextSpan(children: [ late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle), TextSpan(text: titleStr, style: titleStyle),
]); ]);
return RichText(text: tipsPreviewSpan); return RichText(text: tipsPreviewSpan);

View File

@ -2,22 +2,7 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
class VideoSlotState { class VideoSlotState { // 0 1
var lockSetInfoData = LockSetInfoData().obs;
var catEyeConfigData = CatEyeConfig().obs;
var isCustom = false.obs; //
DateTime dateTime = DateTime.now();
var startDate = DateTool().getNowDateWithType(6).obs; //
var endDate = DateTool().getNowDateWithType(6).obs; //
var recordMode = 0.obs; // 0 1
var recordStartTime = 0.obs; //
var recordEndTime = 0.obs; //
var recordTime = ''.obs; //
var detectionDistance = 0.obs; //
var realTimeMode = 0.obs; // 0 1
VideoSlotState() { VideoSlotState() {
Map map = Get.arguments; Map map = Get.arguments;
@ -28,4 +13,19 @@ class VideoSlotState {
catEyeConfigData.value = map['catEyeConfigData']; catEyeConfigData.value = map['catEyeConfigData'];
} }
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<CatEyeConfig> catEyeConfigData = CatEyeConfig().obs;
RxBool isCustom = false.obs; //
DateTime dateTime = DateTime.now();
RxString startDate = DateTool().getNowDateWithType(6).obs; //
RxString endDate = DateTool().getNowDateWithType(6).obs; //
RxInt recordMode = 0.obs; // 0 1
RxInt recordStartTime = 0.obs; //
RxInt recordEndTime = 0.obs; //
RxString recordTime = ''.obs; //
RxInt detectionDistance = 0.obs; //
RxInt realTimeMode = 0.obs;
} }

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
@ -10,35 +11,35 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
CheckInCreatCompanyState state = CheckInCreatCompanyState(); CheckInCreatCompanyState state = CheckInCreatCompanyState();
// //
void setCheckInCreateCompany() async{ Future<void> setCheckInCreateCompany() async{
if(state.companyNameController.text.length > 50){ if(state.companyNameController.text.length > 50){
showToast("公司名称不能超过30个字符".tr); showToast('公司名称不能超过30个字符'.tr);
return; return;
} }
if(state.companyNameController.text.length < 6){ if(state.companyNameController.text.length < 6){
showToast("公司名称不能小于6个字符".tr); showToast('公司名称不能小于6个字符'.tr);
return; return;
} }
var entity = await ApiRepository.to.setCheckInCreateCompanyData( final LoginEntity entity = await ApiRepository.to.setCheckInCreateCompanyData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
attendanceType: state.isCustom.value ? "0" :"1", attendanceType: state.isCustom.value ? '0' :'1',
companyName: state.companyNameController.text, companyName: state.companyNameController.text,
workDay: state.weekDays.value, workDay: state.weekDays.value,
workEndTime: state.endTimeTimestamp.value, workEndTime: state.endTimeTimestamp.value,
workStartTime: state.beginTimeTimestamp.value, workStartTime: state.beginTimeTimestamp.value,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("创建成功".tr, something: (){ showToast('创建成功'.tr, something: (){
setLockSetGeneralSetting(); setLockSetGeneralSetting();
}); });
} }
} }
// //
void setLockSetGeneralSetting() async{ Future<void> setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setCheckInData( final LoginEntity entity = await ApiRepository.to.setCheckInData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
attendance:1, attendance:1,
); );
@ -47,9 +48,9 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
state.lockSetInfoData.value.lockSettingInfo!.attendance = 1; state.lockSetInfoData.value.lockSettingInfo!.attendance = 1;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "1")); eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, '1'));
Get.back(); Get.back();
showToast("设置成功".tr); showToast('设置成功'.tr);
} }
} }

View File

@ -10,7 +10,6 @@ import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../checkingIn/checkingInSet/checkingInSet_entity.dart'; import '../../checkingIn/checkingInSet/checkingInSet_entity.dart';
import 'checkInCreatCompany_logic.dart'; import 'checkInCreatCompany_logic.dart';
@ -30,7 +29,7 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '创建公司', barTitle: '创建公司'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(

View File

@ -37,7 +37,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
network:state.wifiNameController.text, network:state.wifiNameController.text,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast('配网成功', something:(){ showToast('配网成功'.tr, something:(){
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Get.close(2); Get.close(2);
}); });
@ -113,7 +113,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
break; break;
case 0xff: case 0xff:
// //
showToast('配网失败'); showToast('配网失败'.tr);
break; break;
default: default:
// //
@ -124,7 +124,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
// wifi // wifi
Future<void> senderConfiguringWifiAction() async { Future<void> senderConfiguringWifiAction() async {
if(state.wifiNameController.text.isEmpty){ if(state.wifiNameController.text.isEmpty){
showToast('请输入wifi名称'); showToast('请输入wifi名称'.tr);
return; return;
} }

View File

@ -2,6 +2,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
@ -18,49 +20,47 @@ class WifiListPage extends StatefulWidget {
} }
class _WifiListPageState extends State<WifiListPage> { class _WifiListPageState extends State<WifiListPage> {
final logic = Get.put(WifiListLogic()); final WifiListLogic logic = Get.put(WifiListLogic());
final state = Get.find<WifiListLogic>().state; final WifiListState state = Get.find<WifiListLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "WIFI列表".tr, barTitle: 'WIFI列表'.tr,
haveBack: true, haveBack: true,
actionsList: [ actionsList: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
"刷新".tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), '刷新'.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: logic.senderGetWifiListWifiAction,
logic.senderGetWifiListWifiAction();
},
), ),
], ],
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
Expanded( Expanded(
child: Obx(() => state.wifiNameDataList.value.isNotEmpty ? ListView.builder( child: Obx(() => state.wifiNameDataList.value.isNotEmpty ? ListView.builder(
itemCount: state.wifiNameDataList.value.length, itemCount: state.wifiNameDataList.value.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
Map wifiNameStr = state.wifiNameDataList.value[index]; Map wifiNameStr = state.wifiNameDataList.value[index];
return _messageListItem(wifiNameStr["wifiName"], wifiNameStr["rssi"], () { return _messageListItem(wifiNameStr['wifiName'], wifiNameStr['rssi'], () {
Get.toNamed(Routers.configuringWifiPage, arguments: { Get.toNamed(Routers.configuringWifiPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
'wifiName': wifiNameStr["wifiName"], 'wifiName': wifiNameStr['wifiName'],
}); });
}); });
}) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 64.h)), }) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 64.h)),
), ),
SubmitBtn( SubmitBtn(
btnName: "手动配网".tr, btnName: '手动配网'.tr,
fontSize: 28.sp, fontSize: 28.sp,
borderRadius: 20.w, borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () { onClick: () {
Get.toNamed(Routers.configuringWifiPage, arguments: { Get.toNamed(Routers.configuringWifiPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}), }),
@ -88,16 +88,16 @@ class _WifiListPageState extends State<WifiListPage> {
height: 80.h, height: 80.h,
margin: EdgeInsets.only(left: 20.w, right: 40.w), margin: EdgeInsets.only(left: 20.w, right: 40.w),
child: Column( child: Column(
children: [ children: <Widget>[
SizedBox( SizedBox(
height: 79.h, height: 79.h,
width: 1.sw - 20.w*2, width: 1.sw - 20.w*2,
child: Row( child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: <Widget>[
Flexible( Flexible(
child: Text( child: Text(
"$wifiName(${rssi}db)", '$wifiName(${rssi}db)',
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(

View File

@ -1,4 +1,5 @@
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
@ -9,36 +10,33 @@ class DiagnoseLogic extends BaseGetXController{
// //
Future<void> setLockDiagnose() async{ Future<void> setLockDiagnose() async{
var entity = await ApiRepository.to.setLockDiagnoseData( final LoginEntity entity = await ApiRepository.to.setLockDiagnoseData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
electricQuantity:"23", electricQuantity:'23',
firmwareRevision:"1.0", // 1-2-; firmwareRevision:'1.0', // 1-2-;
hardwareRevision:"1.3", // 4 hardwareRevision:'1.3', // 4
lockDate:"1689410557000", lockDate:'1689410557000',
modelNum:"123456", modelNum:'123456',
pwdInfo:"123456", pwdInfo:'123456',
timestamp:"1689410559456000", timestamp:'1689410559456000',
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("操作成功"); showToast('操作成功');
} }
} }
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
} }
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
} }
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
} }
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -7,7 +8,6 @@ import '../../../../../app_settings/app_colors.dart';
import '../../../../../baseWidget.dart'; import '../../../../../baseWidget.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class DoorMagneticPage extends StatefulWidget { class DoorMagneticPage extends StatefulWidget {
const DoorMagneticPage({Key? key}) : super(key: key); const DoorMagneticPage({Key? key}) : super(key: key);

View File

@ -5,7 +5,6 @@ import 'package:star_lock/tools/noData.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class NearbyDoorMagneticPage extends StatefulWidget { class NearbyDoorMagneticPage extends StatefulWidget {
const NearbyDoorMagneticPage({Key? key}) : super(key: key); const NearbyDoorMagneticPage({Key? key}) : super(key: key);
@ -29,7 +28,7 @@ class _NearbyDoorMagneticPageState extends State<NearbyDoorMagneticPage> {
: ListView.builder( : ListView.builder(
itemCount: dataList.length, itemCount: dataList.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return nearbyLockItem('images/icon_lock.png', 'MCBN01-ea9240', return nearbyLockItem('images/icon_lock.png', '',
() { () {
// Navigator.pushNamed(context, Routers.saveLockPage); // Navigator.pushNamed(context, Routers.saveLockPage);
}); });

View File

@ -1,3 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';

View File

@ -105,7 +105,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
return ListView.separated( return ListView.separated(
itemCount: 2, itemCount: 2,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return _electronicKeyItem('images/icon_round_unSelect.png', '张三', return _electronicKeyItem('images/icon_round_unSelect.png', '',
'2023.6.21 11.15', '2023.6.21 11.15', index,() { '2023.6.21 11.15', '2023.6.21 11.15', index,() {
// Navigator.pushNamed(context, Routers.electronicKeyDetailPage); // Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
}); });
@ -144,7 +144,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
width: 10.w, width: 10.w,
), ),
Text( Text(
'${index+1}', '${''.tr}${index+1}',
style: TextStyle( style: TextStyle(
color: AppColors.blackColor, color: AppColors.blackColor,
fontSize: 22.sp, fontSize: 22.sp,

View File

@ -3,13 +3,14 @@ import 'package:star_lock/main/lockDetail/lockSet/liveVideo/liveVideo_state.dart
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
class LiveVideoLogic extends BaseGetXController { class LiveVideoLogic extends BaseGetXController {
final LiveVideoState state = LiveVideoState(); final LiveVideoState state = LiveVideoState();
// //
Future<LockSetInfoEntity> getLockSettingInfoData() async { Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -34,13 +35,13 @@ class LiveVideoLogic extends BaseGetXController {
} }
// //
void updateCatEyeModeConfig() async { Future<void> updateCatEyeModeConfig() async {
var entity = await ApiRepository.to.updateCatEyeModeConfig( final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId ?? 0, lockId: state.lockSetInfoData.value.lockId ?? 0,
catEyeConfig: [ catEyeConfig: [
{ <String, Object>{
'catEyeMode': 4, 'catEyeMode': 4,
'catEyeModeConfig': { 'catEyeModeConfig': <String, Object?>{
'recordMode': 'recordMode':
state.catEyeConfigData.value.catEyeModeConfig!.recordMode, state.catEyeConfigData.value.catEyeModeConfig!.recordMode,
'recordStartTime': 'recordStartTime':

View File

@ -1,8 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/liveVideo/liveVideo_logic.dart'; import 'package:star_lock/main/lockDetail/lockSet/liveVideo/liveVideo_logic.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/main/lockDetail/lockSet/liveVideo/liveVideo_state.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
@ -15,8 +16,8 @@ class LiveVideoPage extends StatefulWidget {
} }
class _LiveVideoPageState extends State<LiveVideoPage> { class _LiveVideoPageState extends State<LiveVideoPage> {
final logic = Get.put(LiveVideoLogic()); final LiveVideoLogic logic = Get.put(LiveVideoLogic());
final state = Get.find<LiveVideoLogic>().state; final LiveVideoState state = Get.find<LiveVideoLogic>().state;
@override @override
initState() { initState() {
@ -35,7 +36,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
'保存'.tr, '保存'.tr,
@ -52,7 +53,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
], ],
), ),
body: Obx(() => Column( body: Obx(() => Column(
children: [ children: <Widget>[
SizedBox( SizedBox(
height: 80.h, height: 80.h,
), ),
@ -94,7 +95,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: <Widget>[
clickIndex == 0 clickIndex == 0
? (state.isLiveView.value == false ? (state.isLiveView.value == false
? Image.asset( ? Image.asset(
@ -151,7 +152,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
: AppColors.placeholderTextColor, : AppColors.placeholderTextColor,
fontSize: 20.sp); fontSize: 20.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [ late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle), TextSpan(text: titleStr, style: titleStyle),
TextSpan(text: subTitle, style: subTipsStyle), TextSpan(text: subTitle, style: subTipsStyle),
]); ]);

View File

@ -2,11 +2,6 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class LiveVideoState { class LiveVideoState {
var isLiveView = false.obs; //
var realTimeMode = 0.obs; // 0 1
var lockSetInfoData = LockSetInfoData().obs;
var catEyeConfigData = CatEyeConfig().obs;
LiveVideoState() { LiveVideoState() {
Map map = Get.arguments; Map map = Get.arguments;
if (map['lockSetInfoData'] != null) { if (map['lockSetInfoData'] != null) {
@ -16,4 +11,8 @@ class LiveVideoState {
catEyeConfigData.value = map['catEyeConfigData']; catEyeConfigData.value = map['catEyeConfigData'];
} }
} }
RxBool isLiveView = false.obs; //
RxInt realTimeMode = 0.obs; // 0 1
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<CatEyeConfig> catEyeConfigData = CatEyeConfig().obs;
} }

View File

@ -1,3 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';

View File

@ -1,12 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'lockEscalation_logic.dart'; import 'lockEscalation_logic.dart';
class LockEscalationPage extends StatefulWidget { class LockEscalationPage extends StatefulWidget {
@ -214,7 +213,7 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text( Text(
'固件传输中', '固件传输中'.tr,
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 18.sp, fontSize: 18.sp,

View File

@ -1,8 +1,4 @@
class LockSetInfoEntity { class LockSetInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
LockSetInfoData? data;
LockSetInfoEntity( LockSetInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -13,6 +9,10 @@ class LockSetInfoEntity {
errorMsg = json['errorMsg']; errorMsg = json['errorMsg'];
data = json['data'] != null ? LockSetInfoData.fromJson(json['data']) : null; data = json['data'] != null ? LockSetInfoData.fromJson(json['data']) : null;
} }
int? errorCode;
String? description;
String? errorMsg;
LockSetInfoData? data;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -27,11 +27,6 @@ class LockSetInfoEntity {
} }
class LockSetInfoData { class LockSetInfoData {
int? lockId;
LockStatus? lockStatus;
LockFeature? lockFeature;
LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo;
LockSetInfoData( LockSetInfoData(
{this.lockId, {this.lockId,
@ -55,6 +50,11 @@ class LockSetInfoData {
? LockSettingInfo.fromJson(json['lockSettingInfo']) ? LockSettingInfo.fromJson(json['lockSettingInfo'])
: null; : null;
} }
int? lockId;
LockStatus? lockStatus;
LockFeature? lockFeature;
LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -76,13 +76,13 @@ class LockSetInfoData {
} }
class LockStatus { class LockStatus {
int? roomStatus;
LockStatus({this.roomStatus}); LockStatus({this.roomStatus});
LockStatus.fromJson(Map<String, dynamic> json) { LockStatus.fromJson(Map<String, dynamic> json) {
roomStatus = json['roomStatus']; roomStatus = json['roomStatus'];
} }
int? roomStatus;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -91,61 +91,7 @@ class LockStatus {
} }
} }
class LockFeature { class LockFeature { // 0: 1:
int? password;
int? icCard;
int? fingerprint;
int? fingerVein;
int? palmVein;
int? d3Face;
int? qrCode;
int? bluetoothRemoteControl;
int? wirelessKey;
int? gatewayUnlock;
int? lockCommand;
int? firmwareUpgrade;
int? passwordIssue;
int? cardIssue;
int? fingerprintIssue;
int? fingerVeinIssue;
int? palmVeinIssue;
int? d3FaceIssue;
int? lockFreeze;
int? readAdminPassword;
int? passwordManagement;
int? passwordWithDelete;
int? remoteUnlock;
int? autoLock;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? languageSetting;
int? realTimeClock;
int? wifi;
int? videoIntercom;
int? cyclePassword;
int? cycleFingerprintCard;
int? doubleAuthentication;
int? openDirection;
int? proximitySensing;
int? doorStatus;
int? wiredDoorMagnet;
int? wirelessDoorMagnet;
int? doorNotClosedAlarm;
int? unlockReminder;
int? wirelessKeyboard;
int? lightingTime;
int? passageMode;
int? isSupportCatEye;
int? hotelLockCardSystem;
int? appUnlockOnline;
int? bluetoothBroadcast;
int? attendance;
int? motorTorsion;
int? stayWarn;
int? abnormalWarn;
int? isSupportBackupBattery; // 0: 1:
LockFeature({ LockFeature({
this.password, this.password,
@ -260,6 +206,60 @@ class LockFeature {
abnormalWarn = json['abnormalWarn']; abnormalWarn = json['abnormalWarn'];
isSupportBackupBattery = json['isSupportBackupBattery']; isSupportBackupBattery = json['isSupportBackupBattery'];
} }
int? password;
int? icCard;
int? fingerprint;
int? fingerVein;
int? palmVein;
int? d3Face;
int? qrCode;
int? bluetoothRemoteControl;
int? wirelessKey;
int? gatewayUnlock;
int? lockCommand;
int? firmwareUpgrade;
int? passwordIssue;
int? cardIssue;
int? fingerprintIssue;
int? fingerVeinIssue;
int? palmVeinIssue;
int? d3FaceIssue;
int? lockFreeze;
int? readAdminPassword;
int? passwordManagement;
int? passwordWithDelete;
int? remoteUnlock;
int? autoLock;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? languageSetting;
int? realTimeClock;
int? wifi;
int? videoIntercom;
int? cyclePassword;
int? cycleFingerprintCard;
int? doubleAuthentication;
int? openDirection;
int? proximitySensing;
int? doorStatus;
int? wiredDoorMagnet;
int? wirelessDoorMagnet;
int? doorNotClosedAlarm;
int? unlockReminder;
int? wirelessKeyboard;
int? lightingTime;
int? passageMode;
int? isSupportCatEye;
int? hotelLockCardSystem;
int? appUnlockOnline;
int? bluetoothBroadcast;
int? attendance;
int? motorTorsion;
int? stayWarn;
int? abnormalWarn;
int? isSupportBackupBattery;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -322,31 +322,6 @@ class LockFeature {
} }
class LockBasicInfo { class LockBasicInfo {
int? lockId;
int? electricQuantityDate;
int? keyId;
String? model;
int? electricQuantity;
int? electricQuantityStandby;
int? indate;
int? isLockOwner;
String? lockAlias;
String? lockName;
int? groupId;
String? groupName;
List<GroupData>? groupData;
String? adminPwd;
int? keyType;
int? startDate;
int? endDate;
String? mac;
int? keyRight;
int? senderUserId;
int? lockUserNo;
List? weekDays;
String? address;
String? network;
String? vendor;
LockBasicInfo( LockBasicInfo(
{this.lockId, {this.lockId,
@ -407,6 +382,31 @@ class LockBasicInfo {
network = json['network']; network = json['network'];
vendor = json['vendor']; vendor = json['vendor'];
} }
int? lockId;
int? electricQuantityDate;
int? keyId;
String? model;
int? electricQuantity;
int? electricQuantityStandby;
int? indate;
int? isLockOwner;
String? lockAlias;
String? lockName;
int? groupId;
String? groupName;
List<GroupData>? groupData;
String? adminPwd;
int? keyType;
int? startDate;
int? endDate;
String? mac;
int? keyRight;
int? senderUserId;
int? lockUserNo;
List? weekDays;
String? address;
String? network;
String? vendor;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -442,8 +442,6 @@ class LockBasicInfo {
} }
class GroupData { class GroupData {
int? id;
String? name;
GroupData({this.id, this.name}); GroupData({this.id, this.name});
@ -451,6 +449,8 @@ class GroupData {
id = json['id']; id = json['id'];
name = json['name']; name = json['name'];
} }
int? id;
String? name;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -460,55 +460,7 @@ class GroupData {
} }
} }
class LockSettingInfo { class LockSettingInfo { //
int? remoteUnlock;
int? autoLock;
int? autoLockSecond;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? lockSoundVolume;
int? languageSettingLang;
int? openDirectionValue;
int? doorNotClosedAlarm;
int? unlockReminder;
int? lightingTime;
int? lightingSecond;
int? passageMode;
List<PassageModeConfig>? passageModeConfig;
int? attendance;
int? appUnlockOnline;
int? bluetoothBroadcast;
String? adminPwd;
int? unlockReminderPush;
String? languageSettingLangText;
int? motorTorsion;
int? stayWarn;
int? abnormalWarn;
List<CatEyeConfig>? catEyeConfig;
int? faceSwitch; // 0: 1:
int? faceAutoLightScreen; // 0: 1:
int? faceInductionDistance; //
// int? faceAntiMistakeOpen; // 0: 1:
int? autoLightScreen; //- 0: 1:
int? autoLightScreenTime; //-
int? faceEnErrUnlock; //
// List<CatEyeModeConfig>? catEyeConfigList;
// int? faceSwitch; // 0: 1:
// int? faceAutoLightScreen; // 0: 1:
// int? faceInductionDistance; //
// int? faceAntiMistakeOpen; // 0: 1:
// int? autoLightScreen; //- 0: 1:
// int? autoLightScreenTime; //-
// int? dayNotOpenDoorSwitch; //N天未开门开关 (/)
// int? dayNotOpenDoorValue; //N天未开门值
// int? doorNotCloseSwitch; // (/)
// int? lowElecNoticeSwitch; // (/)
// int? doorbellNoticeSwitch; // (/)
// int? someoneAtDoorSwitch; // (/)//
LockSettingInfo({ LockSettingInfo({
this.remoteUnlock, this.remoteUnlock,
this.autoLock, this.autoLock,
@ -539,16 +491,9 @@ class LockSettingInfo {
this.faceSwitch, this.faceSwitch,
this.faceAutoLightScreen, this.faceAutoLightScreen,
this.faceInductionDistance, this.faceInductionDistance,
// this.faceAntiMistakeOpen,
this.autoLightScreen, this.autoLightScreen,
this.autoLightScreenTime, this.autoLightScreenTime,
this.faceEnErrUnlock, this.faceEnErrUnlock,
// this.dayNotOpenDoorSwitch,
// this.dayNotOpenDoorValue,
// this.doorNotCloseSwitch,
// this.lowElecNoticeSwitch,
// this.doorbellNoticeSwitch,
// this.someoneAtDoorSwitch,
}); });
LockSettingInfo.fromJson(Map<String, dynamic> json) { LockSettingInfo.fromJson(Map<String, dynamic> json) {
@ -591,18 +536,43 @@ class LockSettingInfo {
faceSwitch = json['faceSwitch']; faceSwitch = json['faceSwitch'];
faceAutoLightScreen = json['faceAutoLightScreen']; faceAutoLightScreen = json['faceAutoLightScreen'];
faceInductionDistance = json['faceInductionDistance']; faceInductionDistance = json['faceInductionDistance'];
// faceAntiMistakeOpen = json['faceAntiMistakeOpen'];
autoLightScreen = json['autoLightScreen']; autoLightScreen = json['autoLightScreen'];
autoLightScreenTime = json['autoLightScreenTime']; autoLightScreenTime = json['autoLightScreenTime'];
faceEnErrUnlock = json['faceEnErrUnlock']; faceEnErrUnlock = json['faceEnErrUnlock'];
// dayNotOpenDoorSwitch = json['dayNotOpenDoorSwitch'];
// dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
// doorNotCloseSwitch = json['doorNotCloseSwitch'];
// lowElecNoticeSwitch = json['lowElecNoticeSwitch'];
// doorbellNoticeSwitch = json['doorbellNoticeSwitch'];
// someoneAtDoorSwitch = json['someoneAtDoorSwitch'];
} }
int? remoteUnlock;
int? autoLock;
int? autoLockSecond;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? lockSoundVolume;
int? languageSettingLang;
int? openDirectionValue;
int? doorNotClosedAlarm;
int? unlockReminder;
int? lightingTime;
int? lightingSecond;
int? passageMode;
List<PassageModeConfig>? passageModeConfig;
int? attendance;
int? appUnlockOnline;
int? bluetoothBroadcast;
String? adminPwd;
int? unlockReminderPush;
String? languageSettingLangText;
int? motorTorsion;
int? stayWarn;
int? abnormalWarn;
List<CatEyeConfig>? catEyeConfig;
int? faceSwitch; // 0: 1:
int? faceAutoLightScreen; // 0: 1:
int? faceInductionDistance; //
// int? faceAntiMistakeOpen; // 0: 1:
int? autoLightScreen; //- 0: 1:
int? autoLightScreenTime; //-
int? faceEnErrUnlock;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -640,27 +610,15 @@ class LockSettingInfo {
data['faceSwitch'] = faceSwitch; data['faceSwitch'] = faceSwitch;
data['faceAutoLightScreen'] = faceAutoLightScreen; data['faceAutoLightScreen'] = faceAutoLightScreen;
data['faceInductionDistance'] = faceInductionDistance; data['faceInductionDistance'] = faceInductionDistance;
// data['faceAntiMistakeOpen'] = faceAntiMistakeOpen;
data['autoLightScreen'] = autoLightScreen; data['autoLightScreen'] = autoLightScreen;
data['autoLightScreenTime'] = autoLightScreenTime; data['autoLightScreenTime'] = autoLightScreenTime;
data['faceEnErrUnlock'] = faceEnErrUnlock; data['faceEnErrUnlock'] = faceEnErrUnlock;
// data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch;
// data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
// data['doorNotCloseSwitch'] = doorNotCloseSwitch;
// data['lowElecNoticeSwitch'] = lowElecNoticeSwitch;
// data['doorbellNoticeSwitch'] = doorbellNoticeSwitch;
// data['someoneAtDoorSwitch'] = someoneAtDoorSwitch;
return data; return data;
} }
} }
class PassageModeConfig { class PassageModeConfig {
int? startDate;
int? endDate;
List<int>? weekDays;
int? isAllDay;
PassageModeConfig( PassageModeConfig(
{this.startDate, this.endDate, this.weekDays, this.isAllDay}); {this.startDate, this.endDate, this.weekDays, this.isAllDay});
@ -671,6 +629,10 @@ class PassageModeConfig {
weekDays = json['weekDays'].cast<int>(); weekDays = json['weekDays'].cast<int>();
isAllDay = json['isAllDay']; isAllDay = json['isAllDay'];
} }
int? startDate;
int? endDate;
List<int>? weekDays;
int? isAllDay;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -683,8 +645,6 @@ class PassageModeConfig {
} }
class CatEyeConfig { class CatEyeConfig {
int? catEyeMode; //1 2 3 4
CatEyeModeConfig? catEyeModeConfig;
CatEyeConfig({this.catEyeMode, this.catEyeModeConfig}); CatEyeConfig({this.catEyeMode, this.catEyeModeConfig});
@ -694,6 +654,8 @@ class CatEyeConfig {
? CatEyeModeConfig.fromJson(json['catEyeModeConfig']) ? CatEyeModeConfig.fromJson(json['catEyeModeConfig'])
: null; : null;
} }
int? catEyeMode; //1 2 3 4
CatEyeModeConfig? catEyeModeConfig;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -705,13 +667,7 @@ class CatEyeConfig {
} }
} }
class CatEyeModeConfig { class CatEyeModeConfig { //
int? recordMode; // 0 1
String? recordTime; //
int? realTimeMode; // 0 1
int? recordEndTime; //-
int? recordStartTime; //-
String? detectionDistance; //
CatEyeModeConfig( CatEyeModeConfig(
{this.recordMode, {this.recordMode,
@ -733,6 +689,12 @@ class CatEyeModeConfig {
recordStartTime = json['recordStartTime']; recordStartTime = json['recordStartTime'];
detectionDistance = json['detectionDistance']; detectionDistance = json['detectionDistance'];
} }
int? recordMode; // 0 1
String? recordTime; //
int? realTimeMode; // 0 1
int? recordEndTime; //-
int? recordStartTime; //-
String? detectionDistance;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -1,3 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@ -5,7 +6,6 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/tools/showTipView.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_factoryDataReset.dart'; import '../../../../blue/io_protocol/io_factoryDataReset.dart';

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -16,7 +17,6 @@ import '../../../../tools/commonItem.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'lockSetInfo_entity.dart'; import 'lockSetInfo_entity.dart';
import 'lockSet_logic.dart'; import 'lockSet_logic.dart';

View File

@ -1,7 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
@ -19,8 +21,8 @@ class LockSoundSetLogic extends BaseGetXController {
LockSoundSetState state = LockSoundSetState(); LockSoundSetState state = LockSoundSetState();
// -> // ->
void _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSound( final LoginEntity entity = await ApiRepository.to.setLockSound(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
lockSound:state.isOpenLockSound.value == true ? 1 : 0, lockSound:state.isOpenLockSound.value == true ? 1 : 0,
lockSoundVolume:state.lockSoundLevel.value lockSoundVolume:state.lockSoundLevel.value
@ -31,7 +33,7 @@ class LockSoundSetLogic extends BaseGetXController {
state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :0; state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :0;
state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value; state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value;
ifCanNext(); ifCanNext();
showToast("操作成功".tr, something: (){ showToast('操作成功'.tr, something: (){
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Get.back(); Get.back();
}); });
@ -41,7 +43,7 @@ class LockSoundSetLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
// () // ()
if(reply is SetSupportFunctionsWithParametersReply) { if(reply is SetSupportFunctionsWithParametersReply) {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
@ -74,7 +76,7 @@ class LockSoundSetLogic extends BaseGetXController {
// //
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async { Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
@ -105,14 +107,14 @@ class LockSoundSetLogic extends BaseGetXController {
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
int type; int type;
if(state.isOpenLockSound.value == false){ if(state.isOpenLockSound.value == false){
@ -127,7 +129,7 @@ class LockSoundSetLogic extends BaseGetXController {
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 33, featureBit: 33,
featureParaLength: 1, featureParaLength: 1,
featureData: [type], featureData: <int>[type],
token: getTokenList, token: getTokenList,
needAuthor: 1, needAuthor: 1,
publicKey: getPublicKeyList, publicKey: getPublicKeyList,
@ -153,22 +155,13 @@ class LockSoundSetLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -6,12 +7,10 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_state.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_state.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'lockSoundSet_logic.dart'; import 'lockSoundSet_logic.dart';
class LockSoundSetPage extends StatefulWidget { class LockSoundSetPage extends StatefulWidget {

View File

@ -2,20 +2,24 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class LockSoundSetState { class LockSoundSetState {//
var lockSetInfoData = LockSetInfoData().obs;
var isOpenLockSound = false.obs;//
var lockSoundLevel = 0.obs;//
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
var canNext = false.obs;//
LockSoundSetState() { LockSoundSetState() {
var map = Get.arguments; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
isOpenLockSound.value = lockSetInfoData.value.lockSettingInfo!.lockSound == 1 ? true : false; if (lockSetInfoData.value.lockSettingInfo!.lockSound == 1) {
isOpenLockSound.value = true;
} else {
isOpenLockSound.value = false;
}
lockSoundLevel.value = lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!; lockSoundLevel.value = lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!;
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxBool isOpenLockSound = false.obs;//
RxInt lockSoundLevel = 0.obs;//
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;// 0() 1()
RxBool canNext = false.obs;
} }

View File

@ -216,7 +216,7 @@ class LockTimeLogic extends BaseGetXController{
int getLocalTime(){ int getLocalTime(){
final DateTime now = DateTime.now(); final DateTime now = DateTime.now();
final Duration timeZoneOffset = now.timeZoneOffset; final Duration timeZoneOffset = now.timeZoneOffset;
AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds'); // AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
return state.serverTime + timeZoneOffset.inSeconds; return state.serverTime + timeZoneOffset.inSeconds;
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -8,7 +9,6 @@ import '../../../../app_settings/app_colors.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'lockTime_logic.dart'; import 'lockTime_logic.dart';
class LockTimePage extends StatefulWidget { class LockTimePage extends StatefulWidget {

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
@ -11,7 +12,7 @@ class MarkedHouseStateLogic extends BaseGetXController{
// //
Future<void> setRoomStatusData() async{ Future<void> setRoomStatusData() async{
var entity = await ApiRepository.to.setRoomStatusData( final LoginEntity entity = await ApiRepository.to.setRoomStatusData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
roomStatus:state.roomStatus.value, roomStatus:state.roomStatus.value,
); );
@ -20,7 +21,7 @@ class MarkedHouseStateLogic extends BaseGetXController{
state.lockSetInfoData.value.lockStatus!.roomStatus = state.roomStatus.value; state.lockSetInfoData.value.lockStatus!.roomStatus = state.roomStatus.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
showToast("操作成功".tr); showToast('操作成功'.tr);
}else if(entity.errorCode! == 1){ }else if(entity.errorCode! == 1){
// //

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -7,7 +8,6 @@ import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'markedHouseState_logic.dart'; import 'markedHouseState_logic.dart';
class MarkedHouseStatePage extends StatefulWidget { class MarkedHouseStatePage extends StatefulWidget {

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart'; import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
@ -21,7 +22,7 @@ class MotorPowerLogic extends BaseGetXController {
// -> // ->
Future<void> _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setOpenDoorDirectionData( final LoginEntity entity = await ApiRepository.to.setOpenDoorDirectionData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
openDirectionValue:state.motorTorsion.value, // 1-2-; openDirectionValue:state.motorTorsion.value, // 1-2-;
); );
@ -29,14 +30,14 @@ class MotorPowerLogic extends BaseGetXController {
state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.motorTorsion.value; state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.motorTorsion.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
showToast("操作成功".tr); showToast('操作成功'.tr);
} }
} }
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SetSupportFunctionsNoParametersReply) { if(reply is SetSupportFunctionsNoParametersReply) {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
} }
@ -67,7 +68,7 @@ class MotorPowerLogic extends BaseGetXController {
// //
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async { Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
@ -86,14 +87,14 @@ class MotorPowerLogic extends BaseGetXController {
Future<void> _readSupportFunctionsNoParameters() async { Future<void> _readSupportFunctionsNoParameters() async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand( IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -112,21 +113,21 @@ class MotorPowerLogic extends BaseGetXController {
Future<void> sendOpenDoorDirection() async { Future<void> sendOpenDoorDirection() async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsWithParametersCommand( IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 58, featureBit: 58,
featureParaLength: 1, featureParaLength: 1,
featureData: [state.motorTorsion.value], featureData: <int>[state.motorTorsion.value],
token: getTokenList, token: getTokenList,
needAuthor: 1, needAuthor: 1,
publicKey: getPublicKeyList, publicKey: getPublicKeyList,
@ -137,7 +138,6 @@ class MotorPowerLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -145,7 +145,6 @@ class MotorPowerLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
_readSupportFunctionsNoParameters(); _readSupportFunctionsNoParameters();
@ -153,7 +152,6 @@ class MotorPowerLogic extends BaseGetXController {
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
@ -20,33 +21,33 @@ class NormallyOpenModeLogic extends BaseGetXController{
NormallyOpenModeState state = NormallyOpenModeState(); NormallyOpenModeState state = NormallyOpenModeState();
// //
void configPassageMode() async{ Future<void> configPassageMode() async{
if(state.weekDays.value.isEmpty){ if(state.weekDays.value.isEmpty){
showToast("请选择常开日期".tr); showToast('请选择常开日期'.tr);
return; return;
} }
if(state.endTimeMinute.value < state.beginTimeMinute.value){ if(state.endTimeMinute.value < state.beginTimeMinute.value){
showToast("结束时间不能小于开始时间哦".tr); showToast('结束时间不能小于开始时间哦'.tr);
return; return;
} }
var passageModeConfig = []; final List passageModeConfig = [];
var map = { final Map<String, Object> map = <String, Object>{
"isAllDay":state.isAllDay.value, 'isAllDay':state.isAllDay.value,
"weekDays":state.weekDays.value, 'weekDays':state.weekDays.value,
"startDate":state.beginTimeMinute.value, 'startDate':state.beginTimeMinute.value,
"endDate":state.endTimeMinute.value, 'endDate':state.endTimeMinute.value,
}; };
passageModeConfig.add(map); passageModeConfig.add(map);
var entity = await ApiRepository.to.setNormallyModeData( final LoginEntity entity = await ApiRepository.to.setNormallyModeData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
passageMode:state.isOpenNormallyOpenMode.value == true ? 1:0, passageMode:state.isOpenNormallyOpenMode.value == true ? 1:0,
passageModeConfig: passageModeConfig, passageModeConfig: passageModeConfig,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("操作成功".tr, something: (){ showToast('操作成功'.tr, something: (){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0; state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0;
@ -59,7 +60,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SetSupportFunctionsWithParametersReply) { if(reply is SetSupportFunctionsWithParametersReply) {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
} }
@ -91,7 +92,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
// //
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async { Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
@ -122,39 +123,39 @@ class NormallyOpenModeLogic extends BaseGetXController{
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
var weekStr = "00000000"; String weekStr = '00000000';
for (var day in state.weekDays.value) { for (var day in state.weekDays.value) {
int index = day % 7; // 0 final int index = day % 7; // 0
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}'; weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
} }
// weekStr // weekStr
weekStr = weekStr.split('').reversed.join(''); weekStr = weekStr.split('').reversed.join('');
int number = int.parse(weekStr, radix: 2); final int number = int.parse(weekStr, radix: 2);
List<int> list = []; final List<int> list = <int>[];
list.add(state.isOpenNormallyOpenMode.value == true ? 1:0); list.add(state.isOpenNormallyOpenMode.value == true ? 1:0);
int bieginTime = state.beginTimeMinute.value; final int bieginTime = state.beginTimeMinute.value;
double bieginDouble = bieginTime / 256; final double bieginDouble = bieginTime / 256;
int biegin1 = bieginDouble.toInt(); final int biegin1 = bieginDouble.toInt();
int biegin2 = bieginTime % 256; final int biegin2 = bieginTime % 256;
list.add(biegin1); list.add(biegin1);
list.add(biegin2); list.add(biegin2);
// list.add(state.beginTimeMinute.value); // list.add(state.beginTimeMinute.value);
int endTime = state.endTimeMinute.value; final int endTime = state.endTimeMinute.value;
double endDouble = endTime / 256; final double endDouble = endTime / 256;
int end1 = endDouble.toInt(); final int end1 = endDouble.toInt();
int end2 = endTime % 256; final int end2 = endTime % 256;
list.add(end1); list.add(end1);
list.add(end2); list.add(end2);
@ -185,7 +186,6 @@ class NormallyOpenModeLogic extends BaseGetXController{
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -193,7 +193,6 @@ class NormallyOpenModeLogic extends BaseGetXController{
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// _readSupportFunctionsWithParameters(); // _readSupportFunctionsWithParameters();
@ -201,7 +200,6 @@ class NormallyOpenModeLogic extends BaseGetXController{
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -9,12 +10,10 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart'; import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'normallyOpenMode_logic.dart'; import 'normallyOpenMode_logic.dart';
class NormallyOpenModePage extends StatefulWidget { class NormallyOpenModePage extends StatefulWidget {
@ -343,7 +342,6 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
// //
@ -352,7 +350,6 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
// //
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();

View File

@ -2,30 +2,18 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class NormallyOpenModeState{ class NormallyOpenModeState{// 0() 1()
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var isJustForShow = false.obs;//
// var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
var isOpenNormallyOpenMode = false.obs;// 1-0-
// var isOpenAutomaticUnLock = false.obs;// :1-2-
var isAllDay = 0.obs;// 1-2-, startDate和endDate参数将被忽略.
var weekDays = [].obs;//
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeMinute = 0.obs;//
var endTimeMinute = 0.obs;//
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
NormallyOpenModeState() { NormallyOpenModeState() {
var map = Get.arguments; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
lockBasicInfo = lockSetInfoData.value.lockBasicInfo!.obs; lockBasicInfo = lockSetInfoData.value.lockBasicInfo!.obs;
isOpenNormallyOpenMode.value = lockSetInfoData.value.lockSettingInfo!.passageMode! == 1 ? true : false; if (lockSetInfoData.value.lockSettingInfo!.passageMode! == 1) {
isOpenNormallyOpenMode.value = true;
} else {
isOpenNormallyOpenMode.value = false;
}
if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){ if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){
isJustForShow.value = false; isJustForShow.value = false;
@ -38,9 +26,25 @@ class NormallyOpenModeState{
weekDays.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].weekDays!; weekDays.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].weekDays!;
beginTimeMinute.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate!; beginTimeMinute.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate!;
beginTime.value = "${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate!~/60}:${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate! % 60}"; beginTime.value = '${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate!~/60}:${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].startDate! % 60}';
endTimeMinute.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate!; endTimeMinute.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate!;
endTime.value = "${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate!~/60}:${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate! % 60}"; endTime.value = '${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate!~/60}:${lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].endDate! % 60}';
} }
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
RxBool isJustForShow = false.obs;//
// var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
RxBool isOpenNormallyOpenMode = false.obs;// 1-0-
// var isOpenAutomaticUnLock = false.obs;// :1-2-
RxInt isAllDay = 0.obs;// 1-2-, startDate和endDate参数将被忽略.
RxList weekDays = [].obs;//
RxString beginTime = ''.obs;//
RxString endTime = ''.obs;//
RxInt beginTimeMinute = 0.obs;//
RxInt endTimeMinute = 0.obs;//
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
} }

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart'; import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
@ -21,7 +22,7 @@ class OpenDoorDirectionLogic extends BaseGetXController {
// -> // ->
Future<void> _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setOpenDoorDirectionData( final LoginEntity entity = await ApiRepository.to.setOpenDoorDirectionData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
openDirectionValue:state.openDirectionValue.value, // 1-2-; openDirectionValue:state.openDirectionValue.value, // 1-2-;
); );
@ -31,7 +32,7 @@ class OpenDoorDirectionLogic extends BaseGetXController {
// state.openDirectionValue.value = state.openDirectionValue.value == 1 ? 0 : 1; // state.openDirectionValue.value = state.openDirectionValue.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.openDirectionValue.value; state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.openDirectionValue.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
showToast("操作成功".tr); showToast('操作成功'.tr);
} }
} }
@ -89,14 +90,14 @@ class OpenDoorDirectionLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
dismissEasyLoading(); dismissEasyLoading();
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand( IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -116,7 +117,6 @@ class OpenDoorDirectionLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -124,7 +124,6 @@ class OpenDoorDirectionLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// _readSupportFunctionsNoParameters(); // _readSupportFunctionsNoParameters();
@ -132,7 +131,6 @@ class OpenDoorDirectionLogic extends BaseGetXController {
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_state.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'openDoorDirection_logic.dart'; import 'openDoorDirection_logic.dart';
class OpenDoorDirectionPage extends StatefulWidget { class OpenDoorDirectionPage extends StatefulWidget {
@ -15,8 +15,8 @@ class OpenDoorDirectionPage extends StatefulWidget {
} }
class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> { class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
final logic = Get.put(OpenDoorDirectionLogic()); final OpenDoorDirectionLogic logic = Get.put(OpenDoorDirectionLogic());
final state = Get.find<OpenDoorDirectionLogic>().state; final OpenDoorDirectionState state = Get.find<OpenDoorDirectionLogic>().state;
// bool isCheck = false; // bool isCheck = false;
// int selectIndex = 0; // int selectIndex = 0;
@ -31,7 +31,7 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
SizedBox( SizedBox(
height: 60.h, height: 60.h,
), ),
@ -67,10 +67,10 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
Row _buildRadioGroupRowWidget() { Row _buildRadioGroupRowWidget() {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
// SizedBox(width: 60.w,), // SizedBox(width: 60.w,),
Row( Row(
children: [ children: <Widget>[
Obx(() => _colorfulCheckBox(1)), Obx(() => _colorfulCheckBox(1)),
Text( Text(
'左开'.tr, '左开'.tr,
@ -80,7 +80,7 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
), ),
// SizedBox(width: 100.w), // SizedBox(width: 100.w),
Row( Row(
children: [ children: <Widget>[
Obx(() => _colorfulCheckBox(2)), Obx(() => _colorfulCheckBox(2)),
Text( Text(
'右开'.tr, '右开'.tr,
@ -126,7 +126,7 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
: AppColors.placeholderTextColor, : AppColors.placeholderTextColor,
fontSize: 22.sp); fontSize: 22.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [ late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle), TextSpan(text: titleStr, style: titleStyle),
TextSpan(text: subTitle, style: subTipsStyle), TextSpan(text: subTitle, style: subTipsStyle),
]); ]);

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/talk/udp/udp_manage.dart'; import 'package:star_lock/talk/udp/udp_manage.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -20,11 +21,11 @@ class RemoteUnlockingLogic extends BaseGetXController {
RemoteUnlockingState state = RemoteUnlockingState(); RemoteUnlockingState state = RemoteUnlockingState();
void remoteUnlockingOpenOrClose() async { void remoteUnlockingOpenOrClose() async {
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose( final LoginEntity entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
remoteUnlock: state.remoteEnable.value == 1 ? 0 : 1); remoteUnlock: state.remoteEnable.value == 1 ? 0 : 1);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("操作成功".tr, something: () { showToast('操作成功'.tr, something: () {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1; state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock =
@ -143,7 +144,6 @@ class RemoteUnlockingLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -151,7 +151,6 @@ class RemoteUnlockingLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// _readSupportFunctionsNoParameters(); // _readSupportFunctionsNoParameters();
@ -159,8 +158,8 @@ class RemoteUnlockingLogic extends BaseGetXController {
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }
} }

View File

@ -72,7 +72,7 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
: '开启'.tr, : '开启'.tr,
onClick: () { onClick: () {
// //
bool isContains = BlueManage().connectDeviceName.contains("T9A"); bool isContains = BlueManage().connectDeviceName.contains('T9A');
if (isContains) { if (isContains) {
logic.remoteUnlockingOpenOrClose(); logic.remoteUnlockingOpenOrClose();
} else { } else {
@ -86,7 +86,6 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
// //
@ -95,7 +94,6 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
// //
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();

View File

@ -4,16 +4,15 @@ import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class RemoteUnlockingState{ class RemoteUnlockingState{
var lockSetInfoData = LockSetInfoData().obs;
var remoteEnable = 1.obs;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
RemoteUnlockingState() { RemoteUnlockingState() {
var map = Get.arguments; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
remoteEnable.value = lockSetInfoData.value.lockSettingInfo!.remoteUnlock!; remoteEnable.value = lockSetInfoData.value.lockSettingInfo!.remoteUnlock!;
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxInt remoteEnable = 1.obs;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
} }

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/lockSet/resetButton/resetButton_state.dart'; import 'package:star_lock/main/lockDetail/lockSet/resetButton/resetButton_state.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -21,7 +22,7 @@ class ResetButtonLogic extends BaseGetXController{
// -> // ->
Future<void> _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setResetButtonData( final LoginEntity entity = await ApiRepository.to.setResetButtonData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
resetSwitch:state.resetButtonEnable.value == 1 ? 0 : 1, resetSwitch:state.resetButtonEnable.value == 1 ? 0 : 1,
); );
@ -29,7 +30,7 @@ class ResetButtonLogic extends BaseGetXController{
// eventBus.fire(RefreshLockListInfoDataEvent()); // eventBus.fire(RefreshLockListInfoDataEvent());
state.resetButtonEnable.value = state.resetButtonEnable.value == 1 ? 2 : 1; state.resetButtonEnable.value = state.resetButtonEnable.value == 1 ? 2 : 1;
state.lockSetInfoData.value.lockSettingInfo!.resetSwitch = state.resetButtonEnable.value; state.lockSetInfoData.value.lockSettingInfo!.resetSwitch = state.resetButtonEnable.value;
showToast("操作成功".tr, something: (){ showToast('操作成功'.tr, something: (){
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
}); });
} }
@ -38,7 +39,7 @@ class ResetButtonLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SetSupportFunctionsNoParametersReply) { if(reply is SetSupportFunctionsNoParametersReply) {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
} }
@ -69,7 +70,7 @@ class ResetButtonLogic extends BaseGetXController{
// //
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async { Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
@ -100,14 +101,14 @@ class ResetButtonLogic extends BaseGetXController{
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand( IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -131,7 +132,6 @@ class ResetButtonLogic extends BaseGetXController{
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -139,7 +139,6 @@ class ResetButtonLogic extends BaseGetXController{
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// _readSupportFunctionsNoParameters(); // _readSupportFunctionsNoParameters();
@ -147,7 +146,6 @@ class ResetButtonLogic extends BaseGetXController{
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -10,7 +11,6 @@ import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'resetButton_logic.dart'; import 'resetButton_logic.dart';
class ResetButtonPage extends StatefulWidget { class ResetButtonPage extends StatefulWidget {

View File

@ -3,19 +3,19 @@ import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class ResetButtonState{ class ResetButtonState{// 0() 1()
var lockSetInfoData = LockSetInfoData().obs;
var resetButtonEnable = 1.obs;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
ResetButtonState() { ResetButtonState() {
var map = Get.arguments; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
resetButtonEnable.value = lockSetInfoData.value.lockSettingInfo!.resetSwitch!; resetButtonEnable.value = lockSetInfoData.value.lockSettingInfo!.resetSwitch!;
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxInt resetButtonEnable = 1.obs;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';

View File

@ -2,6 +2,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_updataLockRemoteControlList.dart'; import 'package:star_lock/blue/io_protocol/io_updataLockRemoteControlList.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -724,7 +725,7 @@ class UploadDataLogic extends BaseGetXController{
// 1 // 1
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
showToast('上传成功'); showToast('上传成功'.tr);
}else{ }else{
// 2 // 2
switch(recordType){ switch(recordType){

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -8,7 +9,6 @@ import '../../../../app_settings/app_colors.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'uploadData_logic.dart'; import 'uploadData_logic.dart';
class UploadDataPage extends StatefulWidget { class UploadDataPage extends StatefulWidget {

View File

@ -90,8 +90,4 @@ class _AddWirelessKeyboardPageState extends State<AddWirelessKeyboardPage> {
), ),
); );
} }
void onShow() {}
void onHide() {}
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -6,7 +7,6 @@ import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class AddWirelessKeyboardScreenNotLightOnPage extends StatefulWidget { class AddWirelessKeyboardScreenNotLightOnPage extends StatefulWidget {
const AddWirelessKeyboardScreenNotLightOnPage({Key? key}) : super(key: key); const AddWirelessKeyboardScreenNotLightOnPage({Key? key}) : super(key: key);
@ -91,8 +91,4 @@ class _AddWirelessKeyboardScreenNotLightOnPageState
), ),
); );
} }
void onShow() {}
void onHide() {}
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -5,7 +6,6 @@ import 'package:star_lock/tools/noData.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class SelectWirelessKeyboardPage extends StatefulWidget { class SelectWirelessKeyboardPage extends StatefulWidget {
const SelectWirelessKeyboardPage({Key? key}) : super(key: key); const SelectWirelessKeyboardPage({Key? key}) : super(key: key);
@ -30,8 +30,7 @@ class _SelectWirelessKeyboardPageState extends State<SelectWirelessKeyboardPage>
: ListView.builder( : ListView.builder(
itemCount: 20, itemCount: 20,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return nearbyLockItem('images/icon_lock.png', "MCBN01-ea9240", return nearbyLockItem('images/icon_lock.png', '', () {
() {
// Navigator.pushNamed(context, Routers.saveLockPage); // Navigator.pushNamed(context, Routers.saveLockPage);
}); });
}), }),

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -9,7 +10,6 @@ import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class WirelessKeyboardPage extends StatefulWidget { class WirelessKeyboardPage extends StatefulWidget {
const WirelessKeyboardPage({Key? key}) : super(key: key); const WirelessKeyboardPage({Key? key}) : super(key: key);
@ -147,7 +147,7 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
context: Get.context!, context: Get.context!,
builder: (context) { builder: (context) {
return CupertinoAlertDialog( return CupertinoAlertDialog(
title: const Text('该锁的无线键盘都将被删除'), title: Text('该锁的无线键盘都将被删除'.tr),
actions: [ actions: [
CupertinoDialogAction( CupertinoDialogAction(
child: Text('取消'.tr), child: Text('取消'.tr),

View File

@ -4,21 +4,16 @@ import 'package:video_player/video_player.dart';
import 'video_player_control.dart'; import 'video_player_control.dart';
class ControllerWidget extends InheritedWidget { class ControllerWidget extends InheritedWidget {
const ControllerWidget(
{required this.controlKey, required this.child, required this.controller, required this.videoInit, required this.title, Key? key
}) : super(key: key, child: child);
final String title; final String title;
final GlobalKey<VideoPlayerControlState> controlKey; final GlobalKey<VideoPlayerControlState> controlKey;
final Widget child; final Widget child;
final VideoPlayerController controller; final VideoPlayerController controller;
final bool videoInit; final bool videoInit;
ControllerWidget(
{Key? key,
required this.controlKey,
required this.child,
required this.controller,
required this.videoInit,
required this.title
}) : super(key: key, child: child);
//便便widget获取共享数据 //便便widget获取共享数据
static ControllerWidget? of(BuildContext context) { static ControllerWidget? of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<ControllerWidget>(); return context.dependOnInheritedWidgetOfExactType<ControllerWidget>();
@ -26,7 +21,6 @@ class ControllerWidget extends InheritedWidget {
@override @override
bool updateShouldNotify(InheritedWidget oldWidget) { bool updateShouldNotify(InheritedWidget oldWidget) {
// TODO: implement updateShouldNotify
return false; return false;
} }

View File

@ -1,7 +1,8 @@
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:screen/screen.dart'; import 'package:get/get.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import 'controller_widget.dart'; import 'controller_widget.dart';
import 'video_player_control.dart'; import 'video_player_control.dart';
@ -10,7 +11,7 @@ import 'video_player_pan.dart';
enum VideoPlayerType { network, asset, file } enum VideoPlayerType { network, asset, file }
class VideoPlayerUI extends StatefulWidget { class VideoPlayerUI extends StatefulWidget {
VideoPlayerUI.network({ const VideoPlayerUI.network({
Key? key, Key? key,
required String this.url, // required String this.url, //
required this.width, // required this.width, //
@ -19,7 +20,7 @@ class VideoPlayerUI extends StatefulWidget {
}) : type = VideoPlayerType.network, }) : type = VideoPlayerType.network,
super(key: key); super(key: key);
VideoPlayerUI.asset({ const VideoPlayerUI.asset({
Key? key, Key? key,
required String dataSource, // required String dataSource, //
this.width = double.infinity, // this.width = double.infinity, //
@ -126,8 +127,8 @@ class _VideoPlayerUIState extends State<VideoPlayerUI> {
} else { } else {
return Center( return Center(
child: Text( child: Text(
'暂无视频信息', '暂无视频信息'.tr,
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
); );
} }
@ -142,11 +143,11 @@ class _VideoPlayerUIState extends State<VideoPlayerUI> {
); );
} else if (_controller != null && _videoError) { } else if (_controller != null && _videoError) {
return Text( return Text(
'加载出错', '加载出错'.tr,
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
); );
} else { } else {
return SizedBox( return const SizedBox(
width: 30, width: 30,
height: 30, height: 30,
child: CircularProgressIndicator( child: CircularProgressIndicator(
@ -186,15 +187,15 @@ class _VideoPlayerUIState extends State<VideoPlayerUI> {
}); });
} }
void _videoListener() async { Future<void> _videoListener() async {
if (_controller.value.hasError) { if (_controller.value.hasError) {
setState(() { setState(() {
_videoError = true; _videoError = true;
}); });
} else { } else {
Duration? res = await _controller.position; final Duration? res = await _controller.position;
if (res! >= _controller.value.duration) { if (res! >= _controller.value.duration) {
await _controller.seekTo(Duration(seconds: 0)); await _controller.seekTo(const Duration(seconds: 0));
await _controller.pause(); await _controller.pause();
} }
if (_controller.value.isPlaying && _key.currentState != null) { if (_controller.value.isPlaying && _key.currentState != null) {

View File

@ -10,7 +10,7 @@ import 'controller_widget.dart';
import 'video_player_slider.dart'; import 'video_player_slider.dart';
class VideoPlayerControl extends StatefulWidget { class VideoPlayerControl extends StatefulWidget {
VideoPlayerControl({ const VideoPlayerControl({
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -23,8 +23,8 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
bool get videoInit => ControllerWidget.of(context)!.videoInit; bool get videoInit => ControllerWidget.of(context)!.videoInit;
String get title=>ControllerWidget.of(context)!.title; String get title=>ControllerWidget.of(context)!.title;
// video播放进度 // video播放进度
Duration _position = Duration(seconds: 0); Duration _position = const Duration(seconds: 0);
Duration _totalDuration = Duration(seconds: 0); Duration _totalDuration = const Duration(seconds: 0);
late Timer _timer; // ui late Timer _timer; // ui
bool _hidePlayControl = true; // ui bool _hidePlayControl = true; // ui
double _playControlOpacity = 0; // /ui double _playControlOpacity = 0; // /ui
@ -55,7 +55,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
child: AnimatedOpacity( child: AnimatedOpacity(
// //
opacity: _playControlOpacity, opacity: _playControlOpacity,
duration: Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
child: Column( child: Column(
children: <Widget>[_top(), _middle(), _bottom(context)], children: <Widget>[_top(), _middle(), _bottom(context)],
), ),
@ -89,7 +89,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
// //
width: double.infinity, width: double.infinity,
height: 40, height: 40,
decoration: BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
// //
begin: Alignment.bottomCenter, begin: Alignment.bottomCenter,
@ -120,7 +120,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
), ),
Container( Container(
// //
margin: EdgeInsets.only(left: 10), margin: const EdgeInsets.only(left: 10),
child: Text( child: Text(
'${DateUtil.formatDateMs( '${DateUtil.formatDateMs(
_position!.inMilliseconds, _position!.inMilliseconds,
@ -129,7 +129,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
_totalDuration!.inMilliseconds, _totalDuration!.inMilliseconds,
format: 'mm:ss', format: 'mm:ss',
)}', )}',
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),
IconButton( IconButton(
@ -141,10 +141,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
_isFullScreen ? Icons.fullscreen_exit : Icons.fullscreen, _isFullScreen ? Icons.fullscreen_exit : Icons.fullscreen,
color: Colors.white, color: Colors.white,
), ),
onPressed: () { onPressed: _toggleFullScreen,
//
_toggleFullScreen();
},
), ),
], ],
), ),
@ -161,7 +158,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 40, height: 40,
decoration: BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
// //
begin: Alignment.bottomCenter, begin: Alignment.bottomCenter,
@ -173,23 +170,19 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
// //
ModalRoute.of(context)!.isFirst && !_isFullScreen if (ModalRoute.of(context)!.isFirst && !_isFullScreen) Container() else IconButton(
? Container() icon: const Icon(
: IconButton(
icon: Icon(
Icons.arrow_back, Icons.arrow_back,
color: Colors.white, color: Colors.white,
), ),
onPressed: backPress), onPressed: backPress),
Text( Text(
title, title,
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
// //
ModalRoute.of(context)!.isFirst && !_isFullScreen if (ModalRoute.of(context)!.isFirst && !_isFullScreen) Container() else IconButton(
? Container() icon: const Icon(
: IconButton(
icon: Icon(
Icons.arrow_back, Icons.arrow_back,
color: Colors.transparent, color: Colors.transparent,
), ),
@ -230,7 +223,7 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
/// ///
if (_timer != null) _timer.cancel(); // if (_timer != null) _timer.cancel(); //
_playControlOpacity = 0; _playControlOpacity = 0;
Future.delayed(Duration(milliseconds: 500)).whenComplete(() { Future.delayed(const Duration(milliseconds: 500)).whenComplete(() {
_hidePlayControl = true; // 500ms() _hidePlayControl = true; // 500ms()
}); });
} }
@ -240,11 +233,11 @@ class VideoPlayerControlState extends State<VideoPlayerControl> {
void _startPlayControlTimer() { void _startPlayControlTimer() {
/// js的大同小异 /// js的大同小异
if (_timer != null) _timer.cancel(); if (_timer != null) _timer.cancel();
_timer = Timer(Duration(seconds: 3), () { _timer = Timer(const Duration(seconds: 3), () {
/// 3s后隐藏 /// 3s后隐藏
setState(() { setState(() {
_playControlOpacity = 0; _playControlOpacity = 0;
Future.delayed(Duration(milliseconds: 500)).whenComplete(() { Future.delayed(const Duration(milliseconds: 500)).whenComplete(() {
_hidePlayControl = true; _hidePlayControl = true;
}); });
}); });

View File

@ -1,7 +1,7 @@
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
//import 'package:screen/screen.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import '../after_layout.dart'; import '../after_layout.dart';
@ -30,7 +30,7 @@ class _VideoPlayerPanState extends State<VideoPlayerPan>
String volumePercentage = ''; // String volumePercentage = ''; //
double playDialogOpacity = 0.0; double playDialogOpacity = 0.0;
bool allowHorizontal = false; // bool allowHorizontal = false; //
Duration position = Duration(seconds: 0); // Duration position = const Duration(seconds: 0); //
double brightness = 0.0; // double brightness = 0.0; //
bool brightnessOk = false; // bool brightnessOk = false; //
@ -66,15 +66,15 @@ class _VideoPlayerPanState extends State<VideoPlayerPan>
Center( Center(
child: AnimatedOpacity( child: AnimatedOpacity(
opacity: playDialogOpacity, opacity: playDialogOpacity,
duration: Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 5.0, horizontal: 6.0), padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 6.0),
decoration: BoxDecoration( decoration: const BoxDecoration(
color: Colors.black87, color: Colors.black87,
borderRadius: BorderRadius.all(Radius.circular(5.0))), borderRadius: BorderRadius.all(Radius.circular(5.0))),
child: Text( child: Text(
volumePercentage, volumePercentage,
style: TextStyle(color: Colors.white, fontSize: 12), style: const TextStyle(color: Colors.white, fontSize: 12),
), ),
), ),
), ),
@ -109,14 +109,14 @@ class _VideoPlayerPanState extends State<VideoPlayerPan>
/// ///
if (brightnessOk = true) { if (brightnessOk = true) {
setState(() { setState(() {
volumePercentage = '亮度${(_setBrightnessValue() * 100).toInt()}%'; volumePercentage = '${'亮度'.tr}${(_setBrightnessValue() * 100).toInt()}%';
playDialogOpacity = 1.0; playDialogOpacity = 1.0;
}); });
} }
} else { } else {
/// ///
setState(() { setState(() {
volumePercentage = '音量${(_setVerticalValue(num: 2) * 100).toInt()}%'; volumePercentage = '${'音量'.tr}${(_setVerticalValue(num: 2) * 100).toInt()}%';
playDialogOpacity = 1.0; playDialogOpacity = 1.0;
}); });
} }
@ -170,7 +170,7 @@ class _VideoPlayerPanState extends State<VideoPlayerPan>
} }
void _reset(BuildContext context) { void _reset(BuildContext context) {
startPosition = Offset(0, 0); startPosition = const Offset(0, 0);
movePan = 0; movePan = 0;
layoutHeight = context.size!.height; layoutHeight = context.size!.height;
layoutWidth = context.size!.width; layoutWidth = context.size!.width;
@ -202,12 +202,12 @@ class _VideoPlayerPanState extends State<VideoPlayerPan>
); );
if (value >= 0) { if (value >= 0) {
setState(() { setState(() {
volumePercentage = '快进至$currentSecond'; volumePercentage = '${'快进至'.tr}$currentSecond';
playDialogOpacity = 1.0; playDialogOpacity = 1.0;
}); });
} else { } else {
setState(() { setState(() {
volumePercentage = '快退至${(value * 100).toInt()}%'; volumePercentage = '${'快退至'.tr}${(value * 100).toInt()}%';
playDialogOpacity = 1.0; playDialogOpacity = 1.0;
}); });
} }

View File

@ -7,11 +7,11 @@ import 'package:video_player/video_player.dart';
import 'controller_widget.dart'; import 'controller_widget.dart';
class VideoPlayerSlider extends StatefulWidget { class VideoPlayerSlider extends StatefulWidget {
const VideoPlayerSlider({required this.startPlayControlTimer, required this.timer, Key? key}) : super(key: key);
final Function startPlayControlTimer; final Function startPlayControlTimer;
final Timer timer; final Timer timer;
VideoPlayerSlider({required this.startPlayControlTimer, required this.timer});
@override @override
_VideoPlayerSliderState createState() => _VideoPlayerSliderState(); _VideoPlayerSliderState createState() => _VideoPlayerSliderState();
} }
@ -58,11 +58,11 @@ class _VideoPlayerSliderState extends State<VideoPlayerSlider> {
data: SliderTheme.of(context).copyWith( data: SliderTheme.of(context).copyWith(
// //
inactiveTrackColor: Colors.white, inactiveTrackColor: Colors.white,
overlayShape: RoundSliderOverlayShape( overlayShape: const RoundSliderOverlayShape(
//SliderComponentShape自定义形状 //SliderComponentShape自定义形状
overlayRadius: 10, // overlayRadius: 10, //
), ),
thumbShape: RoundSliderThumbShape( thumbShape: const RoundSliderThumbShape(
//SliderComponentShape自定义形状 //SliderComponentShape自定义形状
disabledThumbRadius: 7, // disabledThumbRadius: 7, //
enabledThumbRadius: 7, // enabledThumbRadius: 7, //

View File

@ -1,23 +1,26 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
import 'editVideoLog_state.dart'; import 'editVideoLog_state.dart';
class EditVideoLogLogic extends BaseGetXController { class EditVideoLogLogic extends BaseGetXController {
EditVideoLogState state = EditVideoLogState(); EditVideoLogState state = EditVideoLogState();
void deleteLockCloudStorageList() async { Future<void> deleteLockCloudStorageList() async {
var entity = await ApiRepository.to.deleteLockCloudStorageList( final VersionUndateEntity entity = await ApiRepository.to.deleteLockCloudStorageList(
recordIds: state.selectVideoLogList.value.map((e) => e.recordId).toList(), recordIds: state.selectVideoLogList.value.map((e) => e.recordId).toList(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.selectVideoLogList.value.clear(); state.selectVideoLogList.value.clear();
showToast('删除成功'); showToast('删除成功'.tr);
getLockCloudStorageList(); getLockCloudStorageList();
} }
} }
void getLockCloudStorageList() async { Future<void> getLockCloudStorageList() async {
var entity = await ApiRepository.to.getLockCloudStorageList( final VideoLogEntity entity = await ApiRepository.to.getLockCloudStorageList(
lockId: state.getLockId.value, lockId: state.getLockId.value,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/videoLog/editVideoLog/editVideoLog_state.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
@ -17,21 +19,21 @@ class EditVideoLogPage extends StatefulWidget {
} }
class _EditVideoLogPageState extends State<EditVideoLogPage> { class _EditVideoLogPageState extends State<EditVideoLogPage> {
final logic = Get.put(EditVideoLogLogic()); final EditVideoLogLogic logic = Get.put(EditVideoLogLogic());
final state = Get.find<EditVideoLogLogic>().state; final EditVideoLogState state = Get.find<EditVideoLogLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "已选${state.selectVideoLogList.value.length}", barTitle: '${'已选'.tr}${state.selectVideoLogList.value.length}${''.tr}',
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
"全选".tr, '全选'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () async { onPressed: () async {
@ -67,19 +69,19 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
], ],
), ),
body: Column( body: Column(
children: [ children: <Widget>[
Expanded( Expanded(
child: Obx(() => ListView.builder( child: Obx(() => ListView.builder(
itemCount: state.videoLogList.length, itemCount: state.videoLogList.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
CloudStorageData item = state.videoLogList[index]; final CloudStorageData item = state.videoLogList[index];
return Column( return Column(
children: [ children: <Widget>[
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w), left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [ child: Row(children: <Widget>[
Text(item.date ?? "", Text(item.date ?? '',
style: TextStyle(fontSize: 20.sp)), style: TextStyle(fontSize: 20.sp)),
])), ])),
mainListView(index, item) mainListView(index, item)
@ -93,8 +95,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
); );
} }
var itemW = (1.sw - 15.w * 4) / 3; double itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h; double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
Widget mainListView(int index, CloudStorageData itemData) { Widget mainListView(int index, CloudStorageData itemData) {
return GridView.builder( return GridView.builder(
padding: EdgeInsets.only(left: 15.w, right: 15.w), padding: EdgeInsets.only(left: 15.w, right: 15.w),
@ -110,8 +112,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
crossAxisSpacing: 15.w, crossAxisSpacing: 15.w,
// //
childAspectRatio: itemW / itemH), childAspectRatio: itemW / itemH),
itemBuilder: (context, index) { itemBuilder: (BuildContext context, int index) {
RecordListData recordData = itemData.recordList![index]; final RecordListData recordData = itemData.recordList![index];
return videoItem(recordData, index); return videoItem(recordData, index);
}, },
); );
@ -133,9 +135,9 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
setState(() {}); setState(() {});
}, },
child: Stack( child: Stack(
children: [ children: <Widget>[
Column( Column(
children: [ children: <Widget>[
Container( Container(
width: itemW, width: itemW,
height: itemW, height: itemW,
@ -146,7 +148,7 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
child: Image( child: Image(
fit: BoxFit.cover, fit: BoxFit.cover,
image: Image.network(recordData.imagesUrl ?? image: Image.network(recordData.imagesUrl ??
"images/icon_video_placeholder.jpg") 'images/icon_video_placeholder.jpg')
.image), .image),
), ),
), ),
@ -165,8 +167,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
width: 36.w, width: 36.w,
height: 36.w, height: 36.w,
image: state.selectVideoLogList.value.contains(recordData) image: state.selectVideoLogList.value.contains(recordData)
? const AssetImage("images/icon_round_select.png") ? const AssetImage('images/icon_round_select.png')
: const AssetImage("images/icon_round_unSelect.png"))) : const AssetImage('images/icon_round_unSelect.png')))
], ],
)), )),
); );
@ -175,14 +177,14 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
Widget bottomBottomBtnWidget() { Widget bottomBottomBtnWidget() {
return SizedBox( return SizedBox(
width: 1.sw, width: 1.sw,
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ child: Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
bottomBtnItemWidget( bottomBtnItemWidget(
"images/main/icon_lockDetail_monitoringDownloadVideo.png", 'images/main/icon_lockDetail_monitoringDownloadVideo.png',
"下载".tr, '下载'.tr,
Colors.white, () { Colors.white, () {
if (state.selectVideoLogList.value.isNotEmpty) { if (state.selectVideoLogList.value.isNotEmpty) {
Get.toNamed(Routers.videoLogDownLoadPage, arguments: { Get.toNamed(Routers.videoLogDownLoadPage, arguments: <String, List<RecordListData>>{
"downloadVideoLogList": state.selectVideoLogList.value 'downloadVideoLogList': state.selectVideoLogList.value
}); });
} else { } else {
logic.showToast('请选择要下载的视频'); logic.showToast('请选择要下载的视频');
@ -190,8 +192,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
}), }),
SizedBox(width: 100.w), SizedBox(width: 100.w),
bottomBtnItemWidget( bottomBtnItemWidget(
"images/main/icon_lockDetail_monitoringDeletVideo.png", 'images/main/icon_lockDetail_monitoringDeletVideo.png',
"删除".tr, '删除'.tr,
AppColors.mainColor, () { AppColors.mainColor, () {
if (state.selectVideoLogList.value.isNotEmpty) { if (state.selectVideoLogList.value.isNotEmpty) {
logic.deleteLockCloudStorageList(); logic.deleteLockCloudStorageList();
@ -205,14 +207,14 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
Widget bottomBtnItemWidget( Widget bottomBtnItemWidget(
String iconUrl, String name, Color backgroundColor, Function() onClick) { String iconUrl, String name, Color backgroundColor, Function() onClick) {
var wh = 40.w; final double wh = 40.w;
return GestureDetector( return GestureDetector(
onTap: onClick, onTap: onClick,
child: SizedBox( child: SizedBox(
height: 140.h, height: 140.h,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: <Widget>[
SizedBox(height: 30.w), SizedBox(height: 30.w),
Image.asset(iconUrl, width: wh, height: wh, fit: BoxFit.fitWidth), Image.asset(iconUrl, width: wh, height: wh, fit: BoxFit.fitWidth),
SizedBox(height: 10.w), SizedBox(height: 10.w),

View File

@ -2,10 +2,6 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
class EditVideoLogState { class EditVideoLogState {
var selectVideoLogList = <RecordListData>[].obs; //
var isSelectAll = false.obs;
var videoLogList = [].obs; //
var getLockId = 0.obs;
EditVideoLogState() { EditVideoLogState() {
Map map = Get.arguments; Map map = Get.arguments;
@ -17,4 +13,8 @@ class EditVideoLogState {
getLockId.value = map['lockId']; getLockId.value = map['lockId'];
} }
} }
RxList<RecordListData> selectVideoLogList = <RecordListData>[].obs; //
RxBool isSelectAll = false.obs;
RxList videoLogList = [].obs; //
RxInt getLockId = 0.obs;
} }

View File

@ -1,9 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_state.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/noData.dart';
@ -19,8 +21,8 @@ class VideoLogPage extends StatefulWidget {
} }
class _VideoLogPageState extends State<VideoLogPage> { class _VideoLogPageState extends State<VideoLogPage> {
final logic = Get.put(VideoLogLogic()); final VideoLogLogic logic = Get.put(VideoLogLogic());
final state = Get.find<VideoLogLogic>().state; final VideoLogState state = Get.find<VideoLogLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,7 +35,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: Column( body: Column(
children: [ children: <Widget>[
// //
Visibility(visible: !state.isNavLocal.value, child: vipTip()), Visibility(visible: !state.isNavLocal.value, child: vipTip()),
// //
@ -45,15 +47,15 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: Expanded( child: Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: state.videoLogList.length, itemCount: state.videoLogList.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
CloudStorageData item = state.videoLogList[index]; final CloudStorageData item = state.videoLogList[index];
return Column( return Column(
children: [ children: <Widget>[
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w), left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [ child: Row(children: <Widget>[
Text(item.date ?? "", Text(item.date ?? '',
style: TextStyle(fontSize: 20.sp)), style: TextStyle(fontSize: 20.sp)),
])), ])),
mainListView(index, item) mainListView(index, item)
@ -67,14 +69,14 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: state.localList.isNotEmpty child: state.localList.isNotEmpty
? ListView.builder( ? ListView.builder(
itemCount: 5, itemCount: 5,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
return Column( return Column(
children: [ children: <Widget>[
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w), left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [ child: Row(children: <Widget>[
Text("2023.10.2$index", Text('2023.10.2$index',
style: TextStyle(fontSize: 20.sp)), style: TextStyle(fontSize: 20.sp)),
])), ])),
mainListView(index, CloudStorageData()), mainListView(index, CloudStorageData()),
@ -94,14 +96,14 @@ class _VideoLogPageState extends State<VideoLogPage> {
// color: Colors.white, // color: Colors.white,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
TextButton( TextButton(
onPressed: () { onPressed: () {
setState(() { setState(() {
state.isNavLocal.value = false; state.isNavLocal.value = false;
}); });
}, },
child: Obx(() => Text("云存".tr, child: Obx(() => Text('云存'.tr,
style: state.isNavLocal.value == true style: state.isNavLocal.value == true
? TextStyle( ? TextStyle(
color: Colors.grey, color: Colors.grey,
@ -117,7 +119,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
state.isNavLocal.value = true; state.isNavLocal.value = true;
}); });
}, },
child: Obx(() => Text("本地".tr, child: Obx(() => Text('本地'.tr,
style: state.isNavLocal.value == true style: state.isNavLocal.value == true
? TextStyle( ? TextStyle(
color: Colors.white, color: Colors.white,
@ -147,23 +149,23 @@ class _VideoLogPageState extends State<VideoLogPage> {
color: const Color(0xFFF6F7F8), color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h)), borderRadius: BorderRadius.circular(20.h)),
child: Row( child: Row(
children: [ children: <Widget>[
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: <Widget>[
Text("3天滚动储存".tr, style: TextStyle(fontSize: 24.sp)), Text('3天滚动储存'.tr, style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Text("${F.navTitle}${"已为本设备免费提供3大滚动视频储存服务".tr}", Text("${F.navTitle}${"已为本设备免费提供3大滚动视频储存服务".tr}",
style: TextStyle(fontSize: 22.sp, color: Colors.grey)), style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
], ],
)), )),
SizedBox(width: 15.w), SizedBox(width: 15.w),
Text("去升级".tr, style: TextStyle(fontSize: 22.sp)), Text('去升级'.tr, style: TextStyle(fontSize: 22.sp)),
Image( Image(
width: 40.w, width: 40.w,
height: 24.w, height: 24.w,
image: const AssetImage("images/icon_right_black.png")) image: const AssetImage('images/icon_right_black.png'))
], ],
), ),
), ),
@ -185,15 +187,15 @@ class _VideoLogPageState extends State<VideoLogPage> {
color: const Color(0xFFF6F7F8), color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h)), borderRadius: BorderRadius.circular(20.h)),
child: Row( child: Row(
children: [ children: <Widget>[
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: <Widget>[
// SizedBox(height: 20.h), // SizedBox(height: 20.h),
Text("下载列表".tr, style: TextStyle(fontSize: 24.sp)), Text('下载列表'.tr, style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 15.h), SizedBox(height: 15.h),
Text("暂无下载内容".tr, Text('暂无下载内容'.tr,
style: TextStyle(fontSize: 22.sp, color: Colors.grey)), style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
], ],
)), )),
@ -202,7 +204,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
Image( Image(
width: 40.w, width: 40.w,
height: 24.w, height: 24.w,
image: const AssetImage("images/icon_right_black.png")) image: const AssetImage('images/icon_right_black.png'))
], ],
), ),
), ),
@ -215,8 +217,8 @@ class _VideoLogPageState extends State<VideoLogPage> {
margin: EdgeInsets.only(left: 20.w), margin: EdgeInsets.only(left: 20.w),
child: Row( child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: <Widget>[
Text(state.isNavLocal.value == true ? "已下载".tr : "全部视频".tr, Text(state.isNavLocal.value == true ? '已下载'.tr : '全部视频'.tr,
style: TextStyle(fontSize: 26.sp, fontWeight: FontWeight.w500)), style: TextStyle(fontSize: 26.sp, fontWeight: FontWeight.w500)),
Expanded(child: SizedBox(width: 10.w)), Expanded(child: SizedBox(width: 10.w)),
IconButton( IconButton(
@ -224,13 +226,13 @@ class _VideoLogPageState extends State<VideoLogPage> {
width: 40.w, width: 40.w,
height: 40.w, height: 40.w,
image: const AssetImage( image: const AssetImage(
"images/main/icon_lockDetail_monitoringEditVoice.png")), 'images/main/icon_lockDetail_monitoringEditVoice.png')),
iconSize: 30, iconSize: 30,
color: Colors.black54, color: Colors.black54,
onPressed: () { onPressed: () {
Get.toNamed(Routers.editVideoLogPage, arguments: { Get.toNamed(Routers.editVideoLogPage, arguments: <String, Object>{
"videoDataList": state.videoLogList.value, 'videoDataList': state.videoLogList.value,
"lockId": state.getLockId.value 'lockId': state.getLockId.value
}); });
}, },
) )
@ -245,8 +247,8 @@ class _VideoLogPageState extends State<VideoLogPage> {
); );
} }
var itemW = (1.sw - 15.w * 4) / 3; double itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h; double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
// //
Widget mainListView(int index, CloudStorageData itemData) { Widget mainListView(int index, CloudStorageData itemData) {
@ -264,8 +266,8 @@ class _VideoLogPageState extends State<VideoLogPage> {
crossAxisSpacing: 15.w, crossAxisSpacing: 15.w,
// //
childAspectRatio: itemW / itemH), childAspectRatio: itemW / itemH),
itemBuilder: (context, index) { itemBuilder: (BuildContext context, int index) {
RecordListData recordData = itemData.recordList![index]; final RecordListData recordData = itemData.recordList![index];
return videoItem(recordData); return videoItem(recordData);
}, },
); );
@ -274,16 +276,16 @@ class _VideoLogPageState extends State<VideoLogPage> {
Widget videoItem(RecordListData recordData) { Widget videoItem(RecordListData recordData) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.videoLogDetailPage, arguments: { Get.toNamed(Routers.videoLogDetailPage, arguments: <String, Object>{
"recordData": recordData, 'recordData': recordData,
"videoDataList": state.videoLogList.value 'videoDataList': state.videoLogList.value
}); });
}, },
child: SizedBox( child: SizedBox(
width: itemW, width: itemW,
height: itemH, height: itemH,
child: Column( child: Column(
children: [ children: <Widget>[
Container( Container(
width: itemW, width: itemW,
height: itemW, height: itemW,
@ -294,7 +296,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: Image( child: Image(
fit: BoxFit.cover, fit: BoxFit.cover,
image: Image.network(recordData.imagesUrl ?? image: Image.network(recordData.imagesUrl ??
"images/icon_video_placeholder.jpg") 'images/icon_video_placeholder.jpg')
.image), .image),
), ),
), ),

View File

@ -145,7 +145,7 @@ class ControlsOverlay extends StatelessWidget {
width: 50.w, width: 50.w,
height: 50.w, height: 50.w,
image: const AssetImage( image: const AssetImage(
"images/main/icon_lockDetail_monitoringShareVideo_white.png")), 'images/main/icon_lockDetail_monitoringShareVideo_white.png')),
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Container( Container(
@ -156,7 +156,7 @@ class ControlsOverlay extends StatelessWidget {
width: 50.w, width: 50.w,
height: 50.w, height: 50.w,
image: const AssetImage( image: const AssetImage(
"images/main/icon_lockDetail_monitoringDownloadVideo_white.png")), 'images/main/icon_lockDetail_monitoringDownloadVideo_white.png')),
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Container( Container(
@ -167,7 +167,7 @@ class ControlsOverlay extends StatelessWidget {
width: 50.w, width: 50.w,
height: 50.w, height: 50.w,
image: const AssetImage( image: const AssetImage(
"images/main/icon_lockDetail_monitoringDeletVideo_white.png")), 'images/main/icon_lockDetail_monitoringDeletVideo_white.png')),
), ),
], ],
), ),

View File

@ -1,14 +1,16 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLogDetail/videoLogDetail_state.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
import 'package:video_player/video_player.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import 'videoLogDetail_logic.dart'; import 'videoLogDetail_logic.dart';
import 'package:video_player/video_player.dart';
class VideoLogDetailPage extends StatefulWidget { class VideoLogDetailPage extends StatefulWidget {
const VideoLogDetailPage({Key? key}) : super(key: key); const VideoLogDetailPage({Key? key}) : super(key: key);
@ -18,8 +20,8 @@ class VideoLogDetailPage extends StatefulWidget {
} }
class _VideoLogDetailPageState extends State<VideoLogDetailPage> { class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
final logic = Get.put(VideoLogDetailLogic()); final VideoLogDetailLogic logic = Get.put(VideoLogDetailLogic());
final state = Get.find<VideoLogDetailLogic>().state; final VideoLogDetailState state = Get.find<VideoLogDetailLogic>().state;
@override @override
void initState() { void initState() {
@ -42,12 +44,12 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "视频播放".tr, barTitle: '视频播放'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: Column( body: Column(
children: [ children: <Widget>[
AspectRatio( AspectRatio(
aspectRatio: state.videoController.value.aspectRatio, aspectRatio: state.videoController.value.aspectRatio,
child: Stack( child: Stack(
@ -58,10 +60,8 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
controller: state.videoController, controller: state.videoController,
recordData: state.recordData.value, recordData: state.recordData.value,
), ),
(state.videoController.value.isPlaying || if (state.videoController.value.isPlaying ||
state.videoController.value.isBuffering) state.videoController.value.isBuffering) Container() else VideoProgressIndicator(state.videoController,
? Container()
: VideoProgressIndicator(state.videoController,
colors: VideoProgressColors( colors: VideoProgressColors(
playedColor: AppColors.mainColor), playedColor: AppColors.mainColor),
allowScrubbing: true), allowScrubbing: true),
@ -73,9 +73,9 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Row( Row(
children: [ children: <Widget>[
Text( Text(
DateTool().dateToYMDString( DateTool().dateToYMDString(
state.recordData.value.operateDate.toString()), state.recordData.value.operateDate.toString()),
@ -84,7 +84,7 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
), ),
SizedBox(height: 15.h), SizedBox(height: 15.h),
Row( Row(
children: [ children: <Widget>[
videoItem(true, state.recordData.value), videoItem(true, state.recordData.value),
], ],
), ),
@ -93,15 +93,15 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: state.videoLogList.length, itemCount: state.videoLogList.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
CloudStorageData item = state.videoLogList[index]; CloudStorageData item = state.videoLogList[index];
return Column( return Column(
children: [ children: <Widget>[
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w), left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [ child: Row(children: <Widget>[
Text(item.date ?? "", Text(item.date ?? '',
style: TextStyle(fontSize: 20.sp)), style: TextStyle(fontSize: 20.sp)),
])), ])),
mainListView(index, item) mainListView(index, item)
@ -131,8 +131,8 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
); );
} }
var itemW = (1.sw - 15.w * 4) / 3; double itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h; double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
Widget mainListView(int index, CloudStorageData itemData) { Widget mainListView(int index, CloudStorageData itemData) {
return GridView.builder( return GridView.builder(
padding: EdgeInsets.only(left: 15.w, right: 15.w), padding: EdgeInsets.only(left: 15.w, right: 15.w),
@ -148,7 +148,7 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
crossAxisSpacing: 15.w, crossAxisSpacing: 15.w,
// //
childAspectRatio: itemW / itemH), childAspectRatio: itemW / itemH),
itemBuilder: (context, index) { itemBuilder: (BuildContext context, int index) {
return videoItem(false, itemData.recordList![index]); return videoItem(false, itemData.recordList![index]);
}, },
); );
@ -159,12 +159,12 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
width: itemW, width: itemW,
height: itemH, height: itemH,
child: Stack( child: Stack(
children: [ children: <Widget>[
Column( Column(
children: [ children: <Widget>[
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
child: Stack(children: [ child: Stack(children: <Widget>[
Container( Container(
width: itemW, width: itemW,
height: itemW, height: itemW,
@ -175,7 +175,7 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
child: Image( child: Image(
fit: BoxFit.cover, fit: BoxFit.cover,
image: Image.network(itemData.imagesUrl ?? image: Image.network(itemData.imagesUrl ??
"images/icon_video_placeholder.jpg") 'images/icon_video_placeholder.jpg')
.image), .image),
), ),
), ),
@ -197,7 +197,7 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
// padding: EdgeInsets.only(right: 10.w, left: 10.w), // padding: EdgeInsets.only(right: 10.w, left: 10.w),
color: const Color.fromRGBO(0, 0, 0, 0.3), color: const Color.fromRGBO(0, 0, 0, 0.3),
child: Center( child: Center(
child: Text("播放中", child: Text('播放中'.tr,
style: TextStyle( style: TextStyle(
color: Colors.white, fontSize: 22.sp))), color: Colors.white, fontSize: 22.sp))),
)), )),
@ -216,7 +216,7 @@ class _VideoLogDetailPageState extends State<VideoLogDetailPage> {
} }
String formatString(time) { String formatString(time) {
var shortName = time.toString().substring(2, 7); String shortName = time.toString().substring(2, 7);
return shortName; return shortName;
} }

View File

@ -1,8 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
import 'package:star_lock/main/lockDetail/videoLog/videoLogDownLoad/videoLogDownLoad_state.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -18,22 +19,22 @@ class VideoLogDownLoadPage extends StatefulWidget {
} }
class _VideoLogDownLoadPageState extends State<VideoLogDownLoadPage> { class _VideoLogDownLoadPageState extends State<VideoLogDownLoadPage> {
final logic = Get.put(VideoLogDownLoadLogic()); final VideoLogDownLoadLogic logic = Get.put(VideoLogDownLoadLogic());
final state = Get.find<VideoLogDownLoadLogic>().state; final VideoLogDownLoadState state = Get.find<VideoLogDownLoadLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "下载列表".tr, barTitle: '下载列表'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: Container( body: Container(
color: AppColors.greyBackgroundColor, color: AppColors.greyBackgroundColor,
child: Column( child: Column(
children: [ children: <Widget>[
Expanded( Expanded(
child: Obx( child: Obx(
() => state.videoLogDownloadList.isNotEmpty () => state.videoLogDownloadList.isNotEmpty
@ -46,21 +47,21 @@ class _VideoLogDownLoadPageState extends State<VideoLogDownLoadPage> {
); );
} }
var itemW = (1.sw - 15.w * 4) / 3; double itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h; double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
Widget mainListView(List<RecordListData> itemList) { Widget mainListView(List<RecordListData> itemList) {
return ListView.separated( return ListView.separated(
itemCount: itemList.length, itemCount: itemList.length,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (c, index) { separatorBuilder: (BuildContext c, int index) {
return const Divider( return const Divider(
height: 1, height: 1,
color: Colors.transparent, color: Colors.transparent,
); );
}, },
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
RecordListData recordData = itemList[index]; final RecordListData recordData = itemList[index];
return videoItem(recordData, index); return videoItem(recordData, index);
}); });
} }
@ -71,7 +72,7 @@ class _VideoLogDownLoadPageState extends State<VideoLogDownLoadPage> {
EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h), EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h),
color: Colors.white, color: Colors.white,
child: Row( child: Row(
children: [ children: <Widget>[
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
child: Image( child: Image(
@ -79,14 +80,14 @@ class _VideoLogDownLoadPageState extends State<VideoLogDownLoadPage> {
width: 120.w, width: 120.w,
height: 80.w, height: 80.w,
image: Image.network(recordData.imagesUrl ?? image: Image.network(recordData.imagesUrl ??
"images/icon_video_placeholder.jpg") 'images/icon_video_placeholder.jpg')
.image), .image),
), ),
SizedBox(width: 15.w), SizedBox(width: 15.w),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: <Widget>[
Text( Text(
DateTool() DateTool()
.dateToYMDHNString(recordData.operateDate.toString()), .dateToYMDHNString(recordData.operateDate.toString()),

View File

@ -8,21 +8,18 @@ class AboutConsole extends GetxController {
int _clickCount = 0; int _clickCount = 0;
Timer? _timer; Timer? _timer;
void handleTap() async { Future<void> handleTap() async {
_clickCount++; _clickCount++;
if (_clickCount == 1) { if (_clickCount == 1) {
// //
_timer = Timer(const Duration(seconds: 3), () { _timer = Timer(const Duration(seconds: 3), _resetCounter);
// 315
_resetCounter();
});
} }
if (_clickCount >= 15) { if (_clickCount >= 15) {
_timer?.cancel(); _timer?.cancel();
_resetCounter(); _resetCounter();
bool? openDeBug = await Storage.getBool(isOpenDeBug); final bool? openDeBug = await Storage.getBool(isOpenDeBug);
if (openDeBug == true) { if (openDeBug == true) {
DeBug.closeFloatWidget(); DeBug.closeFloatWidget();
await Storage.setBool(isOpenDeBug, false); await Storage.setBool(isOpenDeBug, false);

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -10,7 +11,6 @@ import '../../app_settings/app_colors.dart';
import '../../flavors.dart'; import '../../flavors.dart';
import '../../tools/commonItem.dart'; import '../../tools/commonItem.dart';
import '../../tools/titleAppBar.dart'; import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart';
class AboutPage extends StatefulWidget { class AboutPage extends StatefulWidget {
const AboutPage({Key? key}) : super(key: key); const AboutPage({Key? key}) : super(key: key);

View File

@ -1,3 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:math'; import 'dart:math';
@ -19,10 +20,10 @@ import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
class DebugConsoleController { class DebugConsoleController {
final List<DebugConsoleLog> logs;
final _streamController = BehaviorSubject<List<DebugConsoleLog>>();
DebugConsoleController({List<DebugConsoleLog>? logs}) : logs = logs ?? []; DebugConsoleController({List<DebugConsoleLog>? logs}) : logs = logs ?? [];
final List<DebugConsoleLog> logs;
final BehaviorSubject<List<DebugConsoleLog>> _streamController = BehaviorSubject<List<DebugConsoleLog>>();
Stream<List<DebugConsoleLog>> get stream => _streamController.stream; Stream<List<DebugConsoleLog>> get stream => _streamController.stream;
@ -54,53 +55,53 @@ class DebugConsoleController {
notifyUpdate(); notifyUpdate();
} }
void showMore(BuildContext context) { // void showMore(BuildContext context) {
showBottomSheet( // showBottomSheet(
context: context, // context: context,
builder: (context) { // builder: (context) {
return Container( // return Container(
decoration: BoxDecoration( // decoration: BoxDecoration(
color: Colors.white, // color: Colors.white,
border: Border.all(width: 1, color: AppColors.btnDisableColor), // border: Border.all(width: 1, color: AppColors.btnDisableColor),
borderRadius: BorderRadius.circular(30.w), // borderRadius: BorderRadius.circular(30.w),
), // ),
height: Get.height * 0.7, // height: Get.height * 0.7,
width: Get.width, // width: Get.width,
padding: EdgeInsets.all(16.w), // padding: EdgeInsets.all(16.w),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
const Text('辅助测试的按钮'), // const Text('辅助测试的按钮'),
SizedBox( // SizedBox(
height: 25.h, // height: 25.h,
), // ),
Expanded( // Expanded(
child: Wrap( // child: Wrap(
children: [ // children: [
ElevatedButton( // ElevatedButton(
onPressed: () { // onPressed: () {
EasyLoading.show(); // EasyLoading.show();
randomlyCreate32Users(0, 33) // randomlyCreate32Users(0, 33)
.then((value) => EasyLoading.dismiss()) // .then((value) => EasyLoading.dismiss())
.catchError(EasyLoading.dismiss); // .catchError(EasyLoading.dismiss);
}, // },
child: const Text('给锁设备创建 32个用户')), // child: const Text('给锁设备创建 32个用户')),
ElevatedButton( // ElevatedButton(
onPressed: () { // onPressed: () {
EasyLoading.show(); // EasyLoading.show();
sendCleanUpUsers() // sendCleanUpUsers()
.then((value) => EasyLoading.dismiss()) // .then((value) => EasyLoading.dismiss())
.catchError(EasyLoading.dismiss); // .catchError(EasyLoading.dismiss);
}, // },
child: const Text('清除用户,只保留超级管理员')), // child: const Text('清除用户,只保留超级管理员')),
], // ],
), // ),
), // ),
], // ],
), // ),
); // );
}); // });
} // }
// 32 // 32
Future<void> randomlyCreate32Users(int count, int max) async { Future<void> randomlyCreate32Users(int count, int max) async {

View File

@ -317,7 +317,9 @@ class _DebugConsoleState extends State<DebugConsole> {
child: const Text('清除日志'), child: const Text('清除日志'),
), ),
PopupMenuItem( PopupMenuItem(
onTap: () => widget.controller.showMore(context), onTap: () {
// widget.controller.showMore(context);
},
child: const Text('更多'), child: const Text('更多'),
), ),
], ],

View File

@ -15,13 +15,13 @@ class DeBug {
static late OverlayEntry overlayEntry; static late OverlayEntry overlayEntry;
static void showFloatWidget() { static void showFloatWidget() {
Rx<Offset> offset = Offset(20, 100).obs; // final Rx<Offset> offset = const Offset(20, 100).obs; //
overlayEntry = OverlayEntry(builder: (context) { overlayEntry = OverlayEntry(builder: (BuildContext context) {
return Obx(() => Positioned( return Obx(() => Positioned(
left: offset.value.dx, left: offset.value.dx,
top: offset.value.dy, top: offset.value.dy,
child: GestureDetector( child: GestureDetector(
onPanUpdate: (details) { onPanUpdate: (DragUpdateDetails details) {
offset.value += details.delta; offset.value += details.delta;
}, },
child: FloatingActionButton( child: FloatingActionButton(
@ -51,7 +51,7 @@ class DeBug {
}, },
child: DebugConsole( child: DebugConsole(
controller: DebugConsole.instance, controller: DebugConsole.instance,
actions: [], actions: <PopupMenuItem<void>>[],
expandStackTrace: false, expandStackTrace: false,
savePath: null, savePath: null,
), ),

View File

@ -1,3 +1,4 @@
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -8,10 +9,10 @@ import 'package:star_lock/mine/about/debug/debug_tool.dart';
import 'package:star_lock/mine/about/debug/log.dart'; import 'package:star_lock/mine/about/debug/log.dart';
class DebugConsoleTile extends StatefulWidget { class DebugConsoleTile extends StatefulWidget {
final DebugConsoleLog log;
final bool expanded;
const DebugConsoleTile(this.log, {key, this.expanded = false}); const DebugConsoleTile(this.log, {key, this.expanded = false});
final DebugConsoleLog log;
final bool expanded;
@override @override
State<DebugConsoleTile> createState() => _DebugConsoleTileState(); State<DebugConsoleTile> createState() => _DebugConsoleTileState();
@ -101,9 +102,9 @@ class _DebugConsoleTileState extends State<DebugConsoleTile> {
} }
class DeBugText extends StatefulWidget { class DeBugText extends StatefulWidget {
final DebugConsoleLog log;
DeBugText(this.log, {key}); DeBugText(this.log, {key});
final DebugConsoleLog log;
@override @override
State<DeBugText> createState() => _DeBugTextState(); State<DeBugText> createState() => _DeBugTextState();
@ -114,13 +115,13 @@ class _DeBugTextState extends State<DeBugText> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('详细日志'), title: Text('详细日志'.tr),
), ),
body: SafeArea( body: SafeArea(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Clipboard.setData(ClipboardData(text: widget.log.message)); Clipboard.setData(ClipboardData(text: widget.log.message));
EasyLoading.showToast('已复制到剪切板'); EasyLoading.showToast('已复制到剪切板'.tr);
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(

View File

@ -116,7 +116,7 @@ class _AddLockSelectCountryPageState extends State<AddLockSelectCountryPage> {
children: [ children: [
TextButton( TextButton(
child: Text( child: Text(
'跳过', '跳过'.tr,
style: TextStyle(color: Colors.black, fontSize: 24.sp), style: TextStyle(color: Colors.black, fontSize: 24.sp),
), ),
onPressed: () { onPressed: () {
@ -138,7 +138,7 @@ class _AddLockSelectCountryPageState extends State<AddLockSelectCountryPage> {
), ),
onPressed: () { onPressed: () {
if(selectindex == 10000){ if(selectindex == 10000){
logic.showToast('请选择国家'); logic.showToast('请选择国家'.tr);
return; return;
} }
final CountryRegionModel model = countriesList[selectindex]; final CountryRegionModel model = countriesList[selectindex];

View File

@ -56,14 +56,12 @@ class LockAddressGaoDeLogic extends BaseGetXController{
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
} }
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// AMapFlutterLocation.updatePrivacyAgree(true); // AMapFlutterLocation.updatePrivacyAgree(true);
@ -75,7 +73,6 @@ class LockAddressGaoDeLogic extends BaseGetXController{
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
} }

View File

@ -1,3 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
@ -18,7 +19,6 @@ import '../../../../blue/blue_manage.dart';
import '../../../../flavors.dart'; import '../../../../flavors.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'lockAddressGaoDe_logic.dart'; import 'lockAddressGaoDe_logic.dart';
class LockAddressGaoDePage extends StatefulWidget { class LockAddressGaoDePage extends StatefulWidget {
@ -330,7 +330,6 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///

View File

@ -35,7 +35,7 @@ class _LockAddressPageState extends State<LockAddressPage> with RouteAware{
), ),
onPressed: () { onPressed: () {
if(addressInfo!.isEmpty){ if(addressInfo!.isEmpty){
EasyLoading.showToast('请先获取到位置信息哦!', duration: 2000.milliseconds); EasyLoading.showToast('请先获取到位置信息哦'.tr, duration: 2000.milliseconds);
return; return;
} }
Get.toNamed(Routers.saveLockPage, arguments: addressInfo); Get.toNamed(Routers.saveLockPage, arguments: addressInfo);

View File

@ -44,7 +44,7 @@ class NearbyLockLogic extends BaseGetXController {
// //
void connect(String deviceName) { void connect(String deviceName) {
showTitleEasyLoading('获取锁信息 1/3'); showTitleEasyLoading('${'获取锁信息'.tr} 1/3');
showBlueConnetctToastTimer(action: () { showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); dismissEasyLoading();
}); });
@ -52,7 +52,7 @@ class NearbyLockLogic extends BaseGetXController {
(BluetoothConnectionState state) async { (BluetoothConnectionState state) async {
// AppLog.log('点击要添加的设备了'); // AppLog.log('点击要添加的设备了');
if (state == BluetoothConnectionState.connected) { if (state == BluetoothConnectionState.connected) {
AppLog.log('开始获取公钥'); // AppLog.log('开始获取公钥');
IoSenderManage.getPublicKey(lockId: deviceName); IoSenderManage.getPublicKey(lockId: deviceName);
} else if (state == BluetoothConnectionState.disconnected) { } else if (state == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
@ -100,15 +100,15 @@ class NearbyLockLogic extends BaseGetXController {
switch (reply.status) { switch (reply.status) {
case 0x00: case 0x00:
// //
AppLog.log('获取公钥成功'); // AppLog.log('获取公钥成功');
// //
final List<int> publicKey = reply.data.sublist(3); final List<int> publicKey = reply.data.sublist(3);
final List<String> saveStrList = changeIntListToStringList(publicKey); final List<String> saveStrList = changeIntListToStringList(publicKey);
Storage.setStringList(saveBluePublicKey, saveStrList); Storage.setStringList(saveBluePublicKey, saveStrList);
// //
AppLog.log('开始获取私钥'); // AppLog.log('开始获取私钥');
showTitleEasyLoading('获取锁信息 2/3'); showTitleEasyLoading('${'获取锁信息'.tr} 2/3');
IoSenderManage.getPrivateKey( IoSenderManage.getPrivateKey(
lockId: BlueManage().connectDeviceName, lockId: BlueManage().connectDeviceName,
keyID: '1', keyID: '1',
@ -126,7 +126,7 @@ class NearbyLockLogic extends BaseGetXController {
Future<void> _replyGetPrivateKeyKey(Reply reply) async { Future<void> _replyGetPrivateKeyKey(Reply reply) async {
switch (reply.status) { switch (reply.status) {
case 0x00: case 0x00:
AppLog.log('获取私钥成功'); // AppLog.log('获取私钥成功');
// //
reply.data.removeAt(0); reply.data.removeAt(0);
@ -147,7 +147,7 @@ class NearbyLockLogic extends BaseGetXController {
(0xff & timestamp[1]) << 16 | (0xff & timestamp[1]) << 16 |
(0xff & timestamp[2]) << 8 | (0xff & timestamp[2]) << 8 |
(0xFF & timestamp[3]); (0xFF & timestamp[3]);
showTitleEasyLoading('获取锁信息 3/3'); showTitleEasyLoading('${'获取锁信息'.tr} 3/3');
_getStarLockStatus(); _getStarLockStatus();
break; break;
default: default:
@ -161,7 +161,7 @@ class NearbyLockLogic extends BaseGetXController {
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
AppLog.log('获取锁状态成功'); // AppLog.log('获取锁状态成功');
// //
int index = 3; int index = 3;
final List<int> vendor = reply.data.sublist(index, index + 20); final List<int> vendor = reply.data.sublist(index, index + 20);
@ -169,13 +169,13 @@ class NearbyLockLogic extends BaseGetXController {
state.lockInfo['vendor'] = vendorStr; state.lockInfo['vendor'] = vendorStr;
// state.lockInfo["vendor"] = "XL"; // state.lockInfo["vendor"] = "XL";
index = index + 20; index = index + 20;
AppLog.log('厂商名称 vendorStr:$vendorStr'); // AppLog.log('厂商名称 vendorStr:$vendorStr');
// //
final int product = reply.data[index]; final int product = reply.data[index];
state.lockInfo['product'] = product; state.lockInfo['product'] = product;
index = index + 1; index = index + 1;
AppLog.log('锁设备类型 product:$product'); // AppLog.log('锁设备类型 product:$product');
// //
final List<int> model = reply.data.sublist(index, index + 20); final List<int> model = reply.data.sublist(index, index + 20);
@ -183,21 +183,21 @@ class NearbyLockLogic extends BaseGetXController {
state.lockInfo['model'] = modelStr; state.lockInfo['model'] = modelStr;
// state.lockInfo["model"] = "JL-BLE-01"; // state.lockInfo["model"] = "JL-BLE-01";
index = index + 20; index = index + 20;
AppLog.log('产品名称 mmodelStr:$modelStr'); // AppLog.log('产品名称 mmodelStr:$modelStr');
// //
final List<int> fwVersion = reply.data.sublist(index, index + 20); final List<int> fwVersion = reply.data.sublist(index, index + 20);
final String fwVersionStr = utf8String(fwVersion); final String fwVersionStr = utf8String(fwVersion);
state.lockInfo['fwVersion'] = fwVersionStr; state.lockInfo['fwVersion'] = fwVersionStr;
index = index + 20; index = index + 20;
AppLog.log('软件版本 fwVersionStr:$fwVersionStr'); // AppLog.log('软件版本 fwVersionStr:$fwVersionStr');
// //
final List<int> hwVersion = reply.data.sublist(index, index + 20); final List<int> hwVersion = reply.data.sublist(index, index + 20);
final String hwVersionStr = utf8String(hwVersion); final String hwVersionStr = utf8String(hwVersion);
state.lockInfo['hwVersion'] = hwVersionStr; state.lockInfo['hwVersion'] = hwVersionStr;
index = index + 20; index = index + 20;
AppLog.log('硬件版本 hwVersionStr:$hwVersionStr'); // AppLog.log('硬件版本 hwVersionStr:$hwVersionStr');
// //
final List<int> serialNum0 = reply.data.sublist(index, index + 16); final List<int> serialNum0 = reply.data.sublist(index, index + 16);
@ -212,34 +212,32 @@ class NearbyLockLogic extends BaseGetXController {
final String serialNum1Str = utf8String(serialNum1); final String serialNum1Str = utf8String(serialNum1);
state.lockInfo['serialNum1'] = serialNum1Str; state.lockInfo['serialNum1'] = serialNum1Str;
index = index + 16; index = index + 16;
AppLog.log('成品商序列号 serialNum1Str:$serialNum1Str'); // AppLog.log('成品商序列号 serialNum1Str:$serialNum1Str');
// //
final List<int> btDeviceName = reply.data.sublist(index, index + 16); final List<int> btDeviceName = reply.data.sublist(index, index + 16);
final String btDeviceNameStr = utf8String(btDeviceName); final String btDeviceNameStr = utf8String(btDeviceName);
state.lockInfo['btDeviceName'] = btDeviceNameStr; state.lockInfo['btDeviceName'] = btDeviceNameStr;
index = index + 16; index = index + 16;
AppLog.log('蓝牙名称 btDeviceNameStr:$btDeviceNameStr'); // AppLog.log('蓝牙名称 btDeviceNameStr:$btDeviceNameStr');
// //
final int battRemCap = reply.data[index]; final int battRemCap = reply.data[index];
state.lockInfo['electricQuantity'] = battRemCap; state.lockInfo['electricQuantity'] = battRemCap;
index = index + 1; index = index + 1;
AppLog.log('电池剩余电量 battRemCap:$battRemCap'); // AppLog.log('电池剩余电量 battRemCap:$battRemCap');
// //
final int battRemCapStandby = reply.data[index]; final int battRemCapStandby = reply.data[index];
state.lockInfo['electricQuantityStandby'] = battRemCapStandby; state.lockInfo['electricQuantityStandby'] = battRemCapStandby;
index = index + 1; index = index + 1;
AppLog.log('电池剩余电量 battRemCap:$battRemCap'); // AppLog.log('电池剩余电量 battRemCap:$battRemCap');
// //
final List<int> restoreCounter = reply.data.sublist(index, index + 2); final List<int> restoreCounter = reply.data.sublist(index, index + 2);
state.lockInfo['restoreCount'] = state.lockInfo['restoreCount'] = restoreCounter[0] * 256 + restoreCounter[1];
restoreCounter[0] * 256 + restoreCounter[1];
index = index + 2; index = index + 2;
AppLog.log( // AppLog.log('重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}');
'重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}');
// //
final List<int> restoreDate = reply.data.sublist(index, index + 4); final List<int> restoreDate = reply.data.sublist(index, index + 4);
@ -250,14 +248,14 @@ class NearbyLockLogic extends BaseGetXController {
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); // String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
state.lockInfo['restoreDate'] = restoreDateValue * 1000; state.lockInfo['restoreDate'] = restoreDateValue * 1000;
index = index + 4; index = index + 4;
AppLog.log('重置时间 restoreDateValue:$restoreDateValue'); // AppLog.log('重置时间 restoreDateValue:$restoreDateValue');
// //
final List<int> icPartNo = reply.data.sublist(index, index + 10); final List<int> icPartNo = reply.data.sublist(index, index + 10);
final String icPartNoStr = utf8String(icPartNo); final String icPartNoStr = utf8String(icPartNo);
state.lockInfo['icPartNo'] = icPartNoStr; state.lockInfo['icPartNo'] = icPartNoStr;
index = index + 10; index = index + 10;
AppLog.log('主控芯片型号 icPartNoStr:$icPartNoStr'); // AppLog.log('主控芯片型号 icPartNoStr:$icPartNoStr');
// //
final List<int> indate = reply.data.sublist(index, index + 4); final List<int> indate = reply.data.sublist(index, index + 4);
@ -268,18 +266,17 @@ class NearbyLockLogic extends BaseGetXController {
// String indateStr = DateTool().dateToYMDHNSString("$indateValue"); // String indateStr = DateTool().dateToYMDHNSString("$indateValue");
state.lockInfo['indate'] = indateValue * 1000; state.lockInfo['indate'] = indateValue * 1000;
index = index + 4; index = index + 4;
AppLog.log('有效时间 indateValue:$indateValue'); // AppLog.log('有效时间 indateValue:$indateValue');
// mac地址 // mac地址
final List<int> macAddress = reply.data.sublist(index, index + 20); final List<int> macAddress = reply.data.sublist(index, index + 20);
final String macAddressStr = utf8String(macAddress); final String macAddressStr = utf8String(macAddress);
state.lockInfo['mac'] = macAddressStr; state.lockInfo['mac'] = macAddressStr;
index = index + 20; index = index + 20;
AppLog.log('mac地址 macAddressStr:$macAddressStr'); // AppLog.log('mac地址 macAddressStr:$macAddressStr');
// //
state.lockInfo['timezoneOffset'] = state.lockInfo['timezoneOffset'] = DateTime.now().timeZoneOffset.inSeconds;
DateTime.now().timeZoneOffset.inSeconds;
// //
final int featureValueLength = reply.data[index]; final int featureValueLength = reply.data[index];
@ -290,7 +287,7 @@ class NearbyLockLogic extends BaseGetXController {
// //
final int featureNetxLength = index + featureValueLength; final int featureNetxLength = index + featureValueLength;
if (reply.data.length < featureNetxLength) { if (reply.data.length < featureNetxLength) {
showToast('锁数据异常,请重试'); showToast('锁数据异常,请重试'.tr);
return; return;
} }
final List<int> featureValue = final List<int> featureValue =
@ -310,7 +307,7 @@ class NearbyLockLogic extends BaseGetXController {
// 使() // 使()
final int featureEnNextLength = index + featureEnValLength; final int featureEnNextLength = index + featureEnValLength;
if (reply.data.length < featureEnNextLength) { if (reply.data.length < featureEnNextLength) {
showToast('锁数据异常,请重试'); showToast('锁数据异常,请重试'.tr);
return; return;
} }
final List<int> featureEnVal = final List<int> featureEnVal =
@ -366,7 +363,7 @@ class NearbyLockLogic extends BaseGetXController {
// if (state == BluetoothConnectionState.connected) { // if (state == BluetoothConnectionState.connected) {
// dismissEasyLoading(); // dismissEasyLoading();
AppLog.log('开始获取锁状态'); // AppLog.log('开始获取锁状态');
final List<String>? privateKey = final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -378,9 +375,9 @@ class NearbyLockLogic extends BaseGetXController {
DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000), DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000),
<String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]); <String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
AppLog.log('state.serverTime:${state.serverTime} getUTCDate:$getUTCDate ' // AppLog.log('state.serverTime:${state.serverTime} getUTCDate:$getUTCDate '
'getLocalTime:${getLocalTime()} getLocalDate:$getLocalDate ' // 'getLocalTime:${getLocalTime()} getLocalDate:$getLocalDate '
'差值:${getLocalTime() - state.serverTime}'); // '差值:${getLocalTime() - state.serverTime}');
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
@ -414,17 +411,17 @@ class NearbyLockLogic extends BaseGetXController {
// , ota // , ota
void oTAUpgrade(String deviceName) { void oTAUpgrade(String deviceName) {
showTitleEasyLoading('连接设备中...'); showTitleEasyLoading('连接设备中...'.tr);
this.deviceName = deviceName; this.deviceName = deviceName;
BlueManage().blueSendData(deviceName, BlueManage().blueSendData(deviceName,
(BluetoothConnectionState state) async { (BluetoothConnectionState state) async {
AppLog.log('连接设备'); // AppLog.log('连接设备');
if (state == BluetoothConnectionState.connected) { if (state == BluetoothConnectionState.connected) {
AppLog.log('连接成功'); // AppLog.log('连接成功');
dismissEasyLoading(); dismissEasyLoading();
otaUpdate(); otaUpdate();
} else if (state == BluetoothConnectionState.disconnected) { } else if (state == BluetoothConnectionState.disconnected) {
AppLog.log('连接失败'); // AppLog.log('连接失败');
dismissEasyLoading(); dismissEasyLoading();
} }
}, isAddEquipment: true); }, isAddEquipment: true);
@ -498,10 +495,9 @@ class NearbyLockLogic extends BaseGetXController {
} }
if (otaCount <= otaIndex) { if (otaCount <= otaIndex) {
final int now = DateTime.now().millisecondsSinceEpoch; final int now = DateTime.now().millisecondsSinceEpoch;
final String msg = // final String msg = '传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
closeOTADAta(); closeOTADAta();
AppLog.log(msg); AppLog.log('传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ');
// showToast(msg); // showToast(msg);
return; return;
} }

Some files were not shown because too many files have changed in this diff Show More