添加项目中未国际化字段到类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",
"门锁时间异常": "Door lock time abnormal",
"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(手机)未联网",
"数据不存在": "数据不存在"
"数据不存在": "数据不存在",
"待接收": "待接收",
"已冻结": "已冻结",
"已删除": "已删除",
"未知": "未知",
"拖动下方滑块完成拼图": "拖动下方滑块完成拼图",
"验证成功": "验证成功",
"验证失败": "验证失败",
"向右拖动滑块填充拼图": "向右拖动滑块填充拼图",
"请先获取到位置信息哦": "请先获取到位置信息哦",
"请选择国家": "请选择国家",
"获取锁信息": "获取锁信息",
"锁数据异常,请重试": "锁数据异常,请重试",
"连接设备中...": "连接设备中...",
"把锁": "把锁",
"条": "条",
"封": "封",
"次": "次",
"支付成功": "支付成功",
"查看详情": "查看详情",
"请输入模板名称": "请输入模板名称",
"模版类型": "模版类型",
"再返回一次退出": "再返回一次退出",
"请先添加锁": "请先添加锁",
"可视对讲": "可视对讲",
"详细日志": "详细日志",
"已复制到剪切板": "已复制到剪切板",
"拍照": "拍照",
"从相册选择": "从相册选择",
"选择问题": "选择问题",
"确认长度不足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(手机)未联网",
"数据不存在": "数据不存在"
"数据不存在": "数据不存在",
"待接收": "待接收",
"已冻结": "已冻结",
"已删除": "已删除",
"未知": "未知",
"拖动下方滑块完成拼图": "拖动下方滑块完成拼图",
"验证成功": "验证成功",
"验证失败": "验证失败",
"向右拖动滑块填充拼图": "向右拖动滑块填充拼图",
"请先获取到位置信息哦": "请先获取到位置信息哦",
"请选择国家": "请选择国家",
"获取锁信息": "获取锁信息",
"锁数据异常,请重试": "锁数据异常,请重试",
"连接设备中...": "连接设备中...",
"把锁": "把锁",
"条": "条",
"封": "封",
"次": "次",
"支付成功": "支付成功",
"查看详情": "查看详情",
"请输入模板名称": "请输入模板名称",
"模版类型": "模版类型",
"再返回一次退出": "再返回一次退出",
"请先添加锁": "请先添加锁",
"可视对讲": "可视对讲",
"详细日志": "详细日志",
"已复制到剪切板": "已复制到剪切板",
"拍照": "拍照",
"从相册选择": "从相册选择",
"选择问题": "选择问题",
"确认长度不足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 'package:device_info_plus/device_info_plus.dart';
import 'package:get/get.dart';
import '../../flavors.dart';
@ -46,19 +47,19 @@ class XSConstantMacro {
// 使
return '';
case 110402:
return '待接收';
return '待接收'.tr;
case 110403:
return '未生效';
return '未生效'.tr;
case 110405:
return '已冻结';
return '已冻结'.tr;
case 110408:
return '已删除';
return '已删除'.tr;
// case 110410:
// return "已重置";
case 110412:
return '已过期';
return '已过期'.tr;
default:
return '未知';
return '未知'.tr;
}
}

View File

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

View File

@ -229,40 +229,6 @@ class CardListLogic extends BaseGetXController {
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
Future<void> onReady() async {
super.onReady();
@ -274,8 +240,6 @@ class CardListLogic extends BaseGetXController {
_initRefreshAction();
}
// signBlue();
}
@override

View File

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

View File

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

View File

@ -3,33 +3,7 @@ import 'package:get/get.dart';
import '../../../../tools/commonDataManage.dart';
class AddFaceState {
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
class AddFaceState { // 0 1 2
AddFaceState() {
Map map = Get.arguments;
@ -56,4 +30,30 @@ class AddFaceState {
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:
//
state.ifAddState.value = false;
showToast('添加指纹失败', something: (){
showToast('添加指纹失败'.tr, something: (){
Get.back();
});
break;

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.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/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,19 +3,18 @@ import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart';
class BurglarAlarmState{
var lockSetInfoData = LockSetInfoData().obs;
var burglarAlarmEnable = 0.obs;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
class BurglarAlarmState{// 0() 1()
BurglarAlarmState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockSetInfoData.value = map['lockSetInfoData'];
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/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart';
@ -8,7 +9,7 @@ class CatEyeCustomModeLogic extends BaseGetXController {
//
Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
@ -19,9 +20,9 @@ class CatEyeCustomModeLogic extends BaseGetXController {
if (state.catEyeConfigData.value.catEyeModeConfig != null) {
if (state.catEyeConfigData.value.catEyeModeConfig!.recordMode == 1) {
state.selectVideoSlot.value = '自定义时段';
state.selectVideoSlot.value = '自定义时段'.tr;
} else {
state.selectVideoSlot.value = '全天';
state.selectVideoSlot.value = '全天'.tr;
}
state.recordTime.value =
@ -31,8 +32,8 @@ class CatEyeCustomModeLogic extends BaseGetXController {
'';
state.realTimeMode.value =
state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode == 0
? '发生事件时查看'
: '实时查看';
? '发生事件时查看'.tr
: '实时查看'.tr;
}
}
}
@ -67,7 +68,7 @@ class CatEyeCustomModeLogic extends BaseGetXController {
],
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
showToast('设置成功'.tr);
}
}
}

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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/custom_bottom_sheet.dart';
import 'package:star_lock/tools/titleAppBar.dart';
import 'package:star_lock/translations/trans_lib.dart';
class CatEyeCustomModePage extends StatefulWidget {
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, () {
_openBottomItemSheet(state.showsUpVideoList.value, 0);
}),
SizedBox(
height: 30.h,
),
_buildSubTitleItem('人体侦测距离', '有人出现在门前1.5米范围时启动录像',
_buildSubTitleItem('人体侦测距离'.tr, '有人出现在门前1.5米范围时启动录像'.tr,
state.detectionDistance.value, () {
_openBottomItemSheet(state.detectionRangeList.value, 1);
}),
@ -82,7 +82,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
Container(
margin: EdgeInsets.only(left: 20.w),
child: CommonItem(
leftTitel: '实时画面',
leftTitel: '实时画面'.tr,
rightTitle: state.realTimeMode.value,
isHaveLine: false,
isHaveDirection: true,

View File

@ -23,15 +23,15 @@ class CatEyeCustomModeState { //实时画面 0发生事件事查看 1实时查
// var showsUpVideo = '10${TranslationLoader.lanKeys!.second!.tr}'.obs; //
// var detectionRange = '约1.5米'.obs; //
RxList<String> showsUpVideoList = <String>[
'不录像',
'立即录像',
'不录像'.tr,
'立即录像'.tr,
'5${"".tr}',
'10${"".tr}',
'15${"".tr}',
'30${"".tr}',
'60${"".tr}'
].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(
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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
import 'catEyeSet_state.dart';
@ -10,8 +11,8 @@ class CatEyeSetLogic extends BaseGetXController {
final CatEyeSetState state = CatEyeSetState();
//
void updateAutoLightScreenConfig() async {
var entity = await ApiRepository.to.updateAutoLightScreenConfig(
Future<void> updateAutoLightScreenConfig() async {
final VersionUndateEntity entity = await ApiRepository.to.updateAutoLightScreenConfig(
lockId: state.lockSetInfoData.value.lockId!,
autoLightScreen: state.isAutoBright.value == true ? 1 : 0,
);
@ -21,8 +22,8 @@ class CatEyeSetLogic extends BaseGetXController {
}
//
void updateLightScreenTimeConfig() async {
var entity = await ApiRepository.to.updateLightScreenTimeConfig(
Future<void> updateLightScreenTimeConfig() async {
final VersionUndateEntity entity = await ApiRepository.to.updateLightScreenTimeConfig(
lockId: state.lockSetInfoData.value.lockId!,
autoLightScreenTime:
int.parse(state.selectBrightDuration.value.replaceAll(''.tr, '')),
@ -33,8 +34,8 @@ class CatEyeSetLogic extends BaseGetXController {
}
//
void updateStayWarnConfig() async {
var entity = await ApiRepository.to.updateStayWarnConfig(
Future<void> updateStayWarnConfig() async {
final VersionUndateEntity entity = await ApiRepository.to.updateStayWarnConfig(
lockId: state.lockSetInfoData.value.lockId!,
stayWarn: state.isStayWarning.value == true ? 1 : 0,
);
@ -44,8 +45,8 @@ class CatEyeSetLogic extends BaseGetXController {
}
//
void updateAbnormalWarnConfig() async {
var entity = await ApiRepository.to.updateAbnormalWarnConfig(
Future<void> updateAbnormalWarnConfig() async {
final VersionUndateEntity entity = await ApiRepository.to.updateAbnormalWarnConfig(
lockId: state.lockSetInfoData.value.lockId!,
abnormalWarn: state.isExceptionWarning.value == true ? 1 : 0,
);
@ -56,25 +57,34 @@ class CatEyeSetLogic extends BaseGetXController {
//
Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!;
state.selectBrightDuration.value =
'${state.lockSetInfoData.value.lockSettingInfo!.autoLightScreenTime}'; //
state.isAutoBright.value =
state.lockSetInfoData.value.lockSettingInfo!.autoLightScreen == 0
? false
: true; //
state.isStayWarning.value =
state.lockSetInfoData.value.lockSettingInfo!.stayWarn == 0
? false
: true; //
state.isExceptionWarning.value =
state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn == 0
? false
: true; //
state.selectBrightDuration.value = '${state.lockSetInfoData.value.lockSettingInfo!.autoLightScreenTime}${''.tr}'; //
if (state.lockSetInfoData.value.lockSettingInfo!.autoLightScreen == 0) {
state.isAutoBright.value = false;
} else {
state.isAutoBright.value = true;
}
//
if (state.lockSetInfoData.value.lockSettingInfo!.stayWarn == 0) {
state.isStayWarning.value = false;
} else {
state.isStayWarning.value = true;
}
//
if (state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn == 0) {
state.isExceptionWarning.value = false;
} else {
state.isExceptionWarning.value = true;
}
//
state.selectCatEyeWorkMode.value = ''; //
// 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: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_state.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart';
@ -18,8 +19,8 @@ class CatEyeSetPage extends StatefulWidget {
}
class _CatEyeSetPageState extends State<CatEyeSetPage> {
final logic = Get.put(CatEyeSetLogic());
final state = Get.find<CatEyeSetLogic>().state;
final CatEyeSetLogic logic = Get.put(CatEyeSetLogic());
final CatEyeSetState state = Get.find<CatEyeSetLogic>().state;
@override
void initState() {
@ -37,7 +38,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
children: <Widget>[
Obx(() => CommonItem(
leftTitel: '猫眼工作模式'.tr,
rightTitle: state.selectCatEyeWorkMode.value,
@ -46,20 +47,20 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.catEyeWorkModePage,
arguments: {
arguments: <String, Object?>{
'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0]
: null
}).then((value) {
}).then((Object? value) {
logic.getLockSettingInfoData();
});
})),
Obx(() => CommonItem(
leftTitel: '自动亮屏'.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
@ -74,14 +75,14 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
})),
Obx(() => CommonItem(
leftTitel: '逗留警告'.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _otherToDoSwitch(2),
)),
Obx(() => CommonItem(
leftTitel: '异常警告'.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _otherToDoSwitch(3))),
@ -108,7 +109,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: isCheck,
onChanged: (value) {
onChanged: (bool value) {
switch (clickIndex) {
case 1: //
{
@ -144,7 +145,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
return AlertBottomWidget(
topTitle: '',
items: state.brightDurationTimeList,
chooseCallback: (value) {
chooseCallback: (int value) {
state.selectBrightDuration.value =
state.brightDurationTimeList[value];
logic.updateLightScreenTimeConfig();

View File

@ -1,24 +1,17 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
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() {
Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockSetInfoData.value = map['lockSetInfoData'];
if (lockSetInfoData.value != null &&
lockSetInfoData.value.lockSettingInfo != null) {
selectBrightDuration.value =
'${lockSetInfoData.value.lockSettingInfo?.autoLightScreenTime} ';
'${lockSetInfoData.value.lockSettingInfo?.autoLightScreenTime} ${''.tr}';
if (lockSetInfoData.value.lockSettingInfo?.autoLightScreen == 1) {
isAutoBright.value = true;
} 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/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
class CatEyeWorkModeLogic extends BaseGetXController {
final CatEyeWorkModeState state = CatEyeWorkModeState();
//
void updateCatEyeModeConfig() async {
var entity = await ApiRepository.to.updateCatEyeModeConfig(
Future<void> updateCatEyeModeConfig() async {
final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [
{
<String, Object>{
'catEyeMode':
state.boolList.indexWhere((element) => element == true) + 1,
'catEyeModeConfig': {
state.boolList.indexWhere((bool element) => element == true) + 1,
'catEyeModeConfig': <String, Object?>{
'recordMode': state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig!.isNotEmpty
? state.catEyeConfigData.value.catEyeModeConfig?.recordMode
@ -46,14 +48,14 @@ class CatEyeWorkModeLogic extends BaseGetXController {
],
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
showToast('设置成功'.tr);
getLockSettingInfoData();
}
}
//
void getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
Future<void> getLockSettingInfoData() async {
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
@ -65,16 +67,16 @@ class CatEyeWorkModeLogic extends BaseGetXController {
if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModePowerSaving) {
state.boolList.value = [true, false, false, false];
state.boolList.value = <bool>[true, false, false, false];
} else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeStayCapture) {
state.boolList.value = [false, true, false, false];
state.boolList.value = <bool>[false, true, false, false];
} else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeRealTimeMonitoring) {
state.boolList.value = [false, false, true, false];
state.boolList.value = <bool>[false, false, true, false];
} else if (state.catEyeConfigData.value.catEyeMode ==
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_screenutil/flutter_screenutil.dart';
import 'package:get/get.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_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
@ -15,8 +18,8 @@ class CatEyeWorkModePage extends StatefulWidget {
}
class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
final logic = Get.put(CatEyeWorkModeLogic());
final state = Get.find<CatEyeWorkModeLogic>().state;
final CatEyeWorkModeLogic logic = Get.put(CatEyeWorkModeLogic());
final CatEyeWorkModeState state = Get.find<CatEyeWorkModeLogic>().state;
@override
initState() {
@ -29,36 +32,38 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: '猫眼工作模式',
barTitle: '猫眼工作模式'.tr,
haveBack: true,
backAction: () {
Navigator.pop(context, true);
},
backgroundColor: AppColors.mainColor),
body: Obx(() => Column(
children: [
SizedBox(
height: 30.h,
),
_buildTipsView('省电模式:\n',
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', 0),
SizedBox(
height: 30.h,
),
_buildTipsView('逗留抓拍模式:\n',
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。', 1),
children: <Widget>[
SizedBox(
height: 30.h,
),
_buildTipsView(
'实时监控模式:\n',
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。',
'省电模式'.tr + '\n',
'适合门口较为安全的环境。'.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),
SizedBox(
height: 30.h,
),
_buildTipsView(
'自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3)
'自定义模式'.tr + '\n', '根据您家门口实际情况设置录像和实时画面功能。'.tr + '\n' + '可使用时长由具体设置决定。'.tr, 3)
],
)));
}
@ -78,14 +83,12 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row(
children: [
state.boolList.value[clickIndex]
? Image.asset(
children: <Widget>[
if (state.boolList.value[clickIndex]) Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
)
: SizedBox(
) else SizedBox(
width: 20.w,
height: 14.w,
),
@ -109,7 +112,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
),
child: Center(
child: Text(
clickIndex == 3 ? '设置' : '查看',
clickIndex == 3 ? '设置'.tr : '查看'.tr,
style: TextStyle(
color: AppColors.placeholderTextColor,
fontSize: 20.sp),
@ -121,9 +124,9 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
if (clickIndex == 3) {
Navigator.pushNamed(
context, Routers.catEyeCustomModePage,
arguments: {
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
}).then((value) => logic.getLockSettingInfoData());
}).then((Object? value) => logic.getLockSettingInfoData());
} else {
//
showBottomSheet(context, clickIndex);
@ -158,7 +161,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
: AppColors.placeholderTextColor,
fontSize: 20.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [
late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle),
TextSpan(text: subTitle, style: subTipsStyle),
]);
@ -171,14 +174,14 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
builder: (BuildContext context) {
//
if (clickIndex == 0) {
return _buildBottomSheetWidget(context, '省电模式', '有人按门铃或发生\n异常事件时',
'不录像', '/', '有人按门铃或发生\n异常事件时');
return _buildBottomSheetWidget(context, '省电模式'.tr, '有人按门铃或发生'.tr + '\n' + '异常事件时'.tr,
'不录像'.tr, '/', '有人按门铃或发生'.tr + '\n' + '异常事件时'.tr);
} else if (clickIndex == 1) {
return _buildBottomSheetWidget(context, '逗留抓拍模式',
'有人出现、按门铃\n或发生异常事件时', '逗留达到10秒', '约1.5米', '随时');
return _buildBottomSheetWidget(context, '逗留抓拍模式'.tr,
'有人出现、按门铃'.tr + '\n' + '或发生异常事件时'.tr, '逗留达到10秒'.tr, '约1.5米'.tr, '随时'.tr);
} else if (clickIndex == 2) {
return _buildBottomSheetWidget(
context, '实时监控模式', '有人出现、按门铃\n或发生异常事件时', '立即录像', '约1.5米', '随时');
context, '实时监控模式'.tr, '有人出现、按门铃'.tr + '\n' + '或发生异常事件时'.tr, '立即录像'.tr, '约1.5米'.tr, '随时'.tr);
} else {
return Container();
}
@ -191,9 +194,9 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
return Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h),
child: Column(
children: [
children: <Widget>[
Row(
children: [
children: <Widget>[
//
Expanded(
child: Center(
@ -211,10 +214,10 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
SizedBox(
height: 40.h,
),
_buildRowWidget('录像时机', tips1),
_buildRowWidget('有人出现时录像', tips2),
_buildRowWidget('人体侦测距离', tips3),
_buildRowWidget('查看实时画面', tips4),
_buildRowWidget('录像时机'.tr, tips1),
_buildRowWidget('有人出现时录像'.tr, tips2),
_buildRowWidget('人体侦测距离'.tr, tips3),
_buildRowWidget('查看实时画面'.tr, tips4),
_buildIKnowBtn(),
],
),
@ -227,7 +230,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
child: Row(
//Row两端对齐的方法
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
Text(
titleStr,
style: TextStyle(
@ -268,7 +271,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
),
child: Center(
child: Text(
'我知道了',
'我知道了'.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor,
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';
class CatEyeWorkModeState {
var lockSetInfoData = LockSetInfoData().obs;
// var selectCatEyeWorkMode = 0.obs; //
var boolList = [false, false, false, false].obs;
var catEyeConfigData = CatEyeConfig().obs;
CatEyeWorkModeState() {
Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockSetInfoData.value = map['lockSetInfoData'];
// if (map['catEyeConfigData'] != null) {
// catEyeConfigData.value = map['catEyeConfigData'];
// selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!;
@ -31,4 +27,8 @@ class CatEyeWorkModeState {
// 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: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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
class VideoSlotLogic extends BaseGetXController {
final VideoSlotState state = VideoSlotState();
//
Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
@ -39,7 +41,7 @@ class VideoSlotLogic extends BaseGetXController {
}
//
void updateCatEyeModeConfig() async {
Future<void> updateCatEyeModeConfig() async {
state.isCustom.value == false
? state.recordMode.value = 0
: state.recordMode.value = 1;
@ -48,13 +50,13 @@ class VideoSlotLogic extends BaseGetXController {
state.recordStartTime.value =
DateTool().dateToTimestamp(state.startDate.value, 0);
//
DateTime tomorrow =
final DateTime tomorrow =
DateTime(DateTool().dateToTimestamp(state.startDate.value, 0))
.add(const Duration(days: 1));
//
state.recordEndTime.value = tomorrow.millisecondsSinceEpoch;
}
var entity = await ApiRepository.to.updateCatEyeModeConfig(
final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [
{
@ -74,7 +76,7 @@ class VideoSlotLogic extends BaseGetXController {
],
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
showToast('设置成功'.tr);
Get.back();
}
}

View File

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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_state.dart';
import 'package:star_lock/tools/dateTool.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/pduration.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
@ -19,8 +19,8 @@ class VideoSlotPage extends StatefulWidget {
}
class _VideoSlotPageState extends State<VideoSlotPage> {
final logic = Get.put(VideoSlotLogic());
final state = Get.find<VideoSlotLogic>().state;
final VideoSlotLogic logic = Get.put(VideoSlotLogic());
final VideoSlotState state = Get.find<VideoSlotLogic>().state;
@override
initState() {
@ -33,34 +33,32 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '录像时段',
barTitle: '录像时段'.tr,
haveBack: true,
backAction: () {
Navigator.pop(context, true);
},
backgroundColor: AppColors.mainColor,
actionsList: [
actionsList: <Widget>[
TextButton(
child: Text(
'保存'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
logic.updateCatEyeModeConfig();
},
onPressed: logic.updateCatEyeModeConfig,
),
],
),
body: Obx(() => Column(
children: [
children: <Widget>[
SizedBox(
height: 30.h,
),
_buildTipsView('全天', 0),
_buildTipsView('全天'.tr, 0),
SizedBox(
height: 30.h,
),
_buildCustomTimeView('自定义时间', 1),
_buildCustomTimeView('自定义时间'.tr, 1),
],
)));
}
@ -81,14 +79,12 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row(
children: [
state.isCustom.value == false
? Image.asset(
children: <Widget>[
if (state.isCustom.value == false) Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
)
: SizedBox(
) else SizedBox(
width: 20.w,
height: 14.w,
),
@ -128,22 +124,20 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Column(
children: [
children: <Widget>[
Row(
children: [
state.isCustom.value == true
? Image.asset(
children: <Widget>[
if (state.isCustom.value == true) Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
)
: SizedBox(
) else SizedBox(
width: 20.w,
height: 14.w,
),
SizedBox(width: 10.w),
Expanded(
child: _buildRichText('自定义时间', state.isCustom.value),
child: _buildRichText('自定义时间'.tr, state.isCustom.value),
),
SizedBox(
width: 10.w,
@ -151,9 +145,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
],
),
//
state.isCustom.value == false
? Container()
: Container(
if (state.isCustom.value == false) Container() else Container(
height: 1,
margin: EdgeInsets.only(
left: 20.w,
@ -164,17 +156,11 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
? AppColors.blueTextTipsColor
: Colors.black,
),
state.isCustom.value == false
? Container()
: startAndEndTimeRow(false),
state.isCustom.value == false
? Container()
: SizedBox(
if (state.isCustom.value == false) Container() else startAndEndTimeRow(false),
if (state.isCustom.value == false) Container() else SizedBox(
height: 30.h,
),
state.isCustom.value == false
? Container()
: startAndEndTimeRow(true),
if (state.isCustom.value == false) Container() else startAndEndTimeRow(true),
],
)),
)),
@ -192,12 +178,12 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
Widget startAndEndTimeRow(bool isEndTime) {
return GestureDetector(
child: Row(
children: [
children: <Widget>[
SizedBox(
width: 20.w,
),
Text(
isEndTime == false ? '开始时间' : '结束时间',
isEndTime == false ? '开始时间'.tr : '结束时间'.tr,
style: TextStyle(
color: state.isCustom.value == true
? AppColors.blueTextTipsColor
@ -210,8 +196,8 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
)),
Obx(() => Text(
isEndTime == false
? '当日${state.startDate.value}'
: '次日${state.endDate.value}',
? '${'当日'.tr}${state.startDate.value}'
: '${'次日'.tr}${state.endDate.value}',
style: TextStyle(
color: state.isCustom.value == true
? AppColors.blueTextTipsColor
@ -232,7 +218,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
PDuration selectDate = PDuration.parse(DateTime.tryParse(
isEndTime == false ? state.startDate.value : state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) {
selectDate: selectDate, mode: DateMode.HM, onConfirm: (PDuration p) {
if (isEndTime == false) {
state.startDate.value = DateTool().getYMDHNDateString(p, 3);
} else {
@ -250,7 +236,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
fontSize: 24.sp,
fontWeight: FontWeight.w500);
late InlineSpan tipsPreviewSpan = TextSpan(children: [
late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle),
]);
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/tools/dateTool.dart';
class VideoSlotState {
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
class VideoSlotState { // 0 1
VideoSlotState() {
Map map = Get.arguments;
@ -28,4 +13,19 @@ class VideoSlotState {
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:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
@ -10,35 +11,35 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
CheckInCreatCompanyState state = CheckInCreatCompanyState();
//
void setCheckInCreateCompany() async{
Future<void> setCheckInCreateCompany() async{
if(state.companyNameController.text.length > 50){
showToast("公司名称不能超过30个字符".tr);
showToast('公司名称不能超过30个字符'.tr);
return;
}
if(state.companyNameController.text.length < 6){
showToast("公司名称不能小于6个字符".tr);
showToast('公司名称不能小于6个字符'.tr);
return;
}
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
final LoginEntity entity = await ApiRepository.to.setCheckInCreateCompanyData(
lockId: state.lockSetInfoData.value.lockId.toString(),
attendanceType: state.isCustom.value ? "0" :"1",
attendanceType: state.isCustom.value ? '0' :'1',
companyName: state.companyNameController.text,
workDay: state.weekDays.value,
workEndTime: state.endTimeTimestamp.value,
workStartTime: state.beginTimeTimestamp.value,
);
if(entity.errorCode!.codeIsSuccessful){
showToast("创建成功".tr, something: (){
showToast('创建成功'.tr, something: (){
setLockSetGeneralSetting();
});
}
}
//
void setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setCheckInData(
Future<void> setLockSetGeneralSetting() async{
final LoginEntity entity = await ApiRepository.to.setCheckInData(
lockId: state.lockSetInfoData.value.lockId!,
attendance:1,
);
@ -47,9 +48,9 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
state.lockSetInfoData.value.lockSettingInfo!.attendance = 1;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "1"));
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, '1'));
Get.back();
showToast("设置成功".tr);
showToast('设置成功'.tr);
}
}

View File

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

View File

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

View File

@ -2,6 +2,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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 '../../../../../app_settings/app_colors.dart';
@ -18,49 +20,47 @@ class WifiListPage extends StatefulWidget {
}
class _WifiListPageState extends State<WifiListPage> {
final logic = Get.put(WifiListLogic());
final state = Get.find<WifiListLogic>().state;
final WifiListLogic logic = Get.put(WifiListLogic());
final WifiListState state = Get.find<WifiListLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: "WIFI列表".tr,
barTitle: 'WIFI列表'.tr,
haveBack: true,
actionsList: [
actionsList: <Widget>[
TextButton(
child: Text(
"刷新".tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),
'刷新'.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
logic.senderGetWifiListWifiAction();
},
onPressed: logic.senderGetWifiListWifiAction,
),
],
backgroundColor: AppColors.mainColor),
body: Column(
children: [
children: <Widget>[
Expanded(
child: Obx(() => state.wifiNameDataList.value.isNotEmpty ? ListView.builder(
itemCount: state.wifiNameDataList.value.length,
itemBuilder: (c, index) {
itemBuilder: (BuildContext c, int index) {
Map wifiNameStr = state.wifiNameDataList.value[index];
return _messageListItem(wifiNameStr["wifiName"], wifiNameStr["rssi"], () {
return _messageListItem(wifiNameStr['wifiName'], wifiNameStr['rssi'], () {
Get.toNamed(Routers.configuringWifiPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
'wifiName': wifiNameStr["wifiName"],
'wifiName': wifiNameStr['wifiName'],
});
});
}) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 64.h)),
),
SubmitBtn(
btnName: "手动配网".tr,
btnName: '手动配网'.tr,
fontSize: 28.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
Get.toNamed(Routers.configuringWifiPage, arguments: {
Get.toNamed(Routers.configuringWifiPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}),
@ -88,16 +88,16 @@ class _WifiListPageState extends State<WifiListPage> {
height: 80.h,
margin: EdgeInsets.only(left: 20.w, right: 40.w),
child: Column(
children: [
children: <Widget>[
SizedBox(
height: 79.h,
width: 1.sw - 20.w*2,
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
Flexible(
child: Text(
"$wifiName(${rssi}db)",
'$wifiName(${rssi}db)',
maxLines: 1,
overflow: TextOverflow.ellipsis,
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 '../../../../network/api_repository.dart';
@ -9,36 +10,33 @@ class DiagnoseLogic extends BaseGetXController{
//
Future<void> setLockDiagnose() async{
var entity = await ApiRepository.to.setLockDiagnoseData(
final LoginEntity entity = await ApiRepository.to.setLockDiagnoseData(
lockId: state.lockSetInfoData.value.lockId.toString(),
electricQuantity:"23",
firmwareRevision:"1.0", // 1-2-;
hardwareRevision:"1.3", // 4
lockDate:"1689410557000",
modelNum:"123456",
pwdInfo:"123456",
timestamp:"1689410559456000",
electricQuantity:'23',
firmwareRevision:'1.0', // 1-2-;
hardwareRevision:'1.3', // 4
lockDate:'1689410557000',
modelNum:'123456',
pwdInfo:'123456',
timestamp:'1689410559456000',
);
if(entity.errorCode!.codeIsSuccessful){
showToast("操作成功");
showToast('操作成功');
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
}
}

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -7,7 +8,6 @@ import '../../../../../app_settings/app_colors.dart';
import '../../../../../baseWidget.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class DoorMagneticPage extends StatefulWidget {
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 '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
class NearbyDoorMagneticPage extends StatefulWidget {
const NearbyDoorMagneticPage({Key? key}) : super(key: key);
@ -29,7 +28,7 @@ class _NearbyDoorMagneticPageState extends State<NearbyDoorMagneticPage> {
: ListView.builder(
itemCount: dataList.length,
itemBuilder: (c, index) {
return nearbyLockItem('images/icon_lock.png', 'MCBN01-ea9240',
return nearbyLockItem('images/icon_lock.png', '',
() {
// Navigator.pushNamed(context, Routers.saveLockPage);
});

View File

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

View File

@ -105,7 +105,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
return ListView.separated(
itemCount: 2,
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,() {
// Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
});
@ -144,7 +144,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
width: 10.w,
),
Text(
'${index+1}',
'${''.tr}${index+1}',
style: TextStyle(
color: AppColors.blackColor,
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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
class LiveVideoLogic extends BaseGetXController {
final LiveVideoState state = LiveVideoState();
//
Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
final LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
@ -34,13 +35,13 @@ class LiveVideoLogic extends BaseGetXController {
}
//
void updateCatEyeModeConfig() async {
var entity = await ApiRepository.to.updateCatEyeModeConfig(
Future<void> updateCatEyeModeConfig() async {
final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId ?? 0,
catEyeConfig: [
{
<String, Object>{
'catEyeMode': 4,
'catEyeModeConfig': {
'catEyeModeConfig': <String, Object?>{
'recordMode':
state.catEyeConfigData.value.catEyeModeConfig!.recordMode,
'recordStartTime':

View File

@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 '../../../../../tools/titleAppBar.dart';
@ -15,8 +16,8 @@ class LiveVideoPage extends StatefulWidget {
}
class _LiveVideoPageState extends State<LiveVideoPage> {
final logic = Get.put(LiveVideoLogic());
final state = Get.find<LiveVideoLogic>().state;
final LiveVideoLogic logic = Get.put(LiveVideoLogic());
final LiveVideoState state = Get.find<LiveVideoLogic>().state;
@override
initState() {
@ -35,7 +36,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
Navigator.pop(context, true);
},
backgroundColor: AppColors.mainColor,
actionsList: [
actionsList: <Widget>[
TextButton(
child: Text(
'保存'.tr,
@ -52,7 +53,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
],
),
body: Obx(() => Column(
children: [
children: <Widget>[
SizedBox(
height: 80.h,
),
@ -94,7 +95,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row(
children: [
children: <Widget>[
clickIndex == 0
? (state.isLiveView.value == false
? Image.asset(
@ -151,7 +152,7 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
: AppColors.placeholderTextColor,
fontSize: 20.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [
late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle),
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';
class LiveVideoState {
var isLiveView = false.obs; //
var realTimeMode = 0.obs; // 0 1
var lockSetInfoData = LockSetInfoData().obs;
var catEyeConfigData = CatEyeConfig().obs;
LiveVideoState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
@ -16,4 +11,8 @@ class LiveVideoState {
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:convert';
import 'dart:io';

View File

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

View File

@ -1,8 +1,4 @@
class LockSetInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
LockSetInfoData? data;
LockSetInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
@ -13,6 +9,10 @@ class LockSetInfoEntity {
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockSetInfoData.fromJson(json['data']) : null;
}
int? errorCode;
String? description;
String? errorMsg;
LockSetInfoData? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -27,11 +27,6 @@ class LockSetInfoEntity {
}
class LockSetInfoData {
int? lockId;
LockStatus? lockStatus;
LockFeature? lockFeature;
LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo;
LockSetInfoData(
{this.lockId,
@ -55,6 +50,11 @@ class LockSetInfoData {
? LockSettingInfo.fromJson(json['lockSettingInfo'])
: null;
}
int? lockId;
LockStatus? lockStatus;
LockFeature? lockFeature;
LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -76,13 +76,13 @@ class LockSetInfoData {
}
class LockStatus {
int? roomStatus;
LockStatus({this.roomStatus});
LockStatus.fromJson(Map<String, dynamic> json) {
roomStatus = json['roomStatus'];
}
int? roomStatus;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -91,61 +91,7 @@ class LockStatus {
}
}
class LockFeature {
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:
class LockFeature { // 0: 1:
LockFeature({
this.password,
@ -260,6 +206,60 @@ class LockFeature {
abnormalWarn = json['abnormalWarn'];
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() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -322,31 +322,6 @@ class LockFeature {
}
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(
{this.lockId,
@ -407,6 +382,31 @@ class LockBasicInfo {
network = json['network'];
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() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -442,8 +442,6 @@ class LockBasicInfo {
}
class GroupData {
int? id;
String? name;
GroupData({this.id, this.name});
@ -451,6 +449,8 @@ class GroupData {
id = json['id'];
name = json['name'];
}
int? id;
String? name;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -460,55 +460,7 @@ class GroupData {
}
}
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; // (/)//
class LockSettingInfo { //
LockSettingInfo({
this.remoteUnlock,
this.autoLock,
@ -539,16 +491,9 @@ class LockSettingInfo {
this.faceSwitch,
this.faceAutoLightScreen,
this.faceInductionDistance,
// this.faceAntiMistakeOpen,
this.autoLightScreen,
this.autoLightScreenTime,
this.faceEnErrUnlock,
// this.dayNotOpenDoorSwitch,
// this.dayNotOpenDoorValue,
// this.doorNotCloseSwitch,
// this.lowElecNoticeSwitch,
// this.doorbellNoticeSwitch,
// this.someoneAtDoorSwitch,
});
LockSettingInfo.fromJson(Map<String, dynamic> json) {
@ -591,18 +536,43 @@ class LockSettingInfo {
faceSwitch = json['faceSwitch'];
faceAutoLightScreen = json['faceAutoLightScreen'];
faceInductionDistance = json['faceInductionDistance'];
// faceAntiMistakeOpen = json['faceAntiMistakeOpen'];
autoLightScreen = json['autoLightScreen'];
autoLightScreenTime = json['autoLightScreenTime'];
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() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -640,27 +610,15 @@ class LockSettingInfo {
data['faceSwitch'] = faceSwitch;
data['faceAutoLightScreen'] = faceAutoLightScreen;
data['faceInductionDistance'] = faceInductionDistance;
// data['faceAntiMistakeOpen'] = faceAntiMistakeOpen;
data['autoLightScreen'] = autoLightScreen;
data['autoLightScreenTime'] = autoLightScreenTime;
data['faceEnErrUnlock'] = faceEnErrUnlock;
// data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch;
// data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
// data['doorNotCloseSwitch'] = doorNotCloseSwitch;
// data['lowElecNoticeSwitch'] = lowElecNoticeSwitch;
// data['doorbellNoticeSwitch'] = doorbellNoticeSwitch;
// data['someoneAtDoorSwitch'] = someoneAtDoorSwitch;
return data;
}
}
class PassageModeConfig {
int? startDate;
int? endDate;
List<int>? weekDays;
int? isAllDay;
PassageModeConfig(
{this.startDate, this.endDate, this.weekDays, this.isAllDay});
@ -671,6 +629,10 @@ class PassageModeConfig {
weekDays = json['weekDays'].cast<int>();
isAllDay = json['isAllDay'];
}
int? startDate;
int? endDate;
List<int>? weekDays;
int? isAllDay;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -683,8 +645,6 @@ class PassageModeConfig {
}
class CatEyeConfig {
int? catEyeMode; //1 2 3 4
CatEyeModeConfig? catEyeModeConfig;
CatEyeConfig({this.catEyeMode, this.catEyeModeConfig});
@ -694,6 +654,8 @@ class CatEyeConfig {
? CatEyeModeConfig.fromJson(json['catEyeModeConfig'])
: null;
}
int? catEyeMode; //1 2 3 4
CatEyeModeConfig? catEyeModeConfig;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -705,13 +667,7 @@ class CatEyeConfig {
}
}
class CatEyeModeConfig {
int? recordMode; // 0 1
String? recordTime; //
int? realTimeMode; // 0 1
int? recordEndTime; //-
int? recordStartTime; //-
String? detectionDistance; //
class CatEyeModeConfig { //
CatEyeModeConfig(
{this.recordMode,
@ -733,6 +689,12 @@ class CatEyeModeConfig {
recordStartTime = json['recordStartTime'];
detectionDistance = json['detectionDistance'];
}
int? recordMode; // 0 1
String? recordTime; //
int? realTimeMode; // 0 1
int? recordEndTime; //-
int? recordStartTime; //-
String? detectionDistance;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -1,3 +1,4 @@
import 'dart:async';
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:star_lock/login/login/entity/LoginEntity.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/io_protocol/io_factoryDataReset.dart';

View File

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

View File

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

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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 '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'lockSoundSet_logic.dart';
class LockSoundSetPage extends StatefulWidget {

View File

@ -2,20 +2,24 @@
import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart';
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;//
class LockSoundSetState {//
LockSoundSetState() {
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!;
}
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(){
final DateTime now = DateTime.now();
final Duration timeZoneOffset = now.timeZoneOffset;
AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
// AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
return state.serverTime + timeZoneOffset.inSeconds;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,30 +2,18 @@
import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart';
class NormallyOpenModeState{
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()
class NormallyOpenModeState{// 0() 1()
NormallyOpenModeState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockSetInfoData.value = map['lockSetInfoData'];
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){
isJustForShow.value = false;
@ -38,9 +26,25 @@ class NormallyOpenModeState{
weekDays.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].weekDays!;
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!;
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:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
@ -21,7 +22,7 @@ class OpenDoorDirectionLogic extends BaseGetXController {
// ->
Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setOpenDoorDirectionData(
final LoginEntity entity = await ApiRepository.to.setOpenDoorDirectionData(
lockId: state.lockSetInfoData.value.lockId!,
openDirectionValue:state.openDirectionValue.value, // 1-2-;
);
@ -31,7 +32,7 @@ class OpenDoorDirectionLogic extends BaseGetXController {
// state.openDirectionValue.value = state.openDirectionValue.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.openDirectionValue.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 {
dismissEasyLoading();
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -116,7 +117,6 @@ class OpenDoorDirectionLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initReplySubscription();
@ -124,7 +124,6 @@ class OpenDoorDirectionLogic extends BaseGetXController {
@override
void onInit() {
// TODO: implement onInit
super.onInit();
// _readSupportFunctionsNoParameters();
@ -132,7 +131,6 @@ class OpenDoorDirectionLogic extends BaseGetXController {
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_replySubscription.cancel();
}

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_state.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'openDoorDirection_logic.dart';
class OpenDoorDirectionPage extends StatefulWidget {
@ -15,8 +15,8 @@ class OpenDoorDirectionPage extends StatefulWidget {
}
class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
final logic = Get.put(OpenDoorDirectionLogic());
final state = Get.find<OpenDoorDirectionLogic>().state;
final OpenDoorDirectionLogic logic = Get.put(OpenDoorDirectionLogic());
final OpenDoorDirectionState state = Get.find<OpenDoorDirectionLogic>().state;
// bool isCheck = false;
// int selectIndex = 0;
@ -31,7 +31,7 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
children: <Widget>[
SizedBox(
height: 60.h,
),
@ -67,10 +67,10 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
Row _buildRadioGroupRowWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
children: <Widget>[
// SizedBox(width: 60.w,),
Row(
children: [
children: <Widget>[
Obx(() => _colorfulCheckBox(1)),
Text(
'左开'.tr,
@ -80,7 +80,7 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
),
// SizedBox(width: 100.w),
Row(
children: [
children: <Widget>[
Obx(() => _colorfulCheckBox(2)),
Text(
'右开'.tr,
@ -126,7 +126,7 @@ class _OpenDoorDirectionPageState extends State<OpenDoorDirectionPage> {
: AppColors.placeholderTextColor,
fontSize: 22.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [
late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
TextSpan(text: titleStr, style: titleStyle),
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: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/tools/baseGetXController.dart';
@ -20,11 +21,11 @@ class RemoteUnlockingLogic extends BaseGetXController {
RemoteUnlockingState state = RemoteUnlockingState();
void remoteUnlockingOpenOrClose() async {
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
final LoginEntity entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
lockId: state.lockSetInfoData.value.lockId!,
remoteUnlock: state.remoteEnable.value == 1 ? 0 : 1);
if (entity.errorCode!.codeIsSuccessful) {
showToast("操作成功".tr, something: () {
showToast('操作成功'.tr, something: () {
eventBus.fire(RefreshLockListInfoDataEvent());
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock =
@ -143,7 +144,6 @@ class RemoteUnlockingLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initReplySubscription();
@ -151,7 +151,6 @@ class RemoteUnlockingLogic extends BaseGetXController {
@override
void onInit() {
// TODO: implement onInit
super.onInit();
// _readSupportFunctionsNoParameters();
@ -159,8 +158,8 @@ class RemoteUnlockingLogic extends BaseGetXController {
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_replySubscription.cancel();
}
}

View File

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

View File

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

View File

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

View File

@ -3,19 +3,19 @@ import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart';
class ResetButtonState{
var lockSetInfoData = LockSetInfoData().obs;
var resetButtonEnable = 1.obs;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
class ResetButtonState{// 0() 1()
ResetButtonState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockSetInfoData.value = map['lockSetInfoData'];
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_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

View File

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

View File

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

View File

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

View File

@ -4,21 +4,16 @@ import 'package:video_player/video_player.dart';
import 'video_player_control.dart';
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 GlobalKey<VideoPlayerControlState> controlKey;
final Widget child;
final VideoPlayerController controller;
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获取共享数据
static ControllerWidget? of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<ControllerWidget>();
@ -26,7 +21,6 @@ class ControllerWidget extends InheritedWidget {
@override
bool updateShouldNotify(InheritedWidget oldWidget) {
// TODO: implement updateShouldNotify
return false;
}

View File

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

View File

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

View File

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

View File

@ -7,11 +7,11 @@ import 'package:video_player/video_player.dart';
import 'controller_widget.dart';
class VideoPlayerSlider extends StatefulWidget {
const VideoPlayerSlider({required this.startPlayControlTimer, required this.timer, Key? key}) : super(key: key);
final Function startPlayControlTimer;
final Timer timer;
VideoPlayerSlider({required this.startPlayControlTimer, required this.timer});
@override
_VideoPlayerSliderState createState() => _VideoPlayerSliderState();
}
@ -58,11 +58,11 @@ class _VideoPlayerSliderState extends State<VideoPlayerSlider> {
data: SliderTheme.of(context).copyWith(
//
inactiveTrackColor: Colors.white,
overlayShape: RoundSliderOverlayShape(
overlayShape: const RoundSliderOverlayShape(
//SliderComponentShape自定义形状
overlayRadius: 10, //
),
thumbShape: RoundSliderThumbShape(
thumbShape: const RoundSliderThumbShape(
//SliderComponentShape自定义形状
disabledThumbRadius: 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/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
import 'editVideoLog_state.dart';
class EditVideoLogLogic extends BaseGetXController {
EditVideoLogState state = EditVideoLogState();
void deleteLockCloudStorageList() async {
var entity = await ApiRepository.to.deleteLockCloudStorageList(
Future<void> deleteLockCloudStorageList() async {
final VersionUndateEntity entity = await ApiRepository.to.deleteLockCloudStorageList(
recordIds: state.selectVideoLogList.value.map((e) => e.recordId).toList(),
);
if (entity.errorCode!.codeIsSuccessful) {
state.selectVideoLogList.value.clear();
showToast('删除成功');
showToast('删除成功'.tr);
getLockCloudStorageList();
}
}
void getLockCloudStorageList() async {
var entity = await ApiRepository.to.getLockCloudStorageList(
Future<void> getLockCloudStorageList() async {
final VideoLogEntity entity = await ApiRepository.to.getLockCloudStorageList(
lockId: state.getLockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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/tools/dateTool.dart';
@ -17,21 +19,21 @@ class EditVideoLogPage extends StatefulWidget {
}
class _EditVideoLogPageState extends State<EditVideoLogPage> {
final logic = Get.put(EditVideoLogLogic());
final state = Get.find<EditVideoLogLogic>().state;
final EditVideoLogLogic logic = Get.put(EditVideoLogLogic());
final EditVideoLogState state = Get.find<EditVideoLogLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: "已选${state.selectVideoLogList.value.length}",
barTitle: '${'已选'.tr}${state.selectVideoLogList.value.length}${''.tr}',
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
actionsList: <Widget>[
TextButton(
child: Text(
"全选".tr,
'全选'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () async {
@ -67,19 +69,19 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
],
),
body: Column(
children: [
children: <Widget>[
Expanded(
child: Obx(() => ListView.builder(
itemCount: state.videoLogList.length,
itemBuilder: (c, index) {
CloudStorageData item = state.videoLogList[index];
itemBuilder: (BuildContext c, int index) {
final CloudStorageData item = state.videoLogList[index];
return Column(
children: [
children: <Widget>[
Container(
margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [
Text(item.date ?? "",
child: Row(children: <Widget>[
Text(item.date ?? '',
style: TextStyle(fontSize: 20.sp)),
])),
mainListView(index, item)
@ -93,8 +95,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
);
}
var itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h;
double itemW = (1.sw - 15.w * 4) / 3;
double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
Widget mainListView(int index, CloudStorageData itemData) {
return GridView.builder(
padding: EdgeInsets.only(left: 15.w, right: 15.w),
@ -110,8 +112,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
crossAxisSpacing: 15.w,
//
childAspectRatio: itemW / itemH),
itemBuilder: (context, index) {
RecordListData recordData = itemData.recordList![index];
itemBuilder: (BuildContext context, int index) {
final RecordListData recordData = itemData.recordList![index];
return videoItem(recordData, index);
},
);
@ -133,9 +135,9 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
setState(() {});
},
child: Stack(
children: [
children: <Widget>[
Column(
children: [
children: <Widget>[
Container(
width: itemW,
height: itemW,
@ -146,7 +148,7 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
child: Image(
fit: BoxFit.cover,
image: Image.network(recordData.imagesUrl ??
"images/icon_video_placeholder.jpg")
'images/icon_video_placeholder.jpg')
.image),
),
),
@ -165,8 +167,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
width: 36.w,
height: 36.w,
image: state.selectVideoLogList.value.contains(recordData)
? const AssetImage("images/icon_round_select.png")
: const AssetImage("images/icon_round_unSelect.png")))
? const AssetImage('images/icon_round_select.png')
: const AssetImage('images/icon_round_unSelect.png')))
],
)),
);
@ -175,14 +177,14 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
Widget bottomBottomBtnWidget() {
return SizedBox(
width: 1.sw,
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
bottomBtnItemWidget(
"images/main/icon_lockDetail_monitoringDownloadVideo.png",
"下载".tr,
'images/main/icon_lockDetail_monitoringDownloadVideo.png',
'下载'.tr,
Colors.white, () {
if (state.selectVideoLogList.value.isNotEmpty) {
Get.toNamed(Routers.videoLogDownLoadPage, arguments: {
"downloadVideoLogList": state.selectVideoLogList.value
Get.toNamed(Routers.videoLogDownLoadPage, arguments: <String, List<RecordListData>>{
'downloadVideoLogList': state.selectVideoLogList.value
});
} else {
logic.showToast('请选择要下载的视频');
@ -190,8 +192,8 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
}),
SizedBox(width: 100.w),
bottomBtnItemWidget(
"images/main/icon_lockDetail_monitoringDeletVideo.png",
"删除".tr,
'images/main/icon_lockDetail_monitoringDeletVideo.png',
'删除'.tr,
AppColors.mainColor, () {
if (state.selectVideoLogList.value.isNotEmpty) {
logic.deleteLockCloudStorageList();
@ -205,14 +207,14 @@ class _EditVideoLogPageState extends State<EditVideoLogPage> {
Widget bottomBtnItemWidget(
String iconUrl, String name, Color backgroundColor, Function() onClick) {
var wh = 40.w;
final double wh = 40.w;
return GestureDetector(
onTap: onClick,
child: SizedBox(
height: 140.h,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
children: <Widget>[
SizedBox(height: 30.w),
Image.asset(iconUrl, width: wh, height: wh, fit: BoxFit.fitWidth),
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';
class EditVideoLogState {
var selectVideoLogList = <RecordListData>[].obs; //
var isSelectAll = false.obs;
var videoLogList = [].obs; //
var getLockId = 0.obs;
EditVideoLogState() {
Map map = Get.arguments;
@ -17,4 +13,8 @@ class EditVideoLogState {
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_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.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_state.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/noData.dart';
@ -19,8 +21,8 @@ class VideoLogPage extends StatefulWidget {
}
class _VideoLogPageState extends State<VideoLogPage> {
final logic = Get.put(VideoLogLogic());
final state = Get.find<VideoLogLogic>().state;
final VideoLogLogic logic = Get.put(VideoLogLogic());
final VideoLogState state = Get.find<VideoLogLogic>().state;
@override
Widget build(BuildContext context) {
@ -33,7 +35,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
children: <Widget>[
//
Visibility(visible: !state.isNavLocal.value, child: vipTip()),
//
@ -45,15 +47,15 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: Expanded(
child: ListView.builder(
itemCount: state.videoLogList.length,
itemBuilder: (c, index) {
CloudStorageData item = state.videoLogList[index];
itemBuilder: (BuildContext c, int index) {
final CloudStorageData item = state.videoLogList[index];
return Column(
children: [
children: <Widget>[
Container(
margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [
Text(item.date ?? "",
child: Row(children: <Widget>[
Text(item.date ?? '',
style: TextStyle(fontSize: 20.sp)),
])),
mainListView(index, item)
@ -67,14 +69,14 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: state.localList.isNotEmpty
? ListView.builder(
itemCount: 5,
itemBuilder: (c, index) {
itemBuilder: (BuildContext c, int index) {
return Column(
children: [
children: <Widget>[
Container(
margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [
Text("2023.10.2$index",
child: Row(children: <Widget>[
Text('2023.10.2$index',
style: TextStyle(fontSize: 20.sp)),
])),
mainListView(index, CloudStorageData()),
@ -94,14 +96,14 @@ class _VideoLogPageState extends State<VideoLogPage> {
// color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
TextButton(
onPressed: () {
setState(() {
state.isNavLocal.value = false;
});
},
child: Obx(() => Text("云存".tr,
child: Obx(() => Text('云存'.tr,
style: state.isNavLocal.value == true
? TextStyle(
color: Colors.grey,
@ -117,7 +119,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
state.isNavLocal.value = true;
});
},
child: Obx(() => Text("本地".tr,
child: Obx(() => Text('本地'.tr,
style: state.isNavLocal.value == true
? TextStyle(
color: Colors.white,
@ -147,23 +149,23 @@ class _VideoLogPageState extends State<VideoLogPage> {
color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h)),
child: Row(
children: [
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("3天滚动储存".tr, style: TextStyle(fontSize: 24.sp)),
children: <Widget>[
Text('3天滚动储存'.tr, style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 10.h),
Text("${F.navTitle}${"已为本设备免费提供3大滚动视频储存服务".tr}",
style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
],
)),
SizedBox(width: 15.w),
Text("去升级".tr, style: TextStyle(fontSize: 22.sp)),
Text('去升级'.tr, style: TextStyle(fontSize: 22.sp)),
Image(
width: 40.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),
borderRadius: BorderRadius.circular(20.h)),
child: Row(
children: [
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
// SizedBox(height: 20.h),
Text("下载列表".tr, style: TextStyle(fontSize: 24.sp)),
Text('下载列表'.tr, style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 15.h),
Text("暂无下载内容".tr,
Text('暂无下载内容'.tr,
style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
],
)),
@ -202,7 +204,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
Image(
width: 40.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),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(state.isNavLocal.value == true ? "已下载".tr : "全部视频".tr,
children: <Widget>[
Text(state.isNavLocal.value == true ? '已下载'.tr : '全部视频'.tr,
style: TextStyle(fontSize: 26.sp, fontWeight: FontWeight.w500)),
Expanded(child: SizedBox(width: 10.w)),
IconButton(
@ -224,13 +226,13 @@ class _VideoLogPageState extends State<VideoLogPage> {
width: 40.w,
height: 40.w,
image: const AssetImage(
"images/main/icon_lockDetail_monitoringEditVoice.png")),
'images/main/icon_lockDetail_monitoringEditVoice.png')),
iconSize: 30,
color: Colors.black54,
onPressed: () {
Get.toNamed(Routers.editVideoLogPage, arguments: {
"videoDataList": state.videoLogList.value,
"lockId": state.getLockId.value
Get.toNamed(Routers.editVideoLogPage, arguments: <String, Object>{
'videoDataList': state.videoLogList.value,
'lockId': state.getLockId.value
});
},
)
@ -245,8 +247,8 @@ class _VideoLogPageState extends State<VideoLogPage> {
);
}
var itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h;
double itemW = (1.sw - 15.w * 4) / 3;
double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
//
Widget mainListView(int index, CloudStorageData itemData) {
@ -264,8 +266,8 @@ class _VideoLogPageState extends State<VideoLogPage> {
crossAxisSpacing: 15.w,
//
childAspectRatio: itemW / itemH),
itemBuilder: (context, index) {
RecordListData recordData = itemData.recordList![index];
itemBuilder: (BuildContext context, int index) {
final RecordListData recordData = itemData.recordList![index];
return videoItem(recordData);
},
);
@ -274,16 +276,16 @@ class _VideoLogPageState extends State<VideoLogPage> {
Widget videoItem(RecordListData recordData) {
return GestureDetector(
onTap: () {
Get.toNamed(Routers.videoLogDetailPage, arguments: {
"recordData": recordData,
"videoDataList": state.videoLogList.value
Get.toNamed(Routers.videoLogDetailPage, arguments: <String, Object>{
'recordData': recordData,
'videoDataList': state.videoLogList.value
});
},
child: SizedBox(
width: itemW,
height: itemH,
child: Column(
children: [
children: <Widget>[
Container(
width: itemW,
height: itemW,
@ -294,7 +296,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: Image(
fit: BoxFit.cover,
image: Image.network(recordData.imagesUrl ??
"images/icon_video_placeholder.jpg")
'images/icon_video_placeholder.jpg')
.image),
),
),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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