diff --git a/lan/lan_en.json b/lan/lan_en.json index 87569770..3190325e 100755 --- a/lan/lan_en.json +++ b/lan/lan_en.json @@ -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" } diff --git a/lan/lan_keys.json b/lan/lan_keys.json index 65cf917c..3d202a74 100755 --- a/lan/lan_keys.json +++ b/lan/lan_keys.json @@ -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米", + "添加指纹失败": "添加指纹失败", + "项": "项", + "播放中": "播放中", + "下载": "下载", + "暂无下载内容": "暂无下载内容", + "亮度": "亮度", + "音量": "音量", + "快进至": "快进至", + "快退至": "快退至", + "暂无视频信息": "暂无视频信息", + "加载出错": "加载出错" } diff --git a/lan/lan_zh.json b/lan/lan_zh.json index b7ae345f..bfc2e394 100755 --- a/lan/lan_zh.json +++ b/lan/lan_zh.json @@ -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米", + "添加指纹失败": "添加指纹失败", + "项": "项", + "播放中": "播放中", + "下载": "下载", + "暂无下载内容": "暂无下载内容", + "亮度": "亮度", + "音量": "音量", + "快进至": "快进至", + "快退至": "快退至", + "暂无视频信息": "暂无视频信息", + "加载出错": "加载出错" } diff --git a/lib/common/XSConstantMacro/XSConstantMacro.dart b/lib/common/XSConstantMacro/XSConstantMacro.dart index 38485f83..a729d9b4 100755 --- a/lib/common/XSConstantMacro/XSConstantMacro.dart +++ b/lib/common/XSConstantMacro/XSConstantMacro.dart @@ -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; } } diff --git a/lib/common/safetyVerification/safetyVerification_page.dart b/lib/common/safetyVerification/safetyVerification_page.dart index 65359b74..425ec3c5 100755 --- a/lib/common/safetyVerification/safetyVerification_page.dart +++ b/lib/common/safetyVerification/safetyVerification_page.dart @@ -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 with TickerProviderStateMixin { - final logic = Get.put(SafetyVerificationLogic()); - final state = Get.find().state; + final SafetyVerificationLogic logic = Get.put(SafetyVerificationLogic()); + final SafetyVerificationState state = Get.find().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 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 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 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 with Ti @override void didUpdateWidget(SafetyVerificationPage oldWidget) { - // TODO: implement didUpdateWidget super.didUpdateWidget(oldWidget); } @@ -125,8 +128,8 @@ class _SafetyVerificationPageState extends State 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 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 with Ti _showTimeLine = false; }); //关闭验证码 - Navigator.pop(context, {'xWidth': state.sliderXMoved.value.toString()}); + Navigator.pop(context, {'xWidth': state.sliderXMoved.value.toString()}); }); }); } @@ -186,7 +189,7 @@ class _SafetyVerificationPageState extends State 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 with Ti child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - 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 with Ti child: Stack( children: [ ///底图 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 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 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 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 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 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 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 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); } } diff --git a/lib/main/lockDetail/card/addICCard/addICCard_logic.dart b/lib/main/lockDetail/card/addICCard/addICCard_logic.dart index 9884cbd3..5b0b96f9 100755 --- a/lib/main/lockDetail/card/addICCard/addICCard_logic.dart +++ b/lib/main/lockDetail/card/addICCard/addICCard_logic.dart @@ -68,7 +68,7 @@ class AddICCardLogic extends BaseGetXController{ final List token = reply.data.sublist(5, 9); final List saveStrList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, saveStrList); - AppLog.log('添加卡token:$token'); + // AppLog.log('添加卡token:$token'); IoSenderManage.senderAddCardWithTimeCycleCoercionCommand( keyID:'1', diff --git a/lib/main/lockDetail/card/cardList/cardList_logic.dart b/lib/main/lockDetail/card/cardList/cardList_logic.dart index f57cde7c..59aa2391 100755 --- a/lib/main/lockDetail/card/cardList/cardList_logic.dart +++ b/lib/main/lockDetail/card/cardList/cardList_logic.dart @@ -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 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'); - // 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode - final authCode = crypto.md5.convert(authCodeData); - AppLog.log('authCode:$authCode authCode.bytes.length:${authCode.bytes.length} authCode.bytes:${authCode.bytes}'); - } - @override Future onReady() async { super.onReady(); @@ -274,8 +240,6 @@ class CardListLogic extends BaseGetXController { _initRefreshAction(); } - - // signBlue(); } @override diff --git a/lib/main/lockDetail/card/cardList/cardList_page.dart b/lib/main/lockDetail/card/cardList/cardList_page.dart index 9dc6a76f..cb297970 100755 --- a/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -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'; diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart index 74d8eaa4..3a53090a 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart @@ -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 { diff --git a/lib/main/lockDetail/face/addFace/addFace_state.dart b/lib/main/lockDetail/face/addFace/addFace_state.dart index 1cf9301c..fd00bc11 100755 --- a/lib/main/lockDetail/face/addFace/addFace_state.dart +++ b/lib/main/lockDetail/face/addFace/addFace_state.dart @@ -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; } diff --git a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart index 72dfe924..f2c187b2 100755 --- a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -94,7 +94,7 @@ class AddFingerprintLogic extends BaseGetXController { default: //失败 state.ifAddState.value = false; - showToast('添加指纹失败', something: (){ + showToast('添加指纹失败'.tr, something: (){ Get.back(); }); break; diff --git a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart index 37b278b7..5eb834b1 100755 --- a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart +++ b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart @@ -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 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 with RouteAware ), )), Obx(() => Visibility( - visible: !logic.state.ifConnectScuess.value, + visible: !state.ifConnectScuess.value, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart b/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart index e7fe45f3..3b2c1b31 100755 --- a/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart +++ b/lib/main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart @@ -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 { diff --git a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart index b7f9d538..2d716bcf 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart @@ -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'; diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart index 84237ed4..17b9d629 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart @@ -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'; diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index 9049dd12..e3e4d242 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -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'; diff --git a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart index c083d92d..49976f8c 100755 --- a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart +++ b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart @@ -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(); diff --git a/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_logic.dart b/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_logic.dart index 0e783b3f..38643a53 100755 --- a/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_logic.dart +++ b/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_logic.dart @@ -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 diff --git a/lib/main/lockDetail/lockSet/basicInformation/lockSelectGrouping/lockSelectGrouping_logic.dart b/lib/main/lockDetail/lockSet/basicInformation/lockSelectGrouping/lockSelectGrouping_logic.dart index e433b7eb..8b2a09bf 100755 --- a/lib/main/lockDetail/lockSet/basicInformation/lockSelectGrouping/lockSelectGrouping_logic.dart +++ b/lib/main/lockDetail/lockSet/basicInformation/lockSelectGrouping/lockSelectGrouping_logic.dart @@ -52,11 +52,6 @@ class LockSelectGroupingLogic extends BaseGetXController { mockNetworkDataRequest(); } - @override - void onInit() { - super.onInit(); - } - @override void onClose() { super.onClose(); diff --git a/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart b/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart index 23d80a44..d0abe318 100755 --- a/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart +++ b/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart @@ -165,11 +165,6 @@ class UploadElectricQuantityLogic extends BaseGetXController { // getServerDatetime(); } - @override - void onInit() { - super.onInit(); - } - @override void onClose() { super.onClose(); diff --git a/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart b/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart index 1d7ec440..74e2c236 100755 --- a/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart +++ b/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart @@ -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 _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 _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { if(reply is SetSupportFunctionsNoParametersReply) { _replySetSupportFunctionsWithParameters(reply); } @@ -69,7 +70,7 @@ class BurglarAlarmLogic extends BaseGetXController{ // 设置自动落锁数据解析 Future _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 getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List 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(); diff --git a/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_state.dart b/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_state.dart index ce6f2d58..def35f6c 100755 --- a/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_state.dart +++ b/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_state.dart @@ -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().obs; + + RxInt burglarAlarmEnable = 0.obs; + + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs; } \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart index 7d2754ba..400edf80 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart @@ -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 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); } } } diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart index 21f2be4f..5850d951 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart @@ -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 { }, ), ), - _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 { Container( margin: EdgeInsets.only(left: 20.w), child: CommonItem( - leftTitel: '实时画面', + leftTitel: '实时画面'.tr, rightTitle: state.realTimeMode.value, isHaveLine: false, isHaveDirection: true, diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart index 0b451025..9a735409 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart @@ -23,15 +23,15 @@ class CatEyeCustomModeState { //实时画面 0发生事件事查看 1实时查 // var showsUpVideo = '10${TranslationLoader.lanKeys!.second!.tr}'.obs; //有人出现时录像 // var detectionRange = '约1.5米'.obs; //人体侦测距离 RxList showsUpVideoList = [ - '不录像', - '立即录像', + '不录像'.tr, + '立即录像'.tr, '5${"秒".tr}', '10${"秒".tr}', '15${"秒".tr}', '30${"秒".tr}', '60${"秒".tr}' ].obs; - RxList detectionRangeList = ['约0.8米', '约1.5米', '约3.0米'].obs; + RxList detectionRangeList = ['约0.8米'.tr, '约1.5米'.tr, '约3.0米'.tr].obs; //高亮样式 final TextStyle titleStyle = TextStyle( color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500); diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_logic.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_logic.dart index bfcbae3d..53a61e8d 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_logic.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_logic.dart @@ -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 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 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 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 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 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!; diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_page.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_page.dart index 0ae9bf24..100e871f 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_page.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_page.dart @@ -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 { - final logic = Get.put(CatEyeSetLogic()); - final state = Get.find().state; + final CatEyeSetLogic logic = Get.put(CatEyeSetLogic()); + final CatEyeSetState state = Get.find().state; @override void initState() { @@ -37,7 +38,7 @@ class _CatEyeSetPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor), body: Column( - children: [ + children: [ Obx(() => CommonItem( leftTitel: '猫眼工作模式'.tr, rightTitle: state.selectCatEyeWorkMode.value, @@ -46,20 +47,20 @@ class _CatEyeSetPageState extends State { isHaveDirection: true, action: () { Navigator.pushNamed(context, Routers.catEyeWorkModePage, - arguments: { + arguments: { '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 { })), 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 { 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 { return AlertBottomWidget( topTitle: '', items: state.brightDurationTimeList, - chooseCallback: (value) { + chooseCallback: (int value) { state.selectBrightDuration.value = state.brightDurationTimeList[value]; logic.updateLightScreenTimeConfig(); diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_state.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_state.dart index b1c5dd1c..ac48a22f 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_state.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_state.dart @@ -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 brightDurationTimeList = ['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().obs; + RxString selectCatEyeWorkMode = ''.obs; //猫眼工作模式 + final String settingSuccess = '设置成功'.tr; } diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart index 10be744e..a13f49d5 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart @@ -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 updateCatEyeModeConfig() async { + final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig( lockId: state.lockSetInfoData.value.lockId!, catEyeConfig: [ - { + { 'catEyeMode': - state.boolList.indexWhere((element) => element == true) + 1, - 'catEyeModeConfig': { + state.boolList.indexWhere((bool element) => element == true) + 1, + 'catEyeModeConfig': { '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 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 = [true, false, false, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeStayCapture) { - state.boolList.value = [false, true, false, false]; + state.boolList.value = [false, true, false, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeRealTimeMonitoring) { - state.boolList.value = [false, false, true, false]; + state.boolList.value = [false, false, true, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeCustom) { - state.boolList.value = [false, false, false, true]; + state.boolList.value = [false, false, false, true]; } } } diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart index c205c0fc..800b03dd 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart @@ -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 { - final logic = Get.put(CatEyeWorkModeLogic()); - final state = Get.find().state; + final CatEyeWorkModeLogic logic = Get.put(CatEyeWorkModeLogic()); + final CatEyeWorkModeState state = Get.find().state; @override initState() { @@ -29,36 +32,38 @@ class _CatEyeWorkModePageState extends State { 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: [ 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 { 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: [ + 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 { ), 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 { if (clickIndex == 3) { Navigator.pushNamed( context, Routers.catEyeCustomModePage, - arguments: { + arguments: { '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 { : AppColors.placeholderTextColor, fontSize: 20.sp); - late InlineSpan tipsPreviewSpan = TextSpan(children: [ + late InlineSpan tipsPreviewSpan = TextSpan(children: [ TextSpan(text: titleStr, style: titleStyle), TextSpan(text: subTitle, style: subTipsStyle), ]); @@ -171,14 +174,14 @@ class _CatEyeWorkModePageState extends State { 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 { return Container( margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h), child: Column( - children: [ + children: [ Row( - children: [ + children: [ //居中显示 Expanded( child: Center( @@ -211,10 +214,10 @@ class _CatEyeWorkModePageState extends State { 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 { child: Row( //Row两端对齐的方法 mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Text( titleStr, style: TextStyle( @@ -268,7 +271,7 @@ class _CatEyeWorkModePageState extends State { ), child: Center( child: Text( - '我知道了', + '我知道了'.tr, style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 24.sp, diff --git a/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart b/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart index 765f9050..7e7973bd 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart @@ -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().obs; + // var selectCatEyeWorkMode = 0.obs; //猫眼工作模式 + RxList boolList = [false, false, false, false].obs; + Rx catEyeConfigData = CatEyeConfig().obs; } diff --git a/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart b/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart index b52a8b2c..32e2f7e4 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart @@ -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 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 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(); } } diff --git a/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_page.dart b/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_page.dart index d8f235a2..49aeb165 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_page.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_page.dart @@ -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 { - final logic = Get.put(VideoSlotLogic()); - final state = Get.find().state; + final VideoSlotLogic logic = Get.put(VideoSlotLogic()); + final VideoSlotState state = Get.find().state; @override initState() { @@ -33,34 +33,32 @@ class _VideoSlotPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: '录像时段', + barTitle: '录像时段'.tr, haveBack: true, backAction: () { Navigator.pop(context, true); }, backgroundColor: AppColors.mainColor, - actionsList: [ + actionsList: [ TextButton( child: Text( '保存'.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), - onPressed: () { - logic.updateCatEyeModeConfig(); - }, + onPressed: logic.updateCatEyeModeConfig, ), ], ), body: Obx(() => Column( - children: [ + children: [ 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 { 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: [ + 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 { padding: EdgeInsets.only( left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), child: Column( - children: [ + children: [ Row( - children: [ - state.isCustom.value == true - ? Image.asset( + children: [ + 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 { ], ), //如果选中了全天模式,就不显示下面的时间选择 - 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 { ? 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 { Widget startAndEndTimeRow(bool isEndTime) { return GestureDetector( child: Row( - children: [ + children: [ 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 { )), 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 { 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 { fontSize: 24.sp, fontWeight: FontWeight.w500); - late InlineSpan tipsPreviewSpan = TextSpan(children: [ + late InlineSpan tipsPreviewSpan = TextSpan(children: [ TextSpan(text: titleStr, style: titleStyle), ]); return RichText(text: tipsPreviewSpan); diff --git a/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart b/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart index 79f52c28..7ad52496 100755 --- a/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart +++ b/lib/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_state.dart @@ -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().obs; + Rx 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; } diff --git a/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_logic.dart b/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_logic.dart index 651d844d..aa12ec1f 100755 --- a/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_logic.dart +++ b/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_logic.dart @@ -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 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 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); } } diff --git a/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_page.dart b/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_page.dart index ac210b02..71157ec7 100755 --- a/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_page.dart +++ b/lib/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_page.dart @@ -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 { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: '创建公司', + barTitle: '创建公司'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( diff --git a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart index d00eec25..3049a26c 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart @@ -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 senderConfiguringWifiAction() async { if(state.wifiNameController.text.isEmpty){ - showToast('请输入wifi名称'); + showToast('请输入wifi名称'.tr); return; } diff --git a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_page.dart b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_page.dart index 9fe68fe1..f750d0d5 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_page.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_page.dart @@ -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 { - final logic = Get.put(WifiListLogic()); - final state = Get.find().state; + final WifiListLogic logic = Get.put(WifiListLogic()); + final WifiListState state = Get.find().state; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: TitleAppBar( - barTitle: "WIFI列表".tr, + barTitle: 'WIFI列表'.tr, haveBack: true, - actionsList: [ + actionsList: [ 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: [ 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: { 'lockSetInfoData': state.lockSetInfoData.value }); }), @@ -88,16 +88,16 @@ class _WifiListPageState extends State { height: 80.h, margin: EdgeInsets.only(left: 20.w, right: 40.w), child: Column( - children: [ + children: [ SizedBox( height: 79.h, width: 1.sw - 20.w*2, child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Flexible( child: Text( - "$wifiName(${rssi}db)", + '$wifiName(${rssi}db)', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( diff --git a/lib/main/lockDetail/lockSet/diagnose/diagnose_logic.dart b/lib/main/lockDetail/lockSet/diagnose/diagnose_logic.dart index 0384652c..d85e3a42 100755 --- a/lib/main/lockDetail/lockSet/diagnose/diagnose_logic.dart +++ b/lib/main/lockDetail/lockSet/diagnose/diagnose_logic.dart @@ -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 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 } } \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/doorMagnetic/doorMagneticList/doorMagnetic_page.dart b/lib/main/lockDetail/lockSet/doorMagnetic/doorMagneticList/doorMagnetic_page.dart index 556610e5..e9130bc1 100755 --- a/lib/main/lockDetail/lockSet/doorMagnetic/doorMagneticList/doorMagnetic_page.dart +++ b/lib/main/lockDetail/lockSet/doorMagnetic/doorMagneticList/doorMagnetic_page.dart @@ -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); diff --git a/lib/main/lockDetail/lockSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart b/lib/main/lockDetail/lockSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart index cf8fe1d5..01c016da 100755 --- a/lib/main/lockDetail/lockSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart +++ b/lib/main/lockDetail/lockSet/doorMagnetic/nearbyDoorMagnetic/nearbyDoorMagnetic_page.dart @@ -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 { : 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); }); diff --git a/lib/main/lockDetail/lockSet/faceUnlock/faceUnlock_logic.dart b/lib/main/lockDetail/lockSet/faceUnlock/faceUnlock_logic.dart index 0d1b1b44..10b64978 100755 --- a/lib/main/lockDetail/lockSet/faceUnlock/faceUnlock_logic.dart +++ b/lib/main/lockDetail/lockSet/faceUnlock/faceUnlock_logic.dart @@ -1,3 +1,4 @@ + import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; diff --git a/lib/main/lockDetail/lockSet/importOtherLockData/ImportOtherLockData_page.dart b/lib/main/lockDetail/lockSet/importOtherLockData/ImportOtherLockData_page.dart index a807c522..ac7d9ebe 100755 --- a/lib/main/lockDetail/lockSet/importOtherLockData/ImportOtherLockData_page.dart +++ b/lib/main/lockDetail/lockSet/importOtherLockData/ImportOtherLockData_page.dart @@ -105,7 +105,7 @@ class _ImportOtherLockDataPageState extends State { 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 { width: 10.w, ), Text( - '锁${index+1}', + '${'锁'.tr}${index+1}', style: TextStyle( color: AppColors.blackColor, fontSize: 22.sp, diff --git a/lib/main/lockDetail/lockSet/liveVideo/liveVideo_logic.dart b/lib/main/lockDetail/lockSet/liveVideo/liveVideo_logic.dart index 4de0b674..ebb57c15 100755 --- a/lib/main/lockDetail/lockSet/liveVideo/liveVideo_logic.dart +++ b/lib/main/lockDetail/lockSet/liveVideo/liveVideo_logic.dart @@ -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 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 updateCatEyeModeConfig() async { + final VersionUndateEntity entity = await ApiRepository.to.updateCatEyeModeConfig( lockId: state.lockSetInfoData.value.lockId ?? 0, catEyeConfig: [ - { + { 'catEyeMode': 4, - 'catEyeModeConfig': { + 'catEyeModeConfig': { 'recordMode': state.catEyeConfigData.value.catEyeModeConfig!.recordMode, 'recordStartTime': diff --git a/lib/main/lockDetail/lockSet/liveVideo/liveVideo_page.dart b/lib/main/lockDetail/lockSet/liveVideo/liveVideo_page.dart index 281a3128..74e91a8e 100755 --- a/lib/main/lockDetail/lockSet/liveVideo/liveVideo_page.dart +++ b/lib/main/lockDetail/lockSet/liveVideo/liveVideo_page.dart @@ -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 { - final logic = Get.put(LiveVideoLogic()); - final state = Get.find().state; + final LiveVideoLogic logic = Get.put(LiveVideoLogic()); + final LiveVideoState state = Get.find().state; @override initState() { @@ -35,7 +36,7 @@ class _LiveVideoPageState extends State { Navigator.pop(context, true); }, backgroundColor: AppColors.mainColor, - actionsList: [ + actionsList: [ TextButton( child: Text( '保存'.tr, @@ -52,7 +53,7 @@ class _LiveVideoPageState extends State { ], ), body: Obx(() => Column( - children: [ + children: [ SizedBox( height: 80.h, ), @@ -94,7 +95,7 @@ class _LiveVideoPageState extends State { padding: EdgeInsets.only( left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), child: Row( - children: [ + children: [ clickIndex == 0 ? (state.isLiveView.value == false ? Image.asset( @@ -151,7 +152,7 @@ class _LiveVideoPageState extends State { : AppColors.placeholderTextColor, fontSize: 20.sp); - late InlineSpan tipsPreviewSpan = TextSpan(children: [ + late InlineSpan tipsPreviewSpan = TextSpan(children: [ TextSpan(text: titleStr, style: titleStyle), TextSpan(text: subTitle, style: subTipsStyle), ]); diff --git a/lib/main/lockDetail/lockSet/liveVideo/liveVideo_state.dart b/lib/main/lockDetail/lockSet/liveVideo/liveVideo_state.dart index fedd25d5..f35330d2 100755 --- a/lib/main/lockDetail/lockSet/liveVideo/liveVideo_state.dart +++ b/lib/main/lockDetail/lockSet/liveVideo/liveVideo_state.dart @@ -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().obs; + Rx catEyeConfigData = CatEyeConfig().obs; } diff --git a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart index c820e949..190df466 100755 --- a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart +++ b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart @@ -1,3 +1,4 @@ + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart index 5a5d72be..30070575 100755 --- a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart +++ b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_page.dart @@ -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 { mainAxisSize: MainAxisSize.min, children: [ Text( - '固件传输中', + '固件传输中'.tr, style: TextStyle( color: AppColors.mainColor, fontSize: 18.sp, diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart b/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart index 31297bc2..4e01541b 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart @@ -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 toJson() { final Map data = {}; @@ -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 toJson() { final Map data = {}; @@ -76,13 +76,13 @@ class LockSetInfoData { } class LockStatus { - int? roomStatus; LockStatus({this.roomStatus}); LockStatus.fromJson(Map json) { roomStatus = json['roomStatus']; } + int? roomStatus; Map toJson() { final Map data = {}; @@ -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 toJson() { final Map data = {}; @@ -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; - 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; + 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 toJson() { final Map data = {}; @@ -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 toJson() { final Map data = {}; @@ -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; - int? attendance; - int? appUnlockOnline; - int? bluetoothBroadcast; - String? adminPwd; - int? unlockReminderPush; - String? languageSettingLangText; - int? motorTorsion; - int? stayWarn; - int? abnormalWarn; - List? catEyeConfig; - int? faceSwitch; //人脸开关 0:关闭 1:开启 - int? faceAutoLightScreen; //人脸自动亮屏开关 0:关闭 1:开启 - int? faceInductionDistance; //人脸感应距离 - // int? faceAntiMistakeOpen; //人脸防误开门 0:关闭 1:开启 - int? autoLightScreen; //猫眼-自动亮屏开关 0:关闭 1:开启 - int? autoLightScreenTime; //猫眼-自动亮屏时间 - int? faceEnErrUnlock; // 防误开 - - // List? 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 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; + int? attendance; + int? appUnlockOnline; + int? bluetoothBroadcast; + String? adminPwd; + int? unlockReminderPush; + String? languageSettingLangText; + int? motorTorsion; + int? stayWarn; + int? abnormalWarn; + List? catEyeConfig; + int? faceSwitch; //人脸开关 0:关闭 1:开启 + int? faceAutoLightScreen; //人脸自动亮屏开关 0:关闭 1:开启 + int? faceInductionDistance; //人脸感应距离 + // int? faceAntiMistakeOpen; //人脸防误开门 0:关闭 1:开启 + int? autoLightScreen; //猫眼-自动亮屏开关 0:关闭 1:开启 + int? autoLightScreenTime; //猫眼-自动亮屏时间 + int? faceEnErrUnlock; Map toJson() { final Map data = {}; @@ -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? weekDays; - int? isAllDay; PassageModeConfig( {this.startDate, this.endDate, this.weekDays, this.isAllDay}); @@ -671,6 +629,10 @@ class PassageModeConfig { weekDays = json['weekDays'].cast(); isAllDay = json['isAllDay']; } + int? startDate; + int? endDate; + List? weekDays; + int? isAllDay; Map toJson() { final Map data = {}; @@ -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 toJson() { final Map data = {}; @@ -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 toJson() { final Map data = {}; diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index fb0534e1..37b07f57 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -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'; diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index 4a28567e..34d05db6 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -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'; diff --git a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart index 7333c47c..ea0c997a 100755 --- a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart @@ -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 _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 _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { // 设置支持功能解析(带参数) if(reply is SetSupportFunctionsWithParametersReply) { _replySetSupportFunctionsWithParameters(reply); @@ -74,7 +76,7 @@ class LockSoundSetLogic extends BaseGetXController { // 设置支持功能解析 Future _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 getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List 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: [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(); } diff --git a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart index 84fcf4e6..0fabd865 100755 --- a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart +++ b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_page.dart @@ -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 { diff --git a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_state.dart b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_state.dart index 1ee76616..4e4876b4 100755 --- a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_state.dart +++ b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_state.dart @@ -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().obs; + + RxBool isOpenLockSound = false.obs;// 是否开启声音 + RxInt lockSoundLevel = 0.obs;// 音量等级 + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) + RxBool canNext = false.obs; } diff --git a/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart b/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart index 1e16f15d..e3ab45be 100755 --- a/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart +++ b/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart @@ -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; } diff --git a/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart b/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart index 506df887..0fac4ce6 100755 --- a/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart +++ b/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart @@ -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 { diff --git a/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_logic.dart b/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_logic.dart index 7e1fb1f0..a0987503 100755 --- a/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_logic.dart +++ b/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_logic.dart @@ -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 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){ // 跳转到高级功能界面 需要开通高级功能 diff --git a/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_page.dart b/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_page.dart index 852ce921..c86fe034 100755 --- a/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_page.dart +++ b/lib/main/lockDetail/lockSet/markedHouseState/markedHouseState_page.dart @@ -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 { diff --git a/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart b/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart index 943480f9..54668fb2 100755 --- a/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart +++ b/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart @@ -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 _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 _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { if(reply is SetSupportFunctionsNoParametersReply) { _replySetSupportFunctionsWithParameters(reply); } @@ -67,7 +68,7 @@ class MotorPowerLogic extends BaseGetXController { // 设置自动落锁数据解析 Future _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 _readSupportFunctionsNoParameters() async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsNoParametersCommand( keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), @@ -112,21 +113,21 @@ class MotorPowerLogic extends BaseGetXController { Future sendOpenDoorDirection() async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List 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: [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(); } diff --git a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart index 37aaba23..c748da0c 100755 --- a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart +++ b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart @@ -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 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 map = { + '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 _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { if(reply is SetSupportFunctionsWithParametersReply) { _replySetSupportFunctionsWithParameters(reply); } @@ -91,7 +92,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ // 设置自动落锁数据解析 Future _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 getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List 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 list = []; + final List list = []; 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(); diff --git a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart index 03386322..1dc3c77d 100755 --- a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart +++ b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_page.dart @@ -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 with RouteA @override void didChangeDependencies() { - // TODO: implement didChangeDependencies super.didChangeDependencies(); // 路由订阅 @@ -352,7 +350,6 @@ class _NormallyOpenModePageState extends State with RouteA @override void dispose() { - // TODO: implement dispose // 取消路由订阅 AppRouteObserver().routeObserver.unsubscribe(this); super.dispose(); diff --git a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_state.dart b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_state.dart index 885fe31e..7b4c26ca 100755 --- a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_state.dart +++ b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_state.dart @@ -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().obs; + Rx 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; } \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart b/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart index b9dce4b6..49ac3a8d 100755 --- a/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart +++ b/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart @@ -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 _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 getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List 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(); } diff --git a/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_page.dart b/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_page.dart index 72028d08..5d8094ed 100755 --- a/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_page.dart +++ b/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_page.dart @@ -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 { - final logic = Get.put(OpenDoorDirectionLogic()); - final state = Get.find().state; + final OpenDoorDirectionLogic logic = Get.put(OpenDoorDirectionLogic()); + final OpenDoorDirectionState state = Get.find().state; // bool isCheck = false; // int selectIndex = 0; @@ -31,7 +31,7 @@ class _OpenDoorDirectionPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor), body: Column( - children: [ + children: [ SizedBox( height: 60.h, ), @@ -67,10 +67,10 @@ class _OpenDoorDirectionPageState extends State { Row _buildRadioGroupRowWidget() { return Row( mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ + children: [ // SizedBox(width: 60.w,), Row( - children: [ + children: [ Obx(() => _colorfulCheckBox(1)), Text( '左开'.tr, @@ -80,7 +80,7 @@ class _OpenDoorDirectionPageState extends State { ), // SizedBox(width: 100.w), Row( - children: [ + children: [ Obx(() => _colorfulCheckBox(2)), Text( '右开'.tr, @@ -126,7 +126,7 @@ class _OpenDoorDirectionPageState extends State { : AppColors.placeholderTextColor, fontSize: 22.sp); - late InlineSpan tipsPreviewSpan = TextSpan(children: [ + late InlineSpan tipsPreviewSpan = TextSpan(children: [ TextSpan(text: titleStr, style: titleStyle), TextSpan(text: subTitle, style: subTipsStyle), ]); diff --git a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart index fd65a94e..d5cc7d9d 100755 --- a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart +++ b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart @@ -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(); } } diff --git a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart index 523497f5..2baec9b7 100755 --- a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart +++ b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart @@ -72,7 +72,7 @@ class _RemoteUnlockingPageState extends State 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 with RouteAwa @override void didChangeDependencies() { - // TODO: implement didChangeDependencies super.didChangeDependencies(); // 路由订阅 @@ -95,7 +94,6 @@ class _RemoteUnlockingPageState extends State with RouteAwa @override void dispose() { - // TODO: implement dispose // 取消路由订阅 AppRouteObserver().routeObserver.unsubscribe(this); super.dispose(); diff --git a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_state.dart b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_state.dart index ee1de354..36fcf9ea 100755 --- a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_state.dart +++ b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_state.dart @@ -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().obs; + RxInt remoteEnable = 1.obs; + + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs; } \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart b/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart index 233f464a..526a829e 100755 --- a/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart +++ b/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart @@ -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 _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 _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { if(reply is SetSupportFunctionsNoParametersReply) { _replySetSupportFunctionsWithParameters(reply); } @@ -69,7 +70,7 @@ class ResetButtonLogic extends BaseGetXController{ // 设置自动落锁数据解析 Future _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 getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List 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(); } diff --git a/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart b/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart index dac60883..b810e956 100755 --- a/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart +++ b/lib/main/lockDetail/lockSet/resetButton/resetButton_page.dart @@ -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 { diff --git a/lib/main/lockDetail/lockSet/resetButton/resetButton_state.dart b/lib/main/lockDetail/lockSet/resetButton/resetButton_state.dart index 9fae5267..503f27c2 100755 --- a/lib/main/lockDetail/lockSet/resetButton/resetButton_state.dart +++ b/lib/main/lockDetail/lockSet/resetButton/resetButton_state.dart @@ -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().obs; + + RxInt resetButtonEnable = 1.obs; + + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs; } diff --git a/lib/main/lockDetail/lockSet/unlockQRCode/unlockQRCode_page.dart b/lib/main/lockDetail/lockSet/unlockQRCode/unlockQRCode_page.dart index 2fb0adad..254c857e 100755 --- a/lib/main/lockDetail/lockSet/unlockQRCode/unlockQRCode_page.dart +++ b/lib/main/lockDetail/lockSet/unlockQRCode/unlockQRCode_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; diff --git a/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart b/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart index 41473423..3fea8596 100644 --- a/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart +++ b/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart @@ -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){ diff --git a/lib/main/lockDetail/lockSet/uploadData/uploadData_page.dart b/lib/main/lockDetail/lockSet/uploadData/uploadData_page.dart index 06e91bb6..5d3686d1 100755 --- a/lib/main/lockDetail/lockSet/uploadData/uploadData_page.dart +++ b/lib/main/lockDetail/lockSet/uploadData/uploadData_page.dart @@ -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 { diff --git a/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart b/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart index 979bf91f..20c4ce51 100755 --- a/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart +++ b/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboard/addWirelessKeyboard_page.dart @@ -90,8 +90,4 @@ class _AddWirelessKeyboardPageState extends State { ), ); } - - void onShow() {} - - void onHide() {} } diff --git a/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboardScreenNotLightOn/addWirelessKeyboardScreenNotLightOn_page.dart b/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboardScreenNotLightOn/addWirelessKeyboardScreenNotLightOn_page.dart index 59234a35..33eeec95 100755 --- a/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboardScreenNotLightOn/addWirelessKeyboardScreenNotLightOn_page.dart +++ b/lib/main/lockDetail/lockSet/wirelessKeyboard/addWirelessKeyboardScreenNotLightOn/addWirelessKeyboardScreenNotLightOn_page.dart @@ -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() {} } diff --git a/lib/main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWirelessKeyboard_page.dart b/lib/main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWirelessKeyboard_page.dart index 20d2714d..b81f18cc 100755 --- a/lib/main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWirelessKeyboard_page.dart +++ b/lib/main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWirelessKeyboard_page.dart @@ -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 : 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); }); }), diff --git a/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart b/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart index b0958274..f206a3bc 100755 --- a/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart +++ b/lib/main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart @@ -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 { context: Get.context!, builder: (context) { return CupertinoAlertDialog( - title: const Text('该锁的无线键盘都将被删除'), + title: Text('该锁的无线键盘都将被删除'.tr), actions: [ CupertinoDialogAction( child: Text('取消'.tr), diff --git a/lib/main/lockDetail/videoLog/common/video/controller_widget.dart b/lib/main/lockDetail/videoLog/common/video/controller_widget.dart index d342986b..be227123 100755 --- a/lib/main/lockDetail/videoLog/common/video/controller_widget.dart +++ b/lib/main/lockDetail/videoLog/common/video/controller_widget.dart @@ -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 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(); @@ -26,7 +21,6 @@ class ControllerWidget extends InheritedWidget { @override bool updateShouldNotify(InheritedWidget oldWidget) { - // TODO: implement updateShouldNotify return false; } diff --git a/lib/main/lockDetail/videoLog/common/video/video_player_UI.dart b/lib/main/lockDetail/videoLog/common/video/video_player_UI.dart index 2b32e04d..99b9e77e 100755 --- a/lib/main/lockDetail/videoLog/common/video/video_player_UI.dart +++ b/lib/main/lockDetail/videoLog/common/video/video_player_UI.dart @@ -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 { } 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 { ); } 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 { }); } - void _videoListener() async { + Future _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) { diff --git a/lib/main/lockDetail/videoLog/common/video/video_player_control.dart b/lib/main/lockDetail/videoLog/common/video/video_player_control.dart index 662d53eb..060417c2 100755 --- a/lib/main/lockDetail/videoLog/common/video/video_player_control.dart +++ b/lib/main/lockDetail/videoLog/common/video/video_player_control.dart @@ -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 { 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 { child: AnimatedOpacity( // 加入透明度动画 opacity: _playControlOpacity, - duration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), child: Column( children: [_top(), _middle(), _bottom(context)], ), @@ -89,7 +89,7 @@ class VideoPlayerControlState extends State { // 底部控件的容器 width: double.infinity, height: 40, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( // 来点黑色到透明的渐变优雅一下 begin: Alignment.bottomCenter, @@ -120,7 +120,7 @@ class VideoPlayerControlState extends State { ), 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 { _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 { _isFullScreen ? Icons.fullscreen_exit : Icons.fullscreen, color: Colors.white, ), - onPressed: () { - // 点击切换是否全屏 - _toggleFullScreen(); - }, + onPressed: _toggleFullScreen, ), ], ), @@ -161,7 +158,7 @@ class VideoPlayerControlState extends State { 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 { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ //在最上层或者不是横屏则隐藏按钮 - 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 { /// 如果显示就隐藏 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 { 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; }); }); diff --git a/lib/main/lockDetail/videoLog/common/video/video_player_pan.dart b/lib/main/lockDetail/videoLog/common/video/video_player_pan.dart index bbbb43c1..81fc7918 100755 --- a/lib/main/lockDetail/videoLog/common/video/video_player_pan.dart +++ b/lib/main/lockDetail/videoLog/common/video/video_player_pan.dart @@ -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 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 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 /// 左边触摸 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 } 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 ); 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; }); } diff --git a/lib/main/lockDetail/videoLog/common/video/video_player_slider.dart b/lib/main/lockDetail/videoLog/common/video/video_player_slider.dart index 190abe6b..1895fe46 100755 --- a/lib/main/lockDetail/videoLog/common/video/video_player_slider.dart +++ b/lib/main/lockDetail/videoLog/common/video/video_player_slider.dart @@ -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 { 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, //滑块大小 diff --git a/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_logic.dart b/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_logic.dart index 19e0ee91..f6d1dacd 100755 --- a/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_logic.dart +++ b/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_logic.dart @@ -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 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 getLockCloudStorageList() async { + final VideoLogEntity entity = await ApiRepository.to.getLockCloudStorageList( lockId: state.getLockId.value, ); if (entity.errorCode!.codeIsSuccessful) { diff --git a/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart b/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart index 9ba5e6b1..d7957341 100755 --- a/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart +++ b/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart @@ -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 { - final logic = Get.put(EditVideoLogLogic()); - final state = Get.find().state; + final EditVideoLogLogic logic = Get.put(EditVideoLogLogic()); + final EditVideoLogState state = Get.find().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: [ TextButton( child: Text( - "全选".tr, + '全选'.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () async { @@ -67,19 +69,19 @@ class _EditVideoLogPageState extends State { ], ), body: Column( - children: [ + children: [ 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: [ Container( margin: EdgeInsets.only( left: 20.w, top: 15.w, bottom: 15.w), - child: Row(children: [ - Text(item.date ?? "", + child: Row(children: [ + Text(item.date ?? '', style: TextStyle(fontSize: 20.sp)), ])), mainListView(index, item) @@ -93,8 +95,8 @@ class _EditVideoLogPageState extends State { ); } - 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 { 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 { setState(() {}); }, child: Stack( - children: [ + children: [ Column( - children: [ + children: [ Container( width: itemW, height: itemW, @@ -146,7 +148,7 @@ class _EditVideoLogPageState extends State { 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 { 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 { Widget bottomBottomBtnWidget() { return SizedBox( width: 1.sw, - child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ 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: >{ + 'downloadVideoLogList': state.selectVideoLogList.value }); } else { logic.showToast('请选择要下载的视频'); @@ -190,8 +192,8 @@ class _EditVideoLogPageState extends State { }), 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 { 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: [ SizedBox(height: 30.w), Image.asset(iconUrl, width: wh, height: wh, fit: BoxFit.fitWidth), SizedBox(height: 10.w), diff --git a/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_state.dart b/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_state.dart index 83d561e6..e7ae301e 100755 --- a/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_state.dart +++ b/lib/main/lockDetail/videoLog/editVideoLog/editVideoLog_state.dart @@ -2,10 +2,6 @@ import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart'; class EditVideoLogState { - var selectVideoLogList = [].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 selectVideoLogList = [].obs; //选中的视频列表 + RxBool isSelectAll = false.obs; + RxList videoLogList = [].obs; //全部的视频列表 + RxInt getLockId = 0.obs; } diff --git a/lib/main/lockDetail/videoLog/videoLog/videoLog_page.dart b/lib/main/lockDetail/videoLog/videoLog/videoLog_page.dart index eab12c80..5a23d226 100755 --- a/lib/main/lockDetail/videoLog/videoLog/videoLog_page.dart +++ b/lib/main/lockDetail/videoLog/videoLog/videoLog_page.dart @@ -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 { - final logic = Get.put(VideoLogLogic()); - final state = Get.find().state; + final VideoLogLogic logic = Get.put(VideoLogLogic()); + final VideoLogState state = Get.find().state; @override Widget build(BuildContext context) { @@ -33,7 +35,7 @@ class _VideoLogPageState extends State { backgroundColor: AppColors.mainColor, ), body: Column( - children: [ + children: [ // 云存顶部 Visibility(visible: !state.isNavLocal.value, child: vipTip()), // 本地顶部 @@ -45,15 +47,15 @@ class _VideoLogPageState extends State { 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: [ Container( margin: EdgeInsets.only( left: 20.w, top: 15.w, bottom: 15.w), - child: Row(children: [ - Text(item.date ?? "", + child: Row(children: [ + Text(item.date ?? '', style: TextStyle(fontSize: 20.sp)), ])), mainListView(index, item) @@ -67,14 +69,14 @@ class _VideoLogPageState extends State { child: state.localList.isNotEmpty ? ListView.builder( itemCount: 5, - itemBuilder: (c, index) { + itemBuilder: (BuildContext c, int index) { return Column( - children: [ + children: [ Container( margin: EdgeInsets.only( left: 20.w, top: 15.w, bottom: 15.w), - child: Row(children: [ - Text("2023.10.2$index", + child: Row(children: [ + Text('2023.10.2$index', style: TextStyle(fontSize: 20.sp)), ])), mainListView(index, CloudStorageData()), @@ -94,14 +96,14 @@ class _VideoLogPageState extends State { // color: Colors.white, child: Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ 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 { 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 { color: const Color(0xFFF6F7F8), borderRadius: BorderRadius.circular(20.h)), child: Row( - children: [ + children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("3天滚动储存".tr, style: TextStyle(fontSize: 24.sp)), + children: [ + 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 { color: const Color(0xFFF6F7F8), borderRadius: BorderRadius.circular(20.h)), child: Row( - children: [ + children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ // 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 { 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 { margin: EdgeInsets.only(left: 20.w), child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(state.isNavLocal.value == true ? "已下载".tr : "全部视频".tr, + children: [ + 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 { 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: { + 'videoDataList': state.videoLogList.value, + 'lockId': state.getLockId.value }); }, ) @@ -245,8 +247,8 @@ class _VideoLogPageState extends State { ); } - 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 { 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 { Widget videoItem(RecordListData recordData) { return GestureDetector( onTap: () { - Get.toNamed(Routers.videoLogDetailPage, arguments: { - "recordData": recordData, - "videoDataList": state.videoLogList.value + Get.toNamed(Routers.videoLogDetailPage, arguments: { + 'recordData': recordData, + 'videoDataList': state.videoLogList.value }); }, child: SizedBox( width: itemW, height: itemH, child: Column( - children: [ + children: [ Container( width: itemW, height: itemW, @@ -294,7 +296,7 @@ class _VideoLogPageState extends State { child: Image( fit: BoxFit.cover, image: Image.network(recordData.imagesUrl ?? - "images/icon_video_placeholder.jpg") + 'images/icon_video_placeholder.jpg') .image), ), ), diff --git a/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart b/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart index b1d56954..28824226 100755 --- a/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart +++ b/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart @@ -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')), ), ], ), diff --git a/lib/main/lockDetail/videoLog/videoLogDetail/videoLogDetail_page.dart b/lib/main/lockDetail/videoLog/videoLogDetail/videoLogDetail_page.dart index dc3938d0..2791055d 100755 --- a/lib/main/lockDetail/videoLog/videoLogDetail/videoLogDetail_page.dart +++ b/lib/main/lockDetail/videoLog/videoLogDetail/videoLogDetail_page.dart @@ -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 { - final logic = Get.put(VideoLogDetailLogic()); - final state = Get.find().state; + final VideoLogDetailLogic logic = Get.put(VideoLogDetailLogic()); + final VideoLogDetailState state = Get.find().state; @override void initState() { @@ -42,12 +44,12 @@ class _VideoLogDetailPageState extends State { return Scaffold( backgroundColor: Colors.white, appBar: TitleAppBar( - barTitle: "视频播放".tr, + barTitle: '视频播放'.tr, haveBack: true, backgroundColor: AppColors.mainColor, ), body: Column( - children: [ + children: [ AspectRatio( aspectRatio: state.videoController.value.aspectRatio, child: Stack( @@ -58,10 +60,8 @@ class _VideoLogDetailPageState extends State { 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 { child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, - children: [ + children: [ Row( - children: [ + children: [ Text( DateTool().dateToYMDString( state.recordData.value.operateDate.toString()), @@ -84,7 +84,7 @@ class _VideoLogDetailPageState extends State { ), SizedBox(height: 15.h), Row( - children: [ + children: [ videoItem(true, state.recordData.value), ], ), @@ -93,15 +93,15 @@ class _VideoLogDetailPageState extends State { 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: [ Container( margin: EdgeInsets.only( left: 20.w, top: 15.w, bottom: 15.w), - child: Row(children: [ - Text(item.date ?? "", + child: Row(children: [ + Text(item.date ?? '', style: TextStyle(fontSize: 20.sp)), ])), mainListView(index, item) @@ -131,8 +131,8 @@ class _VideoLogDetailPageState extends State { ); } - 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 { 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 { width: itemW, height: itemH, child: Stack( - children: [ + children: [ Column( - children: [ + children: [ ClipRRect( borderRadius: BorderRadius.circular(10.w), - child: Stack(children: [ + child: Stack(children: [ Container( width: itemW, height: itemW, @@ -175,7 +175,7 @@ class _VideoLogDetailPageState extends State { 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 { // 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 { } String formatString(time) { - var shortName = time.toString().substring(2, 7); + String shortName = time.toString().substring(2, 7); return shortName; } diff --git a/lib/main/lockDetail/videoLog/videoLogDownLoad/videoLogDownLoad_page.dart b/lib/main/lockDetail/videoLog/videoLogDownLoad/videoLogDownLoad_page.dart index 43b426f3..0bce20e8 100755 --- a/lib/main/lockDetail/videoLog/videoLogDownLoad/videoLogDownLoad_page.dart +++ b/lib/main/lockDetail/videoLog/videoLogDownLoad/videoLogDownLoad_page.dart @@ -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 { - final logic = Get.put(VideoLogDownLoadLogic()); - final state = Get.find().state; + final VideoLogDownLoadLogic logic = Get.put(VideoLogDownLoadLogic()); + final VideoLogDownLoadState state = Get.find().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: [ Expanded( child: Obx( () => state.videoLogDownloadList.isNotEmpty @@ -46,21 +47,21 @@ class _VideoLogDownLoadPageState extends State { ); } - 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 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 { EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h), color: Colors.white, child: Row( - children: [ + children: [ ClipRRect( borderRadius: BorderRadius.circular(10.w), child: Image( @@ -79,14 +80,14 @@ class _VideoLogDownLoadPageState extends State { 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: [ Text( DateTool() .dateToYMDHNString(recordData.operateDate.toString()), diff --git a/lib/mine/about/about_console.dart b/lib/mine/about/about_console.dart index 1673d87c..9796f51f 100755 --- a/lib/mine/about/about_console.dart +++ b/lib/mine/about/about_console.dart @@ -8,21 +8,18 @@ class AboutConsole extends GetxController { int _clickCount = 0; Timer? _timer; - void handleTap() async { + Future handleTap() async { _clickCount++; if (_clickCount == 1) { // 开始一个新的计时器 - _timer = Timer(const Duration(seconds: 3), () { - // 3秒内没有点击到15次,则重置 - _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); diff --git a/lib/mine/about/about_page.dart b/lib/mine/about/about_page.dart index 9c9dba8c..ad8318a4 100755 --- a/lib/mine/about/about_page.dart +++ b/lib/mine/about/about_page.dart @@ -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); diff --git a/lib/mine/about/debug/controller.dart b/lib/mine/about/debug/controller.dart index b5c67ff1..4a0f282e 100755 --- a/lib/mine/about/debug/controller.dart +++ b/lib/mine/about/debug/controller.dart @@ -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 logs; - final _streamController = BehaviorSubject>(); DebugConsoleController({List? logs}) : logs = logs ?? []; + final List logs; + final BehaviorSubject> _streamController = BehaviorSubject>(); Stream> 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 randomlyCreate32Users(int count, int max) async { diff --git a/lib/mine/about/debug/debug_console.dart b/lib/mine/about/debug/debug_console.dart index ebb3406a..20ae4137 100755 --- a/lib/mine/about/debug/debug_console.dart +++ b/lib/mine/about/debug/debug_console.dart @@ -317,7 +317,9 @@ class _DebugConsoleState extends State { child: const Text('清除日志'), ), PopupMenuItem( - onTap: () => widget.controller.showMore(context), + onTap: () { + // widget.controller.showMore(context); + }, child: const Text('更多'), ), ], diff --git a/lib/mine/about/debug/debug_tool.dart b/lib/mine/about/debug/debug_tool.dart index 20e1d58e..c6a8ffcd 100755 --- a/lib/mine/about/debug/debug_tool.dart +++ b/lib/mine/about/debug/debug_tool.dart @@ -15,13 +15,13 @@ class DeBug { static late OverlayEntry overlayEntry; static void showFloatWidget() { - Rx offset = Offset(20, 100).obs; // 初始位置 - overlayEntry = OverlayEntry(builder: (context) { + final Rx 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: >[], expandStackTrace: false, savePath: null, ), diff --git a/lib/mine/about/debug/tile.dart b/lib/mine/about/debug/tile.dart index 1a1a6b4e..c9648e59 100755 --- a/lib/mine/about/debug/tile.dart +++ b/lib/mine/about/debug/tile.dart @@ -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 createState() => _DebugConsoleTileState(); @@ -101,9 +102,9 @@ class _DebugConsoleTileState extends State { } class DeBugText extends StatefulWidget { - final DebugConsoleLog log; DeBugText(this.log, {key}); + final DebugConsoleLog log; @override State createState() => _DeBugTextState(); @@ -114,13 +115,13 @@ class _DeBugTextState extends State { 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( diff --git a/lib/mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart b/lib/mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart index b15d9f1d..0328fdbe 100755 --- a/lib/mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart +++ b/lib/mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart @@ -116,7 +116,7 @@ class _AddLockSelectCountryPageState extends State { children: [ TextButton( child: Text( - '跳过', + '跳过'.tr, style: TextStyle(color: Colors.black, fontSize: 24.sp), ), onPressed: () { @@ -138,7 +138,7 @@ class _AddLockSelectCountryPageState extends State { ), onPressed: () { if(selectindex == 10000){ - logic.showToast('请选择国家'); + logic.showToast('请选择国家'.tr); return; } final CountryRegionModel model = countriesList[selectindex]; diff --git a/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_logic.dart b/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_logic.dart index dd6c9add..bc55b983 100755 --- a/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_logic.dart +++ b/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_logic.dart @@ -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(); } diff --git a/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart b/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart index 5d7c9717..337dc747 100755 --- a/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart +++ b/lib/mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart @@ -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 @override void didChangeDependencies() { - // TODO: implement didChangeDependencies super.didChangeDependencies(); /// 路由订阅 diff --git a/lib/mine/addLock/lockAddress/lockAddress/lockAddress_page.dart b/lib/mine/addLock/lockAddress/lockAddress/lockAddress_page.dart index e8ce0c14..ddea7055 100755 --- a/lib/mine/addLock/lockAddress/lockAddress/lockAddress_page.dart +++ b/lib/mine/addLock/lockAddress/lockAddress/lockAddress_page.dart @@ -35,7 +35,7 @@ class _LockAddressPageState extends State with RouteAware{ ), onPressed: () { if(addressInfo!.isEmpty){ - EasyLoading.showToast('请先获取到位置信息哦!', duration: 2000.milliseconds); + EasyLoading.showToast('请先获取到位置信息哦'.tr, duration: 2000.milliseconds); return; } Get.toNamed(Routers.saveLockPage, arguments: addressInfo); diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index 61f35c3c..e2cb9170 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -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 publicKey = reply.data.sublist(3); final List 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 _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 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 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 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 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 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 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 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 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 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 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 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 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 featureEnVal = @@ -366,7 +363,7 @@ class NearbyLockLogic extends BaseGetXController { // if (state == BluetoothConnectionState.connected) { // dismissEasyLoading(); - AppLog.log('开始获取锁状态'); + // AppLog.log('开始获取锁状态'); final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -378,9 +375,9 @@ class NearbyLockLogic extends BaseGetXController { DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000), [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; } diff --git a/lib/mine/addLock/selectLockType/selectLockType_page.dart b/lib/mine/addLock/selectLockType/selectLockType_page.dart index b797a0aa..bb8dfa20 100755 --- a/lib/mine/addLock/selectLockType/selectLockType_page.dart +++ b/lib/mine/addLock/selectLockType/selectLockType_page.dart @@ -9,7 +9,6 @@ import '../../../app_settings/app_colors.dart'; import '../../../baseWidget.dart'; import '../../../tools/commonDataManage.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; import 'selectLockType_logic.dart'; class SelectLockTypePage extends StatefulWidget { diff --git a/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart b/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart index 84f61a5d..2badbbe6 100755 --- a/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart +++ b/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart @@ -7,7 +7,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 'gatewayConfigurationWifi_logic.dart'; import 'gatewayConfigurationWifi_state.dart'; diff --git a/lib/mine/gateway/addGateway/selectGatewayType/selectGatewayType_page.dart b/lib/mine/gateway/addGateway/selectGatewayType/selectGatewayType_page.dart index e1eb90fa..cb55f107 100755 --- a/lib/mine/gateway/addGateway/selectGatewayType/selectGatewayType_page.dart +++ b/lib/mine/gateway/addGateway/selectGatewayType/selectGatewayType_page.dart @@ -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:get/get.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; class SelectGatewayTypePage extends StatefulWidget { const SelectGatewayTypePage({Key? key}) : super(key: key); @@ -26,7 +26,7 @@ class _SelectGatewayTypePageState extends State { body: ListView( children: [ _selectGatewayType( - 'images/mine/icon_mine_selectGatewayType_G2.png', "G2(Wi-Fi)", + 'images/mine/icon_mine_selectGatewayType_G2.png', 'G2(Wi-Fi)', () { Navigator.pushNamed(context, Routers.selectGatewayTypeNextTipPage); }), @@ -34,7 +34,7 @@ class _SelectGatewayTypePageState extends State { height: 2.h, ), _selectGatewayType( - 'images/mine/icon_mine_selectGatewayType_G4.png', "G4(4G) ", + 'images/mine/icon_mine_selectGatewayType_G4.png', 'G4(4G) ', () { Navigator.pushNamed(context, Routers.selectGatewayTypeNextTipPage); }), diff --git a/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart b/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart index fb06347a..18f8d43b 100755 --- a/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart +++ b/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart @@ -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 '../../../tools/commonItem.dart'; import '../../../tools/showTFView.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class GatewayDetailPage extends StatefulWidget { const GatewayDetailPage({Key? key}) : super(key: key); @@ -93,7 +93,7 @@ class _GatewayDetailPageState extends State { builder: (BuildContext context) { return ShowTFView( title: '修改姓名'.tr, - tipTitle: '请输入', + tipTitle: '请输入'.tr, controller: _changeGatewayNameController); }); } diff --git a/lib/mine/gateway/gatewayList/gatewayList_page.dart b/lib/mine/gateway/gatewayList/gatewayList_page.dart index 737d7f23..14d417fc 100755 --- a/lib/mine/gateway/gatewayList/gatewayList_page.dart +++ b/lib/mine/gateway/gatewayList/gatewayList_page.dart @@ -42,8 +42,8 @@ class _GatewayListPageState extends State { itemBuilder: (c, index) { return _gatewatListItem( 'images/mine/icon_mine_gatewayListMainIcon.png', - '星锁网关', - '在线', + '', + '', '2', () { Navigator.pushNamed(context, Routers.gatewayDetailPage); }); @@ -112,7 +112,7 @@ class _GatewayListPageState extends State { width: 10.w, ), Text( - '在线', + '', style: TextStyle(fontSize: 18.sp), ), SizedBox( diff --git a/lib/mine/mall/lockMall_logic.dart b/lib/mine/mall/lockMall_logic.dart index fc41e91d..a9f03310 100755 --- a/lib/mine/mall/lockMall_logic.dart +++ b/lib/mine/mall/lockMall_logic.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:fluwx/fluwx.dart'; import 'package:get/get.dart'; @@ -13,7 +12,6 @@ import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/pay/wx_pay_tool.dart'; import 'package:webview_flutter/webview_flutter.dart'; -import '../../app_settings/app_settings.dart'; import '../../tools/baseGetXController.dart'; class LockMallLogic extends BaseGetXController { @@ -110,10 +108,10 @@ class LockMallLogic extends BaseGetXController { Get.back(); } else { if (_lastPressedAt == null || - DateTime.now().difference(_lastPressedAt!) > Duration(seconds: 2)) { + DateTime.now().difference(_lastPressedAt!) > const Duration(seconds: 2)) { // 如果两次返回键时间间隔大于 2 秒,则提示再次按下返回键退出 _lastPressedAt = DateTime.now(); - showToast('再返回一次退出${F.title}'); + showToast('再返回一次退出'.tr + F.title); return false; // 阻止返回操作 } SystemNavigator.pop(); @@ -145,9 +143,4 @@ class LockMallLogic extends BaseGetXController { super.onInit(); getMallURLRequest(); } - - @override - void onClose() { - super.onClose(); - } } diff --git a/lib/mine/mall/lockMall_state.dart b/lib/mine/mall/lockMall_state.dart index 2f7e687c..ee57e25a 100755 --- a/lib/mine/mall/lockMall_state.dart +++ b/lib/mine/mall/lockMall_state.dart @@ -6,15 +6,15 @@ import 'package:webview_flutter/webview_flutter.dart'; class LockMallState { LockMallState({required this.allowReturn}); - var lockMallUrl = "".obs; - var webProgress = 0.0.obs; + RxString lockMallUrl = ''.obs; + RxDouble webProgress = 0.0.obs; bool allowReturn; bool canGoBack = false; late WebViewController mallWebView = initWebViewController(); //初始化webView控制器 WebViewController initWebViewController() { - WebViewController allWebView = WebViewController(); + final WebViewController allWebView = WebViewController(); allWebView.setJavaScriptMode(JavaScriptMode.unrestricted); allWebView.setBackgroundColor(Colors.white); allWebView.setUserAgent(WebViewLogic.userAgent); diff --git a/lib/mine/message/messageDetail/messageDetail_logic.dart b/lib/mine/message/messageDetail/messageDetail_logic.dart index 72571baa..8614f6e2 100755 --- a/lib/mine/message/messageDetail/messageDetail_logic.dart +++ b/lib/mine/message/messageDetail/messageDetail_logic.dart @@ -9,8 +9,8 @@ class MessageDetailLogic extends BaseGetXController { final MessageDetailState state = MessageDetailState(); //请求密码钥匙列表 - void readMessageDataRequest() async { - MessageListEntity entity = await ApiRepository.to.readMessageLoadData(messageId:state.itemData.value.id!); + Future readMessageDataRequest() async { + final MessageListEntity entity = await ApiRepository.to.readMessageLoadData(messageId:state.itemData.value.id!); if (entity.errorCode!.codeIsSuccessful) { eventBus.fire(ReadMessageRefreshUI()); } @@ -18,20 +18,12 @@ class MessageDetailLogic extends BaseGetXController { @override void onReady() { - // TODO: implement onReady super.onReady(); readMessageDataRequest(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - @override void onClose() { - // TODO: implement onClose super.onClose(); } } \ No newline at end of file diff --git a/lib/mine/message/messageDetail/messageDetail_page.dart b/lib/mine/message/messageDetail/messageDetail_page.dart index 24d6b720..4534dade 100755 --- a/lib/mine/message/messageDetail/messageDetail_page.dart +++ b/lib/mine/message/messageDetail/messageDetail_page.dart @@ -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/flavors.dart'; +import 'package:star_lock/mine/message/messageDetail/messageDetail_state.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/dateTool.dart'; @@ -16,8 +18,8 @@ class MessageDetailPage extends StatefulWidget { } class _MessageDetailPageState extends State { - final logic = Get.put(MessageDetailLogic()); - final state = Get.find().state; + final MessageDetailLogic logic = Get.put(MessageDetailLogic()); + final MessageDetailState state = Get.find().state; @override Widget build(BuildContext context) { @@ -25,12 +27,12 @@ class _MessageDetailPageState extends State { backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( skyCall: () => TitleAppBar( - barTitle: "消息详情".tr, + barTitle: '消息详情'.tr, haveBack: true, backgroundColor: AppColors.mainColor, ), xhjCall: () => TitleAppBar( - barTitle: "消息详情".tr, + barTitle: '消息详情'.tr, haveBack: true, backgroundColor: Colors.white, iconColor: AppColors.blackColor, @@ -41,7 +43,7 @@ class _MessageDetailPageState extends State { margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h), child: Obx(() => Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( "${"创建时间".tr}:${DateTool().dateToYMDHNString(state.itemData.value.createdAt!.toString())}", style: TextStyle( diff --git a/lib/mine/message/messageList/messageList_logic.dart b/lib/mine/message/messageList/messageList_logic.dart index dc4e0b22..8541d183 100755 --- a/lib/mine/message/messageList/messageList_logic.dart +++ b/lib/mine/message/messageList/messageList_logic.dart @@ -13,7 +13,7 @@ class MessageListLogic extends BaseGetXController { //请求消息列表 Future messageListDataRequest() async { - MessageListEntity entity = await ApiRepository.to.messageListLoadData( + final MessageListEntity entity = await ApiRepository.to.messageListLoadData( pageNo:pageNo.toString(), pageSize:pageSize); if (entity.errorCode!.codeIsSuccessful) { @@ -31,16 +31,16 @@ class MessageListLogic extends BaseGetXController { } // 删除消息 - void deletMessageDataRequest(String messageId, BlockDeletSuccssCallback blockDeletSuccssCallback) async { - MessageListEntity entity = await ApiRepository.to.deletMessageLoadData(messageId:messageId); + Future deletMessageDataRequest(String messageId, BlockDeletSuccssCallback blockDeletSuccssCallback) async { + final MessageListEntity entity = await ApiRepository.to.deletMessageLoadData(messageId:messageId); if (entity.errorCode!.codeIsSuccessful) { blockDeletSuccssCallback(); } } // 清空消息 - void deletAllMessageDataRequest() async { - MessageListEntity entity = await ApiRepository.to.deletAllMessageLoadData(); + Future deletAllMessageDataRequest() async { + final MessageListEntity entity = await ApiRepository.to.deletAllMessageLoadData(); if (entity.errorCode!.codeIsSuccessful) { pageNo = 1; messageListDataRequest(); @@ -59,22 +59,14 @@ class MessageListLogic extends BaseGetXController { @override void onReady() { - // TODO: implement onReady super.onReady(); // messageListDataRequest(); _readMessageRefreshUIAction(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - @override void onClose() { - // TODO: implement onClose super.onClose(); _readMessageRefreshUIEvent?.cancel(); } diff --git a/lib/mine/message/messageList/messageList_page.dart b/lib/mine/message/messageList/messageList_page.dart index c6e2c049..cbaed343 100755 --- a/lib/mine/message/messageList/messageList_page.dart +++ b/lib/mine/message/messageList/messageList_page.dart @@ -1,5 +1,7 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:get/get.dart'; import 'package:star_lock/mine/message/messageList/messageList_state.dart'; import 'package:star_lock/tools/noData.dart'; @@ -11,10 +13,8 @@ import '../../../tools/dateTool.dart'; import '../../../tools/showTipView.dart'; import '../../../tools/storage.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; import 'messageList_entity.dart'; import 'messageList_logic.dart'; -import 'package:flutter_slidable/flutter_slidable.dart'; class MessageListPage extends StatefulWidget { MessageListPage({Key? key, this.showAppBar = true}) : super(key: key); diff --git a/lib/mine/message/messageList/messageList_xhj_page.dart b/lib/mine/message/messageList/messageList_xhj_page.dart index ace80c85..f1b9710e 100755 --- a/lib/mine/message/messageList/messageList_xhj_page.dart +++ b/lib/mine/message/messageList/messageList_xhj_page.dart @@ -1,5 +1,7 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:get/get.dart'; import 'package:star_lock/mine/message/messageList/messageList_state.dart'; import 'package:star_lock/tools/noData.dart'; @@ -10,11 +12,8 @@ import '../../../tools/EasyRefreshTool.dart'; import '../../../tools/dateTool.dart'; import '../../../tools/showTipView.dart'; import '../../../tools/storage.dart'; -import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; import 'messageList_entity.dart'; import 'messageList_logic.dart'; -import 'package:flutter_slidable/flutter_slidable.dart'; class MessageListXHJPage extends StatefulWidget { MessageListXHJPage({Key? key, this.showAppBar = true}) : super(key: key); diff --git a/lib/mine/mine/safeVerify/safeVerify_logic.dart b/lib/mine/mine/safeVerify/safeVerify_logic.dart index c590b381..3382bf78 100755 --- a/lib/mine/mine/safeVerify/safeVerify_logic.dart +++ b/lib/mine/mine/safeVerify/safeVerify_logic.dart @@ -1,3 +1,4 @@ + import 'dart:async'; import 'package:flutter/cupertino.dart'; @@ -6,13 +7,14 @@ import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; +import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; +import 'package:star_lock/login/selectCountryRegion/common/index.dart'; import 'package:star_lock/mine/mine/safeVerify/safeVerify_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../../login/login/entity/LoginData.dart'; -import 'package:star_lock/login/selectCountryRegion/common/index.dart'; -import 'package:star_lock/tools/storage.dart'; class SafeVerifyLogic extends BaseGetXController { final SafeVerifyState state = SafeVerifyState(); @@ -36,9 +38,9 @@ class SafeVerifyLogic extends BaseGetXController { //获取验证码请求 void sendValidationCode() async { - var entity = await ApiRepository.to.sendValidationCodeAuth( - countryCode: "", - account: "", + final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeAuth( + countryCode: '', + account: '', channel: state.channel.value, codeType: state.codeType.value, xWidth: state.xWidth.value.toString()); @@ -49,10 +51,10 @@ class SafeVerifyLogic extends BaseGetXController { //删除账号请求 Future deleteAccountRequest() async { - LoginEntity entity = + final LoginEntity entity = await ApiRepository.to.deleteAccount(state.channel.value, state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("验证成功,账号已删除"); + showToast('验证成功,账号已删除'.tr); //删除账号成功, Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); } @@ -81,7 +83,7 @@ class SafeVerifyLogic extends BaseGetXController { ///初始化本地数据 void initLoginData() async { - final data = await Storage.getString(saveUserLoginData); + final String? data = await Storage.getString(saveUserLoginData); if (data != null && data.isNotEmpty) { state.loginData.value = LoginData.fromJson(jsonDecode(data)); bool mobileIsNotEmpty = state.loginData.value.mobile != null && state.loginData.value.mobile!.isNotEmpty; @@ -105,20 +107,10 @@ class SafeVerifyLogic extends BaseGetXController { } } - @override - void onReady() { - super.onReady(); - } - @override void onInit() { super.onInit(); initLoginData(); } - - @override - void onClose() { - super.onClose(); - } } diff --git a/lib/mine/mine/safeVerify/safeVerify_page.dart b/lib/mine/mine/safeVerify/safeVerify_page.dart index 22378a51..8213c3d0 100755 --- a/lib/mine/mine/safeVerify/safeVerify_page.dart +++ b/lib/mine/mine/safeVerify/safeVerify_page.dart @@ -4,9 +4,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/mine/mine/safeVerify/safeVerify_logic.dart'; +import 'package:star_lock/mine/mine/safeVerify/safeVerify_state.dart'; import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/titleAppBar.dart'; -import 'package:star_lock/translations/trans_lib.dart'; class SafeVerifyPage extends StatefulWidget { const SafeVerifyPage({Key? key}) : super(key: key); @@ -16,8 +16,8 @@ class SafeVerifyPage extends StatefulWidget { } class _SafeVerifyPageState extends State { - final logic = Get.put(SafeVerifyLogic()); - final state = Get.find().state; + final SafeVerifyLogic logic = Get.put(SafeVerifyLogic()); + final SafeVerifyState state = Get.find().state; @override void initState() { @@ -105,7 +105,7 @@ class _SafeVerifyPageState extends State { Obx(() => Padding( padding: EdgeInsets.only(left: 60.w, right: 60.w), child: Text( - '请点击获取验证码,验证码将发送到${state.accountStr.value}', + '${'请点击获取验证码,验证码将发送到'.tr}${state.accountStr.value}', style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 22.sp), ), @@ -135,7 +135,7 @@ class _SafeVerifyPageState extends State { borderRadius: BorderRadius.circular(10.h), // borderRadius: BorderRadius.circular(30.w) ), - child:Text("切换", + child:Text('切换'.tr, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -149,7 +149,7 @@ class _SafeVerifyPageState extends State { height: 120.h, ), Obx(() => SubmitBtn( - btnName: '验证', + btnName: '验证'.tr, isDisabled: state.canSub.value, onClick: () { logic.deleteAccountRequest(); diff --git a/lib/mine/mine/starLockMine_page.dart b/lib/mine/mine/starLockMine_page.dart index 822fef42..f7c3873d 100755 --- a/lib/mine/mine/starLockMine_page.dart +++ b/lib/mine/mine/starLockMine_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -11,7 +12,6 @@ import '../../app_settings/app_colors.dart'; import '../../baseWidget.dart'; import '../../tools/customNetworkImage.dart'; import '../../tools/submitBtn.dart'; -import '../../translations/trans_lib.dart'; import 'starLockMine_logic.dart'; class StarLockMinePage extends StatefulWidget { diff --git a/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart b/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart index b02caa3e..4906076f 100755 --- a/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart +++ b/lib/mine/mineMultiLanguage/mineMultiLanguage_page.dart @@ -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 '../../tools/commonItem.dart'; import '../../tools/eventBusEventManage.dart'; import '../../tools/titleAppBar.dart'; import '../../translations/app_dept.dart'; -import '../../translations/trans_lib.dart'; import 'mineMultiLanguage_logic.dart'; class MineMultiLanguagePage extends StatefulWidget { @@ -39,7 +39,7 @@ class _MineMultiLanguagePageState extends State { } List _children() { - List l = []; + final List l = []; // l.add( // CommonItem( // leftTitel: '跟随系统', @@ -53,8 +53,8 @@ class _MineMultiLanguagePageState extends State { // }), // ); for (int i = 0; i < state.languages.length; i++) { - Locale e = state.languages[i]; - LanguageType lanType = ExtensionLanguageType.fromLanguageCode(e.languageCode); + final Locale e = state.languages[i]; + final LanguageType lanType = ExtensionLanguageType.fromLanguageCode(e.languageCode); l.add( CommonItem( leftTitel: lanType.lanTitle, diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_logic.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_logic.dart index 64dd0f93..fce7e2bf 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_logic.dart @@ -1,9 +1,11 @@ + import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_state.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -14,7 +16,7 @@ class MineUnbindPhoneOrEmailLogic extends BaseGetXController { late Timer _timer; void _startTimer() { - _timer = Timer.periodic(1.seconds, (timer) { + _timer = Timer.periodic(1.seconds, (Timer timer) { if (state.currentSecond > 1) { state.currentSecond--; } else { @@ -30,8 +32,8 @@ class MineUnbindPhoneOrEmailLogic extends BaseGetXController { } //获取验证码请求 - void sendValidationCode() async { - var entity = await ApiRepository.to.sendValidationCodeAuth( + Future sendValidationCode() async { + final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeAuth( countryCode: '', account: '', channel:state.channel.value, @@ -44,26 +46,26 @@ class MineUnbindPhoneOrEmailLogic extends BaseGetXController { //获取解绑手机号Token Future unbindPhoneTokenRequest() async { - MineUnbindPhoneOrEmailEntity entity = + final MineUnbindPhoneOrEmailEntity entity = await ApiRepository.to.unbindPhoneToken(state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { state.unbindToken.value = entity.data!.token!; - Get.toNamed(Routers.mineBindPhoneOrEmailPage, arguments: { - "isFrom": state.channel.value, - "unbindToken": state.unbindToken.value + Get.toNamed(Routers.mineBindPhoneOrEmailPage, arguments: { + 'isFrom': state.channel.value, + 'unbindToken': state.unbindToken.value }); } } //获取解绑邮箱Token Future unbindEmailTokenRequest() async { - MineUnbindPhoneOrEmailEntity entity = + final MineUnbindPhoneOrEmailEntity entity = await ApiRepository.to.unbindEmailToken(state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { state.unbindToken.value = entity.data!.token!; - Get.toNamed(Routers.mineBindPhoneOrEmailPage, arguments: { - "isFrom": state.channel.value, - "unbindToken": state.unbindToken.value + Get.toNamed(Routers.mineBindPhoneOrEmailPage, arguments: { + 'isFrom': state.channel.value, + 'unbindToken': state.unbindToken.value }); } } @@ -83,18 +85,4 @@ class MineUnbindPhoneOrEmailLogic extends BaseGetXController { state.canSub.value = state.codeIsOK; } - @override - void onReady() { - super.onReady(); - } - - @override - void onInit() { - super.onInit(); - } - - @override - void onClose() { - super.onClose(); - } } diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart index b79a4c6a..c69bed23 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_state.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_state.dart index 5cc9f324..6048cd79 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_state.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_state.dart @@ -1,6 +1,6 @@ + import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:star_lock/translations/trans_lib.dart'; class MineUnbindPhoneOrEmailState { diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_logic.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_logic.dart index 87b00cef..68b12099 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_logic.dart @@ -1,9 +1,6 @@ -import 'dart:async'; import 'package:flutter/cupertino.dart'; -import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_state.dart'; -import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; class PersonInfoEditAccountLogic extends BaseGetXController { @@ -55,19 +52,9 @@ class PersonInfoEditAccountLogic extends BaseGetXController { state.canSub.value = state.codeIsOK; } - @override - void onReady() { - super.onReady(); - } - @override void onInit() { super.onInit(); state.initLoginData(); } - - @override - void onClose() { - super.onClose(); - } } diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart index 08500468..3d8396af 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart @@ -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 '../../../../app_settings/app_colors.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/tf_input_haveBorder.dart'; import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; class MinePersonInfoEditAccountNextPage extends StatefulWidget { const MinePersonInfoEditAccountNextPage({Key? key}) : super(key: key); diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_state.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_state.dart index 0a33f970..3e719e22 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_state.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_state.dart @@ -1,11 +1,23 @@ + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/login/login/entity/LoginData.dart'; import 'package:star_lock/login/selectCountryRegion/common/index.dart'; import 'package:star_lock/tools/storage.dart'; -import 'package:star_lock/translations/trans_lib.dart'; class PersonInfoEditAccountState { + + PersonInfoEditAccountState() { + Map map = Get.arguments; + channel.value = map['isFrom']; + if (channel.value == '1') { + codeType.value = '3'; + } else { + codeType.value = '6'; + } + + resetResend(); + } final TextEditingController accountController = TextEditingController(); final TextEditingController codeController = TextEditingController(); @@ -35,31 +47,19 @@ class PersonInfoEditAccountState { final Rx loginData = LoginData().obs; ///本地存储 登录信息 - void saveLoginData(LoginData? data) async { + Future saveLoginData(LoginData? data) async { await Storage.setString(saveUserLoginData, jsonEncode(data)); loginData.value = data!; } ///初始化本地数据 - void initLoginData() async { + Future initLoginData() async { final String? data = await Storage.getString(saveUserLoginData); if (data != null && data.isNotEmpty) { loginData.value = LoginData.fromJson(jsonDecode(data)); } } - PersonInfoEditAccountState() { - Map map = Get.arguments; - channel.value = map["isFrom"]; - if (channel.value == "1") { - codeType.value = '3'; - } else { - codeType.value = '6'; - } - - resetResend(); - } - void resetResend() { canResend.value = totalSeconds == currentSecond; btnText.value = !canResend.value diff --git a/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart index a2348ef1..23b3043e 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart @@ -1,6 +1,6 @@ -import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/src/services/text_formatter.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -65,7 +65,7 @@ class _MinePersonInfoEditIphonePageState extends State[ // LengthLimitingTextInputFormatter(20), ]), SizedBox(height: 10.w), @@ -106,7 +106,7 @@ class _MinePersonInfoEditIphonePageState extends State[ // LengthLimitingTextInputFormatter(20), ]), ), diff --git a/lib/mine/minePersonInfo/minePersonInfoEditName/MinePersonInfoEditName_logic.dart b/lib/mine/minePersonInfo/minePersonInfoEditName/MinePersonInfoEditName_logic.dart index 4006fab0..92504cae 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditName/MinePersonInfoEditName_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditName/MinePersonInfoEditName_logic.dart @@ -2,6 +2,8 @@ import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; +import 'package:star_lock/login/login/entity/LoginData.dart'; +import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_state.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; import '../../../../network/api_repository.dart'; @@ -12,12 +14,12 @@ class MinePersonInfoEditNameLogic extends BaseGetXController { final MinePersonInfoEditNamePageState state = MinePersonInfoEditNamePageState(); //更新个人信息-昵称 Future updateUserInfoRequest() async { - var entity = await ApiRepository.to.updateUserNameInfo( + final PasswordKeyListEntity entity = await ApiRepository.to.updateUserNameInfo( nickname: state.inputNickName.value, ); if (entity.errorCode!.codeIsSuccessful) { - showToast("操作成功"); - final loginData = await Storage.getLoginData(); + showToast('操作成功'.tr); + final LoginData? loginData = await Storage.getLoginData(); loginData!.nickname = state.inputNickName.value; Storage.saveLoginData(loginData); eventBus.fire(MineInfoChangeRefreshUI()); diff --git a/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart index 407533fa..6c9692b2 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -9,7 +10,6 @@ import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditName/minePersonI import '../../../app_settings/app_colors.dart'; import '../../../tools/tf_loginInput.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class MinePersonInfoEditNamePage extends StatefulWidget { const MinePersonInfoEditNamePage({Key? key}) : super(key: key); @@ -40,7 +40,7 @@ class _MinePersonInfoEditNamePageState extends State ), onPressed: () { if (state.nickNameIsOK == false) { - logic.showToast('请输入昵称'); + logic.showToast('请输入昵称'.tr); } else { logic.updateUserInfoRequest(); } @@ -63,7 +63,7 @@ class _MinePersonInfoEditNamePageState extends State ), onPressed: () { if (state.nickNameIsOK == false) { - logic.showToast('请输入昵称'); + logic.showToast('请输入昵称'.tr); } else { logic.updateUserInfoRequest(); } diff --git a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart index 954ad23e..d997871e 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart @@ -1,8 +1,11 @@ + import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/login/login/entity/LoginData.dart'; +import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -16,7 +19,7 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController { late Timer _timer; void _startTimer() { - _timer = Timer.periodic(1.seconds, (timer) { + _timer = Timer.periodic(1.seconds, (Timer timer) { if (state.currentSecond > 1) { state.currentSecond--; } else { @@ -32,8 +35,8 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController { } //获取验证码请求 - void sendValidationCode() async { - var entity = await ApiRepository.to.sendValidationCodeAuth( + Future sendValidationCode() async { + final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeAuth( countryCode: state.channel.value == '1' ? state.countryCode.value : '', account: state.inputAccount.value, channel: state.channel.value, @@ -46,35 +49,35 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController { //绑定邮箱请求 Future bindEmailRequest() async { - PasswordKeyListEntity entity = await ApiRepository.to.bindEmail( + final PasswordKeyListEntity entity = await ApiRepository.to.bindEmail( state.inputAccount.value, state.verificationCode.value, state.unbindToken.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("邮箱绑定成功".tr, something: () async { - final loginData = await Storage.getLoginData(); + showToast('邮箱绑定成功'.tr, something: () async { + final LoginData? loginData = await Storage.getLoginData(); loginData!.email = state.inputAccount.value; Storage.saveLoginData(loginData); eventBus.fire(MineInfoChangeRefreshUI()); - Get.until((route) => route.settings.name == Routers.minePersonInfoPage); + Get.until((Route route) => route.settings.name == Routers.minePersonInfoPage); }); } } //绑定手机请求 Future bindMobileRequest() async { - PasswordKeyListEntity entity = await ApiRepository.to.bindPhone( + final PasswordKeyListEntity entity = await ApiRepository.to.bindPhone( state.countryCode.value, state.inputAccount.value, state.verificationCode.value, state.unbindToken.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("手机绑定成功".tr, something: () async { - final loginData = await Storage.getLoginData(); + showToast('手机绑定成功'.tr, something: () async { + final LoginData? loginData = await Storage.getLoginData(); loginData!.mobile = state.inputAccount.value; Storage.saveLoginData(loginData); eventBus.fire(MineInfoChangeRefreshUI()); - Get.until((route) => route.settings.name == Routers.minePersonInfoPage); + Get.until((Route route) => route.settings.name == Routers.minePersonInfoPage); }); } } @@ -99,18 +102,4 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController { state.canSub.value = state.codeIsOK; } - @override - void onReady() { - super.onReady(); - } - - @override - void onInit() { - super.onInit(); - } - - @override - void onClose() { - super.onClose(); - } } diff --git a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart index db0a9ab0..4f038d84 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart @@ -3,6 +3,23 @@ import 'package:get/get.dart'; import 'package:star_lock/translations/trans_lib.dart'; class MineBindPhoneOrEmailState { + + MineBindPhoneOrEmailState() { + Map map = Get.arguments; + if (map['unbindToken'] != null) { + unbindToken.value = map['unbindToken']; + } + channel.value = map['isFrom']; + //短信通道 1 短信,2 邮箱 + //短信类型 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱 + if (channel.value == '1') { + codeType.value = '3'; + } else { + codeType.value = '6'; + } + + resetResend(); + } final TextEditingController accountController = TextEditingController(); final TextEditingController codeController = TextEditingController(); @@ -11,7 +28,7 @@ class MineBindPhoneOrEmailState { } RxString countryCode = '86'.obs; - RxString countryName = '中国'.obs; + RxString countryName = '中国'.tr.obs; RxString countryId = '9'.obs; RxString codeType = '4'.obs; //1注册,2找回密码,3绑定手机号,4解绑手机(换绑),5删除账号,6 绑定邮箱,7解绑邮箱(换绑) @@ -31,23 +48,6 @@ class MineBindPhoneOrEmailState { int totalSeconds = 120; int currentSecond = 120; - MineBindPhoneOrEmailState() { - Map map = Get.arguments; - if (map['unbindToken'] != null) { - unbindToken.value = map['unbindToken']; - } - channel.value = map['isFrom']; - //短信通道 1 短信,2 邮箱 - //短信类型 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱 - if (channel.value == '1') { - codeType.value = '3'; - } else { - codeType.value = '6'; - } - - resetResend(); - } - void resetResend() { canResend.value = totalSeconds == currentSecond; btnText.value = !canResend.value diff --git a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart index a5a13ac2..810038cf 100755 --- a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart @@ -1,3 +1,4 @@ + import 'dart:async'; import 'dart:io'; import 'dart:typed_data'; @@ -40,20 +41,17 @@ class MinePersonInfoLogic extends BaseGetXController { } // 上传头像 - Future uploadFile( - MinePersonGetUploadFileInfoEntity - minePersonGetUploadFileInfoEntity) async { - // Map user = minePersonGetUploadFileInfoEntity.data!.formData!; + Future uploadFile(MinePersonGetUploadFileInfoEntity minePersonGetUploadFileInfoEntity) async { final File bytes = File(state.image!.path); final Uint8List enc = await bytes.readAsBytes(); - // user[minePersonGetUploadFileInfoEntity.data!.fileField!] = enc; final FormData form = FormData(minePersonGetUploadFileInfoEntity.data!.formData!); - form.files.add(MapEntry( - minePersonGetUploadFileInfoEntity.data!.fileField!, - MultipartFile(enc, - filename: - minePersonGetUploadFileInfoEntity.data!.formData!['key']))); + form.files.add( + MapEntry( + minePersonGetUploadFileInfoEntity.data!.fileField!, + MultipartFile(enc, filename: minePersonGetUploadFileInfoEntity.data!.formData!['key']) + ) + ); final LoginEntity entity = await ApiRepository.to.uploadFile( url: minePersonGetUploadFileInfoEntity.data!.uploadUrl!, body: form); @@ -133,19 +131,10 @@ class MinePersonInfoLogic extends BaseGetXController { } } - @override - void onReady() { - super.onReady(); - } - @override void onInit() { super.onInit(); getUserInfoRequest(); } - - @override - void onClose() { - } } diff --git a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index 166d2f53..0a970b68 100755 --- a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -13,7 +13,6 @@ import '../../../appRouters.dart'; import '../../../tools/commonItem.dart'; import '../../../tools/customNetworkImage.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class MinePersonInfoPage extends StatefulWidget { MinePersonInfoPage({Key? key, this.showAbout = false}) @@ -239,7 +238,7 @@ class _MinePersonInfoPageState extends State { builder: (BuildContext context) { return AlertBottomWidget( topTitle: '', - items: const ['拍照', '从相册选择'], + items: ['拍照'.tr, '从相册选择'.tr], chooseCallback: logic.chooseCallback, ); }); diff --git a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart index 03b016ed..3e649ab5 100755 --- a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -9,28 +10,28 @@ import 'package:star_lock/tools/baseGetXController.dart'; class MinePersonInfoResetPasswordLogic extends BaseGetXController { final MinePersonInfoResetPasswordState state = MinePersonInfoResetPasswordState(); - void changePasswordRequest() async { + Future changePasswordRequest() async { if(state.newPwd.value.length < 8){ - showToast("新密码长度不足8位"); + showToast('新密码长度不足8位'.tr); return; } if(state.surePwd.value.length < 8){ - showToast("确认长度不足8位"); + showToast('确认长度不足8位'.tr); return; } if(state.surePwd.value != state.newPwd.value){ - showToast("两次密码不一致"); + showToast('两次密码不一致'.tr); return; } - var entity = await ApiRepository.to.changePassword( + final LoginEntity entity = await ApiRepository.to.changePassword( state.date.value, state.surePwd.value, state.oldPwd.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("重置成功"); + showToast('重置成功'.tr); Get.back(); } } diff --git a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart index 55325860..8464c352 100755 --- a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -11,7 +12,6 @@ import '../../../app_settings/app_colors.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/tf_loginInput.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class MinePersonInfoResetPasswordPage extends StatefulWidget { const MinePersonInfoResetPasswordPage({Key? key}) : super(key: key); diff --git a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart index 1a9051a9..fde998fb 100755 --- a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart @@ -1,10 +1,10 @@ + import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_entity.dart'; -import 'package:star_lock/translations/trans_lib.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; diff --git a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart index f4e30e0f..44c35b88 100755 --- a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart @@ -1,16 +1,17 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/commonItem.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class MinePersonInfoSetSafetyProblemPage extends StatefulWidget { const MinePersonInfoSetSafetyProblemPage({Key? key}) : super(key: key); @@ -22,8 +23,8 @@ class MinePersonInfoSetSafetyProblemPage extends StatefulWidget { class _MinePersonInfoSetSafetyProblemPageState extends State { - final logic = Get.put(MineSetSafetyProblemLogic()); - final state = Get.find().state; + final MineSetSafetyProblemLogic logic = Get.put(MineSetSafetyProblemLogic()); + final MineSetSafetyProblemState state = Get.find().state; @override void initState() { @@ -152,9 +153,9 @@ class _MinePersonInfoSetSafetyProblemPageState } Future _selectProblemBottomSheet(List dataList, int problemIndex) async { - List getProblemList = []; + final List getProblemList = []; for (int i = 0; i < dataList.length; i++) { - SafetyProblemData data = dataList[i]; + final SafetyProblemData data = dataList[i]; getProblemList.add(data.question!); } showModalBottomSheet( @@ -163,12 +164,12 @@ class _MinePersonInfoSetSafetyProblemPageState borderRadius: BorderRadiusDirectional.circular(10)), builder: (BuildContext context) { return AlertBottomWidget( - topTitle: '选择问题', + topTitle: '选择问题'.tr, items: getProblemList, chooseCallback: (value) { - int getSelectIndex = value; - String getSelectProblem = getProblemList[getSelectIndex]; - SafetyProblemData data = dataList[getSelectIndex]; + final int getSelectIndex = value; + final String getSelectProblem = getProblemList[getSelectIndex]; + final SafetyProblemData data = dataList[getSelectIndex]; if (problemIndex == 1) { // SafetyProblemData data = dataList[getSelectIndex]; state.firstProblemStr.value = getSelectProblem; diff --git a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart index dd6aef3a..8af8e24a 100755 --- a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart +++ b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart @@ -3,6 +3,25 @@ import 'package:get/get.dart'; import 'package:star_lock/translations/trans_lib.dart'; class MineSetSafetyProblemState { + + MineSetSafetyProblemState() { + if (Get.arguments != null) { + Map map = Get.arguments; + isUpdateAnswer.value = true; + firstProblemStr.value = map['firstProblemStr']; + secondProblemStr.value = map['secondProblemStr']; + thirdProblemStr.value = map['thirdProblemStr']; + firstAnswerStr.value = map['firstAnswerStr']; + secondAnswerStr.value = map['secondAnswerStr']; + thirdAnswerStr.value = map['thirdAnswerStr']; + firstQuestionId.value = map['firstQuestionId']; + secondQuestionId.value = map['secondQuestionId']; + thirdQuestionId.value = map['thirdQuestionId']; + firstAnswerId.value = map['firstAnswerId']; + secondAnswerId.value = map['secondAnswerId']; + thirdAnswerId.value = map['thirdAnswerId']; + } + } final TextEditingController fristAnswerController = TextEditingController(); final TextEditingController secondAnswerController = TextEditingController(); final TextEditingController thirdAnswerController = TextEditingController(); @@ -36,23 +55,4 @@ class MineSetSafetyProblemState { secondAnswerStr.value.isNotEmpty && thirdAnswerStr.value.isNotEmpty; RxBool canSub = false.obs; - - MineSetSafetyProblemState() { - if (Get.arguments != null) { - Map map = Get.arguments; - isUpdateAnswer.value = true; - firstProblemStr.value = map['firstProblemStr']; - secondProblemStr.value = map['secondProblemStr']; - thirdProblemStr.value = map['thirdProblemStr']; - firstAnswerStr.value = map['firstAnswerStr']; - secondAnswerStr.value = map['secondAnswerStr']; - thirdAnswerStr.value = map['thirdAnswerStr']; - firstQuestionId.value = map['firstQuestionId']; - secondQuestionId.value = map['secondQuestionId']; - thirdQuestionId.value = map['thirdQuestionId']; - firstAnswerId.value = map['firstAnswerId']; - secondAnswerId.value = map['secondAnswerId']; - thirdAnswerId.value = map['thirdAnswerId']; - } - } } diff --git a/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart b/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart index 9bf60297..e1e42c73 100755 --- a/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart @@ -10,23 +10,22 @@ class MineViewSafetyProblemLogic extends BaseGetXController { //获取已设置的安全信息 Future getOwnQuestionListRequest() async { - MineViewSafetyProblemEntity entity = - await ApiRepository.to.getOwnQuestionList(); + final MineViewSafetyProblemEntity entity = await ApiRepository.to.getOwnQuestionList(); if (entity.errorCode!.codeIsSuccessful) { if (entity.dataList != null) { - SafetyProblemData safeData1 = entity.dataList![0]; + final SafetyProblemData safeData1 = entity.dataList![0]; state.firstProblemStr.value = safeData1.question!; state.firstAnswerStr.value = safeData1.answer!; state.firstQuestionId.value = safeData1.questionId!; state.firstAnswerId.value = safeData1.answerId!; - SafetyProblemData safeData2 = entity.dataList![1]; + final SafetyProblemData safeData2 = entity.dataList![1]; state.secondProblemStr.value = safeData2.question!; state.secondAnswerStr.value = safeData2.answer!; state.secondQuestionId.value = safeData2.questionId!; state.secondAnswerId.value = safeData2.answerId!; - SafetyProblemData safeData3 = entity.dataList![2]; + final SafetyProblemData safeData3 = entity.dataList![2]; state.thirdProblemStr.value = safeData3.question!; state.thirdAnswerStr.value = safeData3.answer!; state.thirdQuestionId.value = safeData3.questionId!; diff --git a/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart b/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart index 0936abb0..a2475bb1 100755 --- a/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart @@ -1,13 +1,14 @@ + 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/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_state.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/commonItem.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class MinePersonInfoViewSafetyProblemPage extends StatefulWidget { const MinePersonInfoViewSafetyProblemPage({Key? key}) : super(key: key); @@ -17,10 +18,9 @@ class MinePersonInfoViewSafetyProblemPage extends StatefulWidget { _MinePersonInfoViewSafetyProblemPageState(); } -class _MinePersonInfoViewSafetyProblemPageState - extends State { - final logic = Get.put(MineViewSafetyProblemLogic()); - final state = Get.find().state; +class _MinePersonInfoViewSafetyProblemPageState extends State { + final MineViewSafetyProblemLogic logic = Get.put(MineViewSafetyProblemLogic()); + final MineViewSafetyProblemState state = Get.find().state; @override void initState() { @@ -36,12 +36,12 @@ class _MinePersonInfoViewSafetyProblemPageState appBar: TitleAppBar( barTitle: '安全问题'.tr, haveBack: true, - actionsList: [ + actionsList: [ TextButton( onPressed: () { Navigator.pushNamed( context, Routers.minePersonInfoSetSafetyProblemPage, - arguments: { + arguments: { 'firstProblemStr': state.firstProblemStr.value, 'secondProblemStr': state.secondProblemStr.value, 'thirdProblemStr': state.thirdProblemStr.value, @@ -63,7 +63,7 @@ class _MinePersonInfoViewSafetyProblemPageState ], backgroundColor: AppColors.mainColor), body: ListView( - children: [ + children: [ Container( width: 1.sw, color: AppColors.greyBackgroundColor, @@ -86,7 +86,7 @@ class _MinePersonInfoViewSafetyProblemPageState Widget _safityProblemItem(String problemTitle, String answerTitle) { return Column( - children: [ + children: [ CommonItem( leftTitel: problemTitle, rightTitle: '', diff --git a/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart b/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart index cc40ce7f..d78d0ee6 100755 --- a/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart +++ b/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_logic.dart @@ -1,5 +1,4 @@ import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart'; import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart'; import '../../../network/api_repository.dart'; @@ -34,7 +33,7 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController { final SelectLockListEntity entity = await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList); if (entity.errorCode!.codeIsSuccessful) { - showToast('操作成功'); + showToast('操作成功'.tr); //刷新锁列表,更新锁详情--手机需联网标识 if (Get.isRegistered()) { diff --git a/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart b/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart index 394946e9..581e3db1 100755 --- a/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart +++ b/lib/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -11,7 +12,6 @@ import '../../../tools/noData.dart'; import '../../../tools/storage.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; import 'appUnlockNeedMobileNetworkingLock_logic.dart'; class APPUnlockNeedMobileNetworkingLockPage extends StatefulWidget { diff --git a/lib/mine/mineSet/authorityManagement/getDeviceList_page.dart b/lib/mine/mineSet/authorityManagement/getDeviceList_page.dart index fb01a4df..c009cea2 100755 --- a/lib/mine/mineSet/authorityManagement/getDeviceList_page.dart +++ b/lib/mine/mineSet/authorityManagement/getDeviceList_page.dart @@ -33,7 +33,7 @@ class _GetDeviceListPageState extends State { padding: EdgeInsets.only( left: 30.w, top: 16.w, right: 30.w, bottom: 16.w), child: Text( - '请选择姓名要关联哪些设备', + '请选择姓名要关联哪些设备'.tr, style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 20.sp), textAlign: TextAlign.start, @@ -77,7 +77,7 @@ class _GetDeviceListPageState extends State { height: 20.h, ), SubmitBtn( - btnName: '确定', + btnName: '确定'.tr, onClick: () {}, ), SizedBox( diff --git a/lib/mine/mineSet/authorityManagement/getNameList_page.dart b/lib/mine/mineSet/authorityManagement/getNameList_page.dart index c402a327..d74e907f 100755 --- a/lib/mine/mineSet/authorityManagement/getNameList_page.dart +++ b/lib/mine/mineSet/authorityManagement/getNameList_page.dart @@ -5,7 +5,6 @@ import 'package:star_lock/tools/submitBtn.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; class GetNameListPage extends StatefulWidget { const GetNameListPage({Key? key}) : super(key: key); @@ -33,7 +32,7 @@ class _GetNameListPageState extends State { padding: EdgeInsets.only( left: 30.w, top: 16.w, right: 30.w, bottom: 16.w), child: Text( - '请选择设备要关联哪些姓名', + '请选择设备要关联哪些姓名'.tr, style: TextStyle( color: AppColors.darkGrayTextColor, fontSize: 20.sp), textAlign: TextAlign.start, @@ -78,7 +77,7 @@ class _GetNameListPageState extends State { height: 20.h, ), SubmitBtn( - btnName: '确定', + btnName: '确定'.tr, onClick: () {}, ), SizedBox( diff --git a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart index b2373937..4f2e7a6f 100755 --- a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart +++ b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_logic.dart @@ -21,11 +21,11 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController { //发送批量授权管理员 Future addAuthorizedAdminRequest() async { if (state.emailOrPhoneController.text.isEmpty) { - showToast('请输入接收者账号'); + showToast('请输入接收者账号'.tr); return; } if (state.keyNameController.text.isEmpty) { - showToast('请输入接收者姓名'); + showToast('请输入接收者姓名'.tr); return; } @@ -42,16 +42,16 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController { endDate = DateTool().dateToTimestamp(state.endDate.value, 1).toString(); if (startDate.isEmpty) { - showToast('请选择开始时间'); + showToast('请选择开始时间'.tr); return; } if (endDate.isEmpty) { - showToast('请选择结束时间'); + showToast('请选择结束时间'.tr); return; } if (int.parse(startDate) >= int.parse(endDate)) { - showToast('失效时间要大于生效时间'); + showToast('失效时间要大于生效时间'.tr); return; } } @@ -93,7 +93,7 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController { context: Get.context!, builder: (BuildContext context) { return CupertinoAlertDialog( - title: const Text('接收者号码未注册,请重新发送'), + title: Text('接收者号码未注册,请重新发送'.tr), actions: [ CupertinoDialogAction( child: Text('取消'.tr), diff --git a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart index 161868c0..973b97e6 100755 --- a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -13,7 +14,6 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart'; import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/tools/submitBtn.dart'; -import 'package:star_lock/translations/trans_lib.dart'; import '../../../../tools/NativeInteractionTool.dart'; import '../../../../tools/dateTool.dart'; @@ -485,7 +485,7 @@ class _AddAuthorizedAdministratorPageState ), OutLineBtn( btnName: - state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知', + state.emailOrPhoneController.text.contains('@') ? '邮件通知'.tr : '短信通知'.tr, onClick: () { Get.toNamed(Routers.sendEmailNotificationPage, arguments: { @@ -501,7 +501,7 @@ class _AddAuthorizedAdministratorPageState height: 10.h, ), OutLineBtn( - btnName: '微信通知', + btnName: '微信通知'.tr, onClick: () { // _openModalBottomSheet(); NativeInteractionTool() diff --git a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart index 081859bb..c15b55e5 100755 --- a/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart +++ b/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart @@ -25,7 +25,7 @@ class AddAuthorizedAdministratorState { .dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()) .obs; // - RxString countryName = '中国'.obs; + RxString countryName = '中国'.tr.obs; RxString countryCode = '86'.obs; RxBool isSendSuccess = false.obs; final RxBool isRemoteUnlock = false.obs; //是否允许远程开锁 @@ -33,6 +33,6 @@ class AddAuthorizedAdministratorState { final RxBool onlyManageYouCreatesUser = false.obs; //只能管理您创建的用户 final Rx keyInfo = LockListInfoItemEntity().obs; - String pwdShareStr = '您好,您的授权管理员生成成功'; + String pwdShareStr = '您好,您的授权管理员生成成功'.tr; RxInt getKeyId = 0.obs; } diff --git a/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_logic.dart b/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_logic.dart index 063af209..129549d6 100644 --- a/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_logic.dart +++ b/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_logic.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_entity.dart'; diff --git a/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart b/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart index 3ea55476..9a803af5 100644 --- a/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart @@ -1,5 +1,5 @@ + import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupCell.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; diff --git a/lib/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_page.dart b/lib/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_page.dart index a0bbf288..c1ee8749 100755 --- a/lib/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -11,7 +12,6 @@ import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/commonItem.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/titleAppBar.dart'; -import '../../../../../translations/trans_lib.dart'; class AdminDetailChangeDatePage extends StatefulWidget { const AdminDetailChangeDatePage({Key? key}) : super(key: key); diff --git a/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart b/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart index 99ba5a74..56b199a4 100755 --- a/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart @@ -96,13 +96,13 @@ class _AdministratorDetailsPageState extends State { }), Container(height: 10.h), CommonItem( - leftTitel: '仅管理自己创建的用户', + leftTitel: '仅管理自己创建的用户'.tr, rightTitle: '', isHaveRightWidget: true, isTipsImg: true, tipsImgAction: () { ShowTipView() - .showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'); + .showSureAlertDialog('授权管理员只能查看和管理自己下发的钥匙、密码等权限'.tr); }, rightWidget: SizedBox( width: 60.w, diff --git a/lib/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart b/lib/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart index 456274f8..f3bb6901 100755 --- a/lib/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart +++ b/lib/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; diff --git a/lib/mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart b/lib/mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart index 0a18683d..715a8f63 100755 --- a/lib/mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart +++ b/lib/mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart @@ -10,7 +10,6 @@ import 'package:star_lock/tools/baseGetXController.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class HideInvalidUnlockPermissionsPage extends StatefulWidget { const HideInvalidUnlockPermissionsPage({Key? key}) : super(key: key); @@ -108,7 +107,7 @@ class _HideInvalidUnlockPermissionsPageState await ApiRepository.to.changeSettings(_isOn == true ? '1' : '2', '2'); if (entity.errorCode!.codeIsSuccessful) { setState(() {}); - EasyLoading.showToast("操作成功",duration: 2000.milliseconds); + EasyLoading.showToast('操作成功'.tr, duration: 2000.milliseconds); } } } diff --git a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart index c46e87d1..c13c8624 100755 --- a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart +++ b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_logic.dart @@ -34,7 +34,7 @@ class GroupEditLockLogic extends BaseGetXController { } var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds); if (entity.errorCode!.codeIsSuccessful) { - showToast('删除成功', something: () { + showToast('删除成功'.tr, something: () { eventBus.fire(LockGroupEditGroupLockRefreshEvent()); eventBus.fire(RefreshLockListInfoDataEvent()); Get.close(2); @@ -48,8 +48,4 @@ class GroupEditLockLogic extends BaseGetXController { state.isVip.refresh(); } - @override - onReady() async { - super.onReady(); - } } diff --git a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart index 86d9ac7c..17c507a8 100755 --- a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart +++ b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_page.dart @@ -1,14 +1,14 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; import 'package:star_lock/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart'; -import 'package:star_lock/tools/showCupertinoAlertView.dart'; import 'package:star_lock/tools/noData.dart'; +import 'package:star_lock/tools/showCupertinoAlertView.dart'; import '../../../../../../app_settings/app_colors.dart'; import '../../../../../../tools/titleAppBar.dart'; -import '../../../../../../translations/trans_lib.dart'; import '../../../../tools/submitBtn.dart'; import 'groupEditLock_logic.dart'; diff --git a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart index fecdd772..4a58f145 100755 --- a/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart +++ b/lib/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart @@ -2,17 +2,12 @@ import 'package:get/get.dart'; import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; class GroupEditLockState { - var lockList = []; - var type = 0; // 0添加 1删除 - var selectGroupListItem = GroupListItem(); - var ungrouped = GroupListItem(); - var isVip = false.obs; GroupEditLockState() { - Map map = Get.arguments; - type = map["type"]; - selectGroupListItem = map["groupListItem"]; - ungrouped = map["ungrouped"]; + final Map map = Get.arguments; + type = map['type']; + selectGroupListItem = map['groupListItem']; + ungrouped = map['ungrouped']; if (type == 0) { lockList = ungrouped.lockList!; } else { @@ -20,8 +15,13 @@ class GroupEditLockState { } for (int i = 0; i < lockList.length; i++) { - LockListItem lockListItem = lockList[i]; + final LockListItem lockListItem = lockList[i]; lockListItem.isChecked = false; } } + List lockList = []; + int type = 0; // 0添加 1删除 + GroupListItem selectGroupListItem = GroupListItem(); + GroupListItem ungrouped = GroupListItem(); + RxBool isVip = false.obs; } diff --git a/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart b/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart index f6c28e84..424943b5 100755 --- a/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart +++ b/lib/mine/mineSet/lockGroup/lockGroupDetailList/lockItemList_page.dart @@ -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 'package:star_lock/tools/submitBtn.dart'; import '../../../../../../app_settings/app_colors.dart'; import '../../../../../../tools/titleAppBar.dart'; -import '../../../../../../translations/trans_lib.dart'; import '../../../../appRouters.dart'; import '../../../../tools/custom_bottom_sheet.dart'; @@ -24,8 +24,8 @@ class _LockItemListPageState extends State { @override Widget build(BuildContext context) { - Map map = Get.arguments; - GroupListItem groupListItem = map['groupListItem']; + final Map map = Get.arguments; + final GroupListItem groupListItem = map['groupListItem']; lockList = groupListItem.lockList!; ungrouped = map['ungrouped']; @@ -64,7 +64,7 @@ class _LockItemListPageState extends State { body: lockList.isNotEmpty ? ListView.separated( itemBuilder: (context, index) { - LockListItem itemData = lockList[index]; + final LockListItem itemData = lockList[index]; return _listItemView(itemData); }, itemCount: lockList.length, @@ -141,7 +141,7 @@ class _LockItemListPageState extends State { topTitle: '', items: ['添加'.tr, '删除'.tr], chooseCallback: (value) { - int getSelectIndex = value; + final int getSelectIndex = value; if (getSelectIndex == 0) { Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 0}); } else if (getSelectIndex == 1) { diff --git a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart index 5d1158b8..7e050bfe 100755 --- a/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart +++ b/lib/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -10,7 +11,6 @@ import 'package:star_lock/tools/showTipView.dart'; import '../../../../../../appRouters.dart'; import '../../../../../../app_settings/app_colors.dart'; import '../../../../../../tools/titleAppBar.dart'; -import '../../../../../../translations/trans_lib.dart'; import '../../../../tools/left_slide/left_slide_actions.dart'; import '../../../../tools/noData.dart'; import 'lockGroupList_logic.dart'; diff --git a/lib/mine/mineSet/lockScreen/lockScreen_page.dart b/lib/mine/mineSet/lockScreen/lockScreen_page.dart index 706c71a5..20791b46 100755 --- a/lib/mine/mineSet/lockScreen/lockScreen_page.dart +++ b/lib/mine/mineSet/lockScreen/lockScreen_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -9,7 +10,6 @@ import 'package:star_lock/tools/baseGetXController.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/submitBtn.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class LockScreenPage extends StatefulWidget { const LockScreenPage({Key? key}) : super(key: key); @@ -110,7 +110,7 @@ class _LockScreenPageState extends State { final ExpireLockListEntity entity = await ApiRepository.to.changeSettings(_isOn == true ? '1' : '2', '1'); if (entity.errorCode!.codeIsSuccessful) { - EasyLoading.showToast('操作成功',duration: 2000.milliseconds); + EasyLoading.showToast('操作成功'.tr, duration: 2000.milliseconds); } } } diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart index 577a1460..8c296c50 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart @@ -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/blue_manage.dart'; import 'package:star_lock/blue/io_reply.dart'; import 'package:star_lock/blue/io_tool/io_tool.dart'; @@ -170,7 +171,7 @@ class ExpireCardLogic extends BaseGetXController { deleteType:'1' ); if(entity.errorCode!.codeIsSuccessful){ - showToast('删除成功', something: (){ + showToast('删除成功'.tr, something: (){ BlueManage().disconnect(); pageNo = 1; expirCardListRequest(isRefresh: true, isRefreshLockUserManageList: true); @@ -182,7 +183,7 @@ class ExpireCardLogic extends BaseGetXController { String getExpireDateStr(ExpireCardItemEntity itemData) { String useDateStr = ''; if(itemData.cardType == 4){ - useDateStr = '循环'; + useDateStr = '循环'.tr; }else{ useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}'; } @@ -196,12 +197,6 @@ class ExpireCardLogic extends BaseGetXController { _initReplySubscription(); } - @override - void onInit() { - super.onInit(); - - } - @override void onClose() { super.onClose(); diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_page.dart index 2ba20edc..7a1d72c8 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_page.dart @@ -71,14 +71,14 @@ class _ExpireCardPageState extends State with RouteAware { children: [ SlidableAction( onPressed: (BuildContext context){ - ShowTipView().showIosTipWithContentDialog('确定删除卡吗?', (){ + ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, (){ state.deletExpireCardItemEntity = indexEntity; logic.senderAddICCard(); }); }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -229,7 +229,7 @@ class _ExpireCardPageState extends State with RouteAware { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '余${itemData.expireDate.toString()}天', + '${'余'.tr}${itemData.expireDate.toString()}${'天'.tr}', style: TextStyle( color: Colors.white, fontSize: 13.sp), ), @@ -242,7 +242,7 @@ class _ExpireCardPageState extends State with RouteAware { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '已过期', + '已过期'.tr, style: TextStyle( color: Colors.white, fontSize: 13.sp), ), diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_logic.dart index 7ab34cda..518818d6 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_logic.dart @@ -1,5 +1,5 @@ - +import 'package:get/get.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; @@ -41,7 +41,7 @@ class ExpireLockListLogic extends BaseGetXController{ includeUnderlings: includeUnderlings ); if (entity.errorCode!.codeIsSuccessful) { - showToast('删除成功', something: () { + showToast('删除成功'.tr, something: () { expireLockListRequest(isRefresh: true, isRefreshLockUserManageList: true); }); } @@ -51,7 +51,7 @@ class ExpireLockListLogic extends BaseGetXController{ String getExpireDateStr(ExpireLockItem itemData) { String useDateStr = ''; if(itemData.keyType == 4){ - useDateStr = '循环'; + useDateStr = '循环'.tr; }else{ useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}'; } @@ -61,12 +61,12 @@ class ExpireLockListLogic extends BaseGetXController{ deletKeyLogic(ExpireLockItem expireLockItem){ if(expireLockItem.keyRight == 1){ // 授权管理员 - ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) { + ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) { deleteKeyRequest(isAllData ? 1 : 0, expireLockItem); }); }else{ // 普通用户 - ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效', (){ + ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效'.tr, (){ deleteKeyRequest(0, expireLockItem); }); } diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_page.dart index 84f9f90e..adeedfc8 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_page.dart @@ -70,7 +70,7 @@ class _ExpireLockListPageState extends State { }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -207,7 +207,7 @@ class _ExpireLockListPageState extends State { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '未生效', + '未生效'.tr, style: TextStyle( color: Colors.white, fontSize: 13.sp), ), @@ -221,7 +221,7 @@ class _ExpireLockListPageState extends State { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '余${itemData.expireDate.toString()}天', + '${'余'.tr}${itemData.expireDate.toString()}${'天'.tr}', style: TextStyle( color: Colors.white, fontSize: 13.sp), ), @@ -234,7 +234,7 @@ class _ExpireLockListPageState extends State { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '已过期', + '已过期'.tr, style: TextStyle( color: Colors.white, fontSize: 13.sp), ), diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_logic.dart index 895f1eec..172dd8f1 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_logic.dart @@ -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/tools/baseGetXController.dart'; import 'package:star_lock/tools/dateTool.dart'; @@ -135,7 +136,7 @@ class ExpireFaceLogic extends BaseGetXController { lockId: state.seletExpireFaceListItemEntity.lockId!, ); if (entity.errorCode!.codeIsSuccessful) { - showToast('删除成功', something: (){ + showToast('删除成功'.tr, something: (){ expireFaceList(isRefresh: true, isRefreshLockUserManageList: true); }); } @@ -177,7 +178,7 @@ class ExpireFaceLogic extends BaseGetXController { String getExpireDateStr(ExpireFaceListItemEntity itemData) { String useDateStr = ''; if(itemData.faceType == 4){ - useDateStr = '循环'; + useDateStr = '循环'.tr; }else{ useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}'; } diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_page.dart index effde440..d705694c 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireFace/expireFace_page.dart @@ -71,14 +71,14 @@ class _ExpireFacePageState extends State with RouteAware { children: [ SlidableAction( onPressed: (BuildContext context){ - ShowTipView().showIosTipWithContentDialog('确定删除人脸吗?', (){ + ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, (){ state.seletExpireFaceListItemEntity = indexEntity; logic.senderAddFace(); }); }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -213,7 +213,7 @@ class _ExpireFacePageState extends State with RouteAware { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '余${itemData.expireDate.toString()}天', + '${'余'.tr}${itemData.expireDate.toString()}${'天'.tr}', style: TextStyle( color: Colors.white, fontSize: 13.sp), ), @@ -226,7 +226,7 @@ class _ExpireFacePageState extends State with RouteAware { borderRadius: BorderRadius.circular(2.0), ), child: Text( - '已过期', + '已过期'.tr, style: TextStyle( color: Colors.white, fontSize: 13.sp), ), diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart index 58e08f4e..7dba76fd 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart @@ -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_tool/io_tool.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -143,7 +144,7 @@ class ExpireFingerprintLogic extends BaseGetXController { deleteType:'1' ); if(entity.errorCode!.codeIsSuccessful){ - showToast('删除成功',something: (){ + showToast('删除成功'.tr, something: (){ BlueManage().disconnect(); expirFingerprintListRequest(isRefresh: true, isRefreshLockUserManageList: true); }); @@ -174,7 +175,7 @@ class ExpireFingerprintLogic extends BaseGetXController { String getExpireDateStr(ExpireFingerprintItemEntity itemData) { String useDateStr = ''; if(itemData.fingerprintType == 4){ - useDateStr = '循环'; + useDateStr = '循环'.tr; }else{ useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}'; } diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_page.dart index 209586ec..60b1ca10 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -68,14 +69,14 @@ class _ExpireFingerprintPageState extends State with Rout children: [ SlidableAction( onPressed: (BuildContext context) { - ShowTipView().showIosTipWithContentDialog('确定删除指纹吗?', () { + ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () { state.deletExpireFingerprintItemEntity = indexEntity; logic.senderAddFingerprint(); }); }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -218,7 +219,7 @@ class _ExpireFingerprintPageState extends State with Rout borderRadius: BorderRadius.circular(2.0), ), child: Text( - '余${itemData.expireDate.toString()}天', + '${'余'.tr}${itemData.expireDate.toString()}${'天'.tr}', style: TextStyle(color: Colors.white, fontSize: 13.sp), ), ); @@ -230,7 +231,7 @@ class _ExpireFingerprintPageState extends State with Rout borderRadius: BorderRadius.circular(2.0), ), child: Text( - '已过期', + '已过期'.tr, style: TextStyle(color: Colors.white, fontSize: 13.sp), ), ); diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_logic.dart index 45512c91..381a48e8 100644 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_logic.dart @@ -428,7 +428,7 @@ class ExpireKeyChangeDateLogic extends BaseGetXController { faceRight: state.isAdmin ); if (entity.errorCode!.codeIsSuccessful) { - showToast('修改成功', something: () { + showToast('修改成功'.tr, something: () { Get.back(result: { 'beginTimeTimestamp':state.beginTimeTimestamp.value.toString(), 'endTimeTimestamp':state.endTimeTimestamp.value.toString(), diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_page.dart index 30c543a8..73ea6097 100644 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeDate/expireKeyChangeDate_page.dart @@ -12,7 +12,6 @@ import '../../../../../tools/pickers/pickers.dart'; import '../../../../../tools/pickers/time_picker/model/date_mode.dart'; import '../../../../../tools/pickers/time_picker/model/pduration.dart'; import '../../../../../tools/titleAppBar.dart'; -import '../../../../../translations/trans_lib.dart'; import 'expireKeyChangeDate_logic.dart'; import 'expireKeyChangeDate_state.dart'; diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeValidityDate/expireKeyChangeValidityDate_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeValidityDate/expireKeyChangeValidityDate_logic.dart index 65542841..21d7d3e1 100644 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeValidityDate/expireKeyChangeValidityDate_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireKeyChangeValidityDate/expireKeyChangeValidityDate_logic.dart @@ -439,7 +439,7 @@ class ExpireKeyChangeValidityDateLogic extends BaseGetXController { faceRight: state.isAdmin, ); if (entity.errorCode!.codeIsSuccessful) { - showToast('修改成功', something: () { + showToast('修改成功'.tr, something: () { eventBus.fire(OtherTypeRefreshListEvent()); Get.back(result: { 'starDate':state.starDateTimestamp.value.toString(), @@ -459,12 +459,6 @@ class ExpireKeyChangeValidityDateLogic extends BaseGetXController { _initReplySubscription(); } - @override - void onInit() { - super.onInit(); - - } - @override void onClose() { super.onClose(); diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart index 1c8008a2..b05e1432 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:star_lock/tools/titleAppBar.dart'; import '../../../../app_settings/app_colors.dart'; @@ -20,7 +21,7 @@ class _ExpireLockManagePageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: '即将到期', + barTitle: '即将到期'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: const Column( diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_tabbar.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_tabbar.dart index 73b2f8fe..2cf946f3 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_tabbar.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireLockManage_tabbar.dart @@ -4,7 +4,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/tools/CustomUnderlineTabIndicator.dart'; -import 'package:star_lock/translations/trans_lib.dart'; import 'expireCard/expireCard_page.dart'; import 'expireElectronicKey/expireLockList_page.dart'; diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_logic.dart index e413bf38..236bcfb9 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_logic.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; +import 'package:get/get.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/dateTool.dart'; @@ -149,7 +150,7 @@ class ExpirePasswordLogic extends BaseGetXController { keyboardPwdId: state.seletIndexEntity.pwdId.toString(), deleteType: 1); if (entity.errorCode!.codeIsSuccessful) { - showToast('删除成功', something: () { + showToast('删除成功'.tr, something: () { expirePasswordListRequest(isRefresh: true, isRefreshLockUserManageList: true); }); } @@ -160,7 +161,7 @@ class ExpirePasswordLogic extends BaseGetXController { String useDateStr = ''; //* getKeyType 单次1 永久2 限期3 删除4 周未循环5 每日循环6 工作日循环7 周一循环8 周二循环9 周三循环10 周四循环11 周五循环12 周六循环13 周天循环14 if (itemData.keyboardPwdType! > 4) { - useDateStr = '循环'; + useDateStr = '循环'.tr; } else { useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}'; diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_page.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_page.dart index bfeea527..45a988ab 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_page.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expirePassword/expirePassword_page.dart @@ -75,14 +75,14 @@ class _ExpirePasswordPageState extends State with RouteAware children: [ SlidableAction( onPressed: (BuildContext context) { - ShowTipView().showIosTipWithContentDialog('确定删除该密码吗?', () { + ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () { state.seletIndexEntity = indexEntity; logic.senderCustomPasswords(); }); }, backgroundColor: Colors.red, foregroundColor: Colors.white, - label: '删除', + label: '删除'.tr, padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -113,7 +113,7 @@ class _ExpirePasswordPageState extends State with RouteAware getHttpData(isRefresh: true); } }else { - logic.showToast('该密码不是自定义密码,无法修改'); + logic.showToast('该密码不是自定义密码,无法修改'.tr); } }, child: Container( @@ -195,7 +195,7 @@ class _ExpirePasswordPageState extends State with RouteAware borderRadius: BorderRadius.circular(2.0), ), child: Text( - '余${itemData.expireDate.toString()}天', + '${'余'.tr}${itemData.expireDate.toString()}${'天'.tr}', style: TextStyle(color: Colors.white, fontSize: 13.sp), ), )), diff --git a/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart b/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart index 994f9f54..bd57ef73 100755 --- a/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart +++ b/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart'; import '../../../../network/api_repository.dart'; @@ -34,10 +35,9 @@ class LockUserManageListLogic extends BaseGetXController { //删除锁用户管理 Future deletelockUserRequest(int uid) async { - final entity = await ApiRepository.to.deletLockUser(uid); + final LoginEntity entity = await ApiRepository.to.deletLockUser(uid); if (entity.errorCode!.codeIsSuccessful) { - EasyLoading.showToast('删除成功',duration: 2000.milliseconds); - showToast('删除成功', something: (){ + showToast('删除成功'.tr, something: (){ pageNo = 1; lockUserListRequest(); }); diff --git a/lib/mine/mineSet/mineSet/mineSet_logic.dart b/lib/mine/mineSet/mineSet/mineSet_logic.dart index d095e39c..9e389d27 100755 --- a/lib/mine/mineSet/mineSet/mineSet_logic.dart +++ b/lib/mine/mineSet/mineSet/mineSet_logic.dart @@ -102,8 +102,7 @@ class MineSetLogic extends BaseGetXController { getPushDeviceID = value; } }); - LoginEntity entity = - await ApiRepository.to.userLogout(deviceld: getPushDeviceID); + final LoginEntity entity = await ApiRepository.to.userLogout(deviceld: getPushDeviceID); if (entity.errorCode!.codeIsSuccessful) { UdpHelp().closeUDP(); logOut(); @@ -140,21 +139,13 @@ class MineSetLogic extends BaseGetXController { @override void onReady() { - // TODO: implement onReady super.onReady(); _initLoadDataAction(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - @override void onClose() { - // TODO: implement onClose super.onClose(); _getNumberEvent!.cancel(); diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index 4bbb5a65..adce2eec 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -1,3 +1,4 @@ + import 'dart:io'; import 'package:flutter/cupertino.dart'; @@ -351,15 +352,15 @@ class _MineSetPageState extends State action: () { logic.showToast('功能暂未开放'.tr); }), - if (!F.isProductionEnv) - CommonItem( - leftTitel: '小米IOT平台'.tr, - rightTitle: '', - isHaveLine: widget.showAbout, - isHaveDirection: true, - action: () { - logic.showToast('功能暂未开放'.tr); - }), + // if (!F.isProductionEnv) + // CommonItem( + // leftTitel: '小米IOT平台'.tr, + // rightTitle: '', + // isHaveLine: widget.showAbout, + // isHaveDirection: true, + // action: () { + // logic.showToast('功能暂未开放'.tr); + // }), if (F.isXHJ) CommonItem( leftTitel: '客服'.tr, diff --git a/lib/mine/mineSet/mineSet/mineSet_state.dart b/lib/mine/mineSet/mineSet/mineSet_state.dart index 28a95535..932d97bc 100755 --- a/lib/mine/mineSet/mineSet/mineSet_state.dart +++ b/lib/mine/mineSet/mineSet/mineSet_state.dart @@ -3,19 +3,19 @@ import 'package:get/get.dart'; import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart'; class MineSetState { - final userInfoData = UserSettingInfoData().obs; - final userSetting = UserSettings().obs; + final Rx userInfoData = UserSettingInfoData().obs; + final Rx userSetting = UserSettings().obs; - var isPrompTone = false.obs; //提示音 - var isTouchUnlock = false.obs; //触摸开锁 - var isPushNotification = false.obs; //消息推送 - var isWechatPublicAccountPush = false.obs; //微信公众号推送 - var qrCodeUrl = ''.obs; //二维码地址 - var qrCodeText = ''.obs; //二维码提示语 + RxBool isPrompTone = false.obs; //提示音 + RxBool isTouchUnlock = false.obs; //触摸开锁 + RxBool isPushNotification = false.obs; //消息推送 + RxBool isWechatPublicAccountPush = false.obs; //微信公众号推送 + RxString qrCodeUrl = ''.obs; //二维码地址 + RxString qrCodeText = ''.obs; //二维码提示语 - var lockScreen = 2.obs; //锁屏 - var hideExpiredAccessFlag = 2.obs; //隐藏无效开锁 - var currentLanguage = "".obs; //隐藏无效开锁 + RxInt lockScreen = 2.obs; //锁屏 + RxInt hideExpiredAccessFlag = 2.obs; //隐藏无效开锁 + RxString currentLanguage = "".obs; //隐藏无效开锁 late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); diff --git a/lib/mine/mineSet/transferGateway/selectGetewayList_logic.dart b/lib/mine/mineSet/transferGateway/selectGetewayList_logic.dart index 4e24aa4e..26333cdd 100755 --- a/lib/mine/mineSet/transferGateway/selectGetewayList_logic.dart +++ b/lib/mine/mineSet/transferGateway/selectGetewayList_logic.dart @@ -1,4 +1,5 @@ +import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_entity.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../network/api_repository.dart'; @@ -9,7 +10,7 @@ class SelectGetewayListLogic extends BaseGetXController{ // 获取锁列表 Future getGetewayListData() async{ - var entity = await ApiRepository.to.getGatewayListData( + final GetewayDataEntity entity = await ApiRepository.to.getGatewayListData( pageNo: '1', pageSize: '20' ); @@ -20,23 +21,9 @@ class SelectGetewayListLogic extends BaseGetXController{ @override void onReady() { - // TODO: implement onReady super.onReady(); getGetewayListData(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - - } - } \ No newline at end of file diff --git a/lib/mine/mineSet/transferGateway/selectGetewayList_page.dart b/lib/mine/mineSet/transferGateway/selectGetewayList_page.dart index 23285f45..91e86a68 100755 --- a/lib/mine/mineSet/transferGateway/selectGetewayList_page.dart +++ b/lib/mine/mineSet/transferGateway/selectGetewayList_page.dart @@ -1,11 +1,12 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_state.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; import '../../../tools/noData.dart'; import 'selectGetewayList_entity.dart'; import 'selectGetewayList_logic.dart'; @@ -18,8 +19,8 @@ class SelectGetewayListPage extends StatefulWidget { } class _SelectGetewayListPageState extends State { - final logic = Get.put(SelectGetewayListLogic()); - final state = Get.find().state; + final SelectGetewayListLogic logic = Get.put(SelectGetewayListLogic()); + final SelectGetewayListState state = Get.find().state; @override Widget build(BuildContext context) { @@ -29,11 +30,11 @@ class _SelectGetewayListPageState extends State { barTitle: '选择网关'.tr, haveBack: true, backgroundColor: AppColors.mainColor, - actionsList: [ + actionsList: [ TextButton( onPressed: () { setState(() { - for (var element in state.getewayListData.value) { + for (GetewayItemData element in state.getewayListData.value) { if(state.isSelectAll == true){ state.isSelectAll = false; element.select = 0; @@ -45,13 +46,13 @@ class _SelectGetewayListPageState extends State { }); }, child: Text( - '全选', + '全选'.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), )) ], ), body: Column( - children: [ + children: [ Expanded(child: _buildMainUI()), SizedBox( height: 20.h, @@ -68,7 +69,7 @@ class _SelectGetewayListPageState extends State { Widget _buildMainUI() { return Obx(() => state.getewayListData.value.isNotEmpty ? ListView.separated( itemCount: state.getewayListData.value.length, - separatorBuilder: (context, index) { + separatorBuilder: (BuildContext context, int index) { return Divider( height: 1, indent: 20.w, @@ -76,7 +77,7 @@ class _SelectGetewayListPageState extends State { color: AppColors.greyLineColor, ); }, - itemBuilder: (c, index) { + itemBuilder: (BuildContext c, int index) { GetewayItemData getewayItemData = state.getewayListData.value[index]; return _electronicKeyItem(getewayItemData, () { setState(() { @@ -99,7 +100,7 @@ class _SelectGetewayListPageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, - children: [ + children: [ SizedBox( width: 20.w, ), @@ -138,27 +139,27 @@ class _SelectGetewayListPageState extends State { child: TextButton( onPressed: () async { bool isCanNext = false; - var idList = []; - for (var element in state.getewayListData.value) { + List idList = []; + for (final GetewayItemData element in state.getewayListData.value) { if(element.select == 1){ isCanNext = true; idList.add(element.plugId); } } if(isCanNext == false){ - logic.showToast("请选择锁".tr); + logic.showToast('请选择锁'.tr); return; } - var data = await Get.toNamed(Routers.recipientInformationPage, arguments: { - "idList":idList, - "isFromType":2, + final data = await Get.toNamed(Routers.recipientInformationPage, arguments: { + 'idList':idList, + 'isFromType':2, }); if(data != null) { logic.getGetewayListData(); } }, child: Text( - '下一步', + '下一步'.tr, style: TextStyle(fontSize: 24.sp, color: Colors.white), )), ), diff --git a/lib/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart b/lib/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart index c3e29c97..c5cb40b4 100755 --- a/lib/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart +++ b/lib/mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_logic.dart @@ -101,8 +101,8 @@ class RecipientInformationLogic extends BaseGetXController{ context: Get.context!, builder: (BuildContext context) { return CupertinoAlertDialog( - title: const Text('提示'), - content: const Text('确定要移除所选中的坏锁吗?'), + title: Text('提示'.tr), + content: Text('确定要移除所选中的坏锁吗?'.tr), actions: [ CupertinoDialogAction( child: Text('取消'.tr), diff --git a/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_page.dart b/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_page.dart index 0993e5a8..5dde1f3a 100755 --- a/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_page.dart +++ b/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_page.dart @@ -80,7 +80,7 @@ class _SelectBranchPageState extends State { ); }, itemBuilder: (BuildContext c, int index) { - return _electronicKeyItem('images/normal_circle.png', '分组一', () {}); + return _electronicKeyItem('images/normal_circle.png', '', () {}); }); } @@ -159,7 +159,7 @@ class _SelectBranchPageState extends State { child: Column( children: [ SizedBox(height: 20.h), - Text('转移确认', style: TextStyle(fontSize: 24.sp)), + Text('转移确认'.tr, style: TextStyle(fontSize: 24.sp)), SizedBox(height: 20.h), Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill), SizedBox(height: 15.h), diff --git a/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_state.dart b/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_state.dart index ab92bb77..2e5213e5 100755 --- a/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_state.dart +++ b/lib/mine/mineSet/transferSmartLock/selectBranch/selectBranch_state.dart @@ -2,16 +2,16 @@ import 'package:get/get.dart'; class SelectBranchState{ - var type = 1.obs;// 1、个人用户 2、星寓用户 - - final receiverNumber = "".obs; - final countryName = "中国".obs; - final countryCode = "86".obs; - final idList = [].obs; SelectBranchState() { Map map = Get.arguments; - idList.value = map["idList"]; - countryCode.value = map["countryCode"]; - receiverNumber.value = map["number"]; + idList.value = map['idList']; + countryCode.value = map['countryCode']; + receiverNumber.value = map['number']; } + RxInt type = 1.obs;// 1、个人用户 2、星寓用户 + + final RxString receiverNumber = ''.obs; + final RxString countryName = '中国'.obs; + final RxString countryCode = '86'.obs; + final RxList idList = [].obs; } \ No newline at end of file diff --git a/lib/mine/supportStaff/supportStaff_page.dart b/lib/mine/supportStaff/supportStaff_page.dart index 02e19795..cbfcb983 100755 --- a/lib/mine/supportStaff/supportStaff_page.dart +++ b/lib/mine/supportStaff/supportStaff_page.dart @@ -1,12 +1,11 @@ + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../app_settings/app_colors.dart'; -import '../../tools/commonItem.dart'; import '../../tools/titleAppBar.dart'; -import '../../translations/trans_lib.dart'; class SupportStaffPage extends StatefulWidget { const SupportStaffPage({Key? key}) : super(key: key); @@ -54,17 +53,24 @@ class _SupportStaffPageState extends State { const String url = 'https://blog.csdn.net/shulianghan'; _pushUrl(url); }), - supportStaffItem('电脑网页版'.tr, - 'www.starLock.com', false, true, '', () {}), - supportStaffItem('酒店系统'.tr, - 'www.starLock.com', false, true, '', () {}), + supportStaffItem( + '电脑网页版'.tr, + 'www.starLock.com', + false, + true, + '', () {}), + supportStaffItem( + '酒店系统'.tr, + 'www.starLock.com', + false, + true, + '', () {}), supportStaffItem( '说明书网页版'.tr, 'www.starLock.com', true, true, - 'images/mine/icon_mine_supportStaff_jump.png', - () {}), + 'images/mine/icon_mine_supportStaff_jump.png', () {}), ], ), ); diff --git a/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_logic.dart b/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_logic.dart index 41bebc90..ea084092 100755 --- a/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_logic.dart +++ b/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_logic.dart @@ -121,7 +121,7 @@ class AdvancedFeaturesWebLogic extends BaseGetXController { const Duration(seconds: 2)) { // 如果两次返回键时间间隔大于 2 秒,则提示再次按下返回键退出 _lastPressedAt = DateTime.now(); - showToast('再返回一次退出${F.title}'); + showToast('${'再返回一次退出'.tr}${F.title}'); return false; } SystemNavigator.pop(); diff --git a/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_state.dart b/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_state.dart index 39a8b2bf..c478181a 100755 --- a/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_state.dart +++ b/lib/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_state.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; diff --git a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart index 0135735d..695f63be 100755 --- a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart +++ b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart @@ -15,7 +15,7 @@ class AdvancedFunctionRecordLogic extends BaseGetXController { @override void onInit() { super.onInit(); - dynamic data = Get.arguments; + final dynamic data = Get.arguments; if (data is! Map || data['type'] is! String) { Get.back(); return; @@ -28,7 +28,7 @@ class AdvancedFunctionRecordLogic extends BaseGetXController { if (!load) { buyPageNo = 1; } - UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList( + final UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList( type: type, recordType: 10, pageNo: buyPageNo, diff --git a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart index 6da02664..b75dbf4f 100755 --- a/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart +++ b/lib/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_page.dart @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_logic.dart'; +import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_state.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/tools/noData.dart'; @@ -16,17 +17,16 @@ class AdvancedFunctionRecordPage extends StatefulWidget { _AdvancedFunctionRecordPageState(); } -class _AdvancedFunctionRecordPageState - extends State { - final logic = Get.put(AdvancedFunctionRecordLogic()); - final state = Get.find().state; +class _AdvancedFunctionRecordPageState extends State { + final AdvancedFunctionRecordLogic logic = Get.put(AdvancedFunctionRecordLogic()); + final AdvancedFunctionRecordState state = Get.find().state; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: TitleAppBar( - barTitle: "记录".tr, + barTitle: '记录'.tr, haveBack: true, iconColor: Colors.black, titleColor: Colors.black, @@ -37,7 +37,7 @@ class _AdvancedFunctionRecordPageState ? NoData() : ListView.builder( itemCount: state.buyRecordList.length, - itemBuilder: (context, index) { + itemBuilder: (BuildContext context, int index) { return _recordKeyItem(state.buyRecordList[index]); }, )), @@ -51,9 +51,9 @@ class _AdvancedFunctionRecordPageState padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h), child: Column( - children: [ + children: [ Row( - children: [ + children: [ Text( itemData.createdAt!.length > 10 ? itemData.createdAt!.substring(0, 10) @@ -76,8 +76,8 @@ class _AdvancedFunctionRecordPageState ), Row( mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text('${itemData.vipLockCount}把锁/${itemData.vipYear}年', + children: [ + Text('${itemData.vipLockCount}${'把锁'.tr}/${itemData.vipYear}${'年'.tr}', textAlign: TextAlign.left, style: TextStyle( fontSize: 22.sp, color: AppColors.darkGrayTextColor)) diff --git a/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart b/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart index a9ec7017..8796b6ae 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart @@ -125,7 +125,7 @@ class _ValueAddedServicesBuyPageState extends State { SizedBox(width: 5.w), GestureDetector( onTap: () { - logic.showToast('支付成功'); + logic.showToast('支付成功'.tr); }, child: Container( width: 180.w, @@ -161,12 +161,12 @@ class _ValueAddedServicesBuyPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - '500条', + '500${'条'.tr}', style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), ), SizedBox(height: 10.h), Text( - '¥50 (¥0.08/条)', + '¥50 (¥0.08/${'条'.tr})', style: TextStyle( fontSize: 20.sp, color: AppColors.placeholderTextColor), ), diff --git a/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart b/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart index 53b7ca2c..e847d0f7 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart @@ -9,7 +9,6 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_r import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class ValueAddedServicesHighFunctionPage extends StatefulWidget { const ValueAddedServicesHighFunctionPage({Key? key}) : super(key: key); @@ -208,7 +207,7 @@ class _ValueAddedServicesHighFunctionPageState padding: EdgeInsets.only( left: 20.w, top: 10.h, right: 20.w, bottom: 10.h), child: Text( - '查看详情 >', + '${'查看详情'.tr} >', style: TextStyle(fontSize: 20.sp), )), ), diff --git a/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart b/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart index 2bc90e2d..0353226d 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -70,7 +71,7 @@ class _ValueAddedServicesPageListState final bool? isVip = await Storage.getBool(saveIsVip); if (isVip == null || !isVip) { if (CommonDataManage().currentKeyInfo.isLockOwner != 1) { - logic.showToast('请先添加锁'); + logic.showToast('请先添加锁'.tr); } else { //刷新购买状态 Get.toNamed(Routers.advancedFeaturesWebPage, @@ -103,8 +104,8 @@ class _ValueAddedServicesPageListState if (!F.isProductionEnv) _valueAddedServicesItem( Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'), - '可视对讲', () { - EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); + '可视对讲'.tr, () { + EasyLoading.showToast('功能暂未开放'.tr, duration: 2000.milliseconds); }), if (!F.isProductionEnv) _valueAddedServicesItem( @@ -116,7 +117,7 @@ class _ValueAddedServicesPageListState fontWeight: FontWeight.w600), ), 'Amazon Alexa', () { - EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); + EasyLoading.showToast('功能暂未开放'.tr, duration: 2000.milliseconds); }), if (!F.isProductionEnv) _valueAddedServicesItem( @@ -128,20 +129,20 @@ class _ValueAddedServicesPageListState fontWeight: FontWeight.w600), ), 'Google Home', () { - EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); - }), - if (!F.isProductionEnv) - _valueAddedServicesItem( - Text( - 'M', - style: TextStyle( - color: Colors.white, - fontSize: 38.sp, - fontWeight: FontWeight.w600), - ), - '小米IOT平台', () { - EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds); + EasyLoading.showToast('功能暂未开放'.tr, duration: 2000.milliseconds); }), + // if (!F.isProductionEnv) + // _valueAddedServicesItem( + // Text( + // 'M', + // style: TextStyle( + // color: Colors.white, + // fontSize: 38.sp, + // fontWeight: FontWeight.w600), + // ), + // '小米IOT平台', () { + // EasyLoading.showToast('功能暂未开放'.tr, duration: 2000.milliseconds); + // }), ], ), ); diff --git a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart index 48d10b76..7d38b590 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart @@ -9,7 +9,6 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_r import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class ValueAddedServicesNoteAndEmailDetailPage extends StatefulWidget { const ValueAddedServicesNoteAndEmailDetailPage({Key? key}) : super(key: key); diff --git a/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart index 0428ff38..48cce872 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart @@ -1,6 +1,8 @@ import 'dart:async'; import 'package:get/utils.dart'; +import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/face_authentication_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -12,8 +14,7 @@ class ValueAddedServicesRealNameLogic extends BaseGetXController { //实名认证频次设置 Future setFaceAuthentication(int faceAuthFrequence) async { - FaceAuthenticationEntity entity = - await ApiRepository.to.setFaceAuthentication( + final FaceAuthenticationEntity entity = await ApiRepository.to.setFaceAuthentication( faceAuthFrequence: faceAuthFrequence, ); return entity.errorCode!.codeIsSuccessful; @@ -21,7 +22,7 @@ class ValueAddedServicesRealNameLogic extends BaseGetXController { //获取增值服务用户余量包 Future getServiceUserPackage() async { - var entity = await ApiRepository.to.getServiceUserPackage(); + final ValueAddedServicesHighFunctionEntity entity = await ApiRepository.to.getServiceUserPackage(); if (entity.errorCode!.codeIsSuccessful) { state.realNameRemainCount.value = entity.data!.cloudauthCount!; state.checkIndex.value = entity.data!.faceAuthFrequence ?? 1; @@ -32,7 +33,7 @@ class ValueAddedServicesRealNameLogic extends BaseGetXController { //增值服务套餐购包链接 Future getServicePackageBuyUrl() async { - var entity = await ApiRepository.to.getServicePackageBuyUrl(); + final AdvancedFeaturesWebEntity entity = await ApiRepository.to.getServicePackageBuyUrl(); if (entity.errorCode!.codeIsSuccessful) { state.realNameBuyUrl.value = entity.data!.cloudauthBuyUrl!; state.realNameBuyUrl.refresh(); @@ -40,7 +41,7 @@ class ValueAddedServicesRealNameLogic extends BaseGetXController { } Future check(int clickIndex) async { - bool isSuccessful = await setFaceAuthentication(clickIndex); + final bool isSuccessful = await setFaceAuthentication(clickIndex); if (isSuccessful) { showToast('修改成功'.tr); state.checkIndex.value = clickIndex; diff --git a/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_page.dart b/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_page.dart index 9d643ffe..d5e1fdfc 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_page.dart @@ -9,7 +9,6 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_r import '../../../app_settings/app_colors.dart'; import '../../../tools/commonItem.dart'; import '../../../tools/titleAppBar.dart'; -import '../../../translations/trans_lib.dart'; class ValueAddedServicesRealNamePage extends StatefulWidget { const ValueAddedServicesRealNamePage({Key? key}) : super(key: key); @@ -135,7 +134,7 @@ class _ValueAddedServicesRealNamePageState checkCommonItem( logic, '仅首次'.tr, 1), checkCommonItem(logic, '每日一次'.tr, 2), - checkCommonItem(logic, '每周一次', 3), + checkCommonItem(logic, '每周一次'.tr, 3), checkCommonItem(logic, '每月一次'.tr, 4, isHaveLine: false, isHaveRightWidget: true), ], diff --git a/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart b/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart index 9c2ec403..899211de 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart @@ -1,7 +1,7 @@ import 'package:get/get.dart'; class ValueAddedServicesRealNameState { - var checkIndex = 1.obs; - var realNameRemainCount = 0.obs; //当前剩余数量 - var realNameBuyUrl = ''.obs; //购买链接 + RxInt checkIndex = 1.obs; + RxInt realNameRemainCount = 0.obs; //当前剩余数量 + RxString realNameBuyUrl = ''.obs; //购买链接 } diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart index 6577c025..14bb572c 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart @@ -79,17 +79,17 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { void getBuyAndUserInfoStr(UseItemData itemData) { if (itemData.type == UseRecordListArg.sms['type']) { - state.buyCountStr.value = '${itemData.smsCount}条'; + state.buyCountStr.value = '${itemData.smsCount}${'条'.tr}'; state.useCountStr.value = - '${itemData.receiverAccount ?? ""} ${itemData.consCount}条'; + '${itemData.receiverAccount ?? ""} ${itemData.consCount}${'条'.tr}'; state.buyAmountStr.value = '¥${itemData.amount}'; } else if (itemData.type == UseRecordListArg.email['type']) { - state.buyCountStr.value = '${itemData.emailCount}封'; + state.buyCountStr.value = '${itemData.emailCount}${'封'.tr}'; state.useCountStr.value = - '${itemData.receiverAccount ?? ""} ${itemData.consCount}封'; + '${itemData.receiverAccount ?? ""} ${itemData.consCount}${'封'.tr}'; state.buyAmountStr.value = '¥${itemData.amount}'; } else if (itemData.type == UseRecordListArg.cloudauth['type']) { - state.buyCountStr.value = '实名认证/${itemData.cloudauthCount}次'; + state.buyCountStr.value = '${'实名认证'.tr}/${itemData.cloudauthCount}${'次'.tr}'; state.useCountStr.value = '${itemData.lockName ?? ""} ${itemData.realName ?? ""}'; state.buyAmountStr.value = '¥${itemData.amount}'; diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart index f8fd16ca..3366fca2 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart @@ -184,7 +184,7 @@ class _UseRecordsTable extends StatelessWidget { borderRadius: BorderRadius.circular(5.w), color: AppColors.toBeReceiveBgColor, ), - child: Text('失败', + child: Text('失败'.tr, style: TextStyle(fontSize: 16.sp, color: Colors.red)), ), ], diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart index 55f7a3d1..c240ed18 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart @@ -1,3 +1,4 @@ + import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -48,7 +49,7 @@ class NewSMSTemplateLogic extends BaseGetXController { templateType: state.currentTemplate.value.templateType ?? 0, ); if (entity.errorCode!.codeIsSuccessful) { - showToast('添加成功'); + showToast('添加成功'.tr); Get.back(result: true); } } @@ -60,7 +61,7 @@ class NewSMSTemplateLogic extends BaseGetXController { regards: state.templateOneTf.text, tips: state.templateTwoTf.text); if (entity.errorCode!.codeIsSuccessful) { - showToast('修改成功'); + showToast('修改成功'.tr); Get.back(result: true); } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart index 69bbfd3c..09f3b20a 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart @@ -11,7 +11,6 @@ import '../../../../tools/commonItem.dart'; import '../../../../tools/showBottomSheetTool.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; class NewSMSTemplatePage extends StatefulWidget { const NewSMSTemplatePage({Key? key}) : super(key: key); @@ -97,7 +96,7 @@ class _NewSMSTemplatePageState extends State { : Container()), Obx(() => state.isUpdate.value == false ? CommonItem( - leftTitel: '模版类型', + leftTitel: '模版类型'.tr, rightTitle: state.currentTemplate.value.langName ?? '', isHaveLine: false, isHaveDirection: true, @@ -211,7 +210,7 @@ class _NewSMSTemplatePageState extends State { } else { return RichText( text: TextSpan( - children: state.currentTemplate.value.templateName == '电子钥匙' + children: state.currentTemplate.value.templateName == '电子钥匙'.tr ? logic.buildElectronicKeySpan(isPreview: isPreview) : logic.buildPasswordSpan(isPreview: isPreview), ), diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart index 47e5335c..363d53f0 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart @@ -70,7 +70,7 @@ class _CustomSMSTemplateListPageState extends State { templateData.channelType = state.channelType.value; templateData.isUpdate = false; templateData.templateName = - templateData.templateType == 1 ? '电子钥匙' : '密码'; + templateData.templateType == 1 ? '电子钥匙'.tr : '密码'.tr; final result = await Get.toNamed(Routers.newSMSTemplatePage, arguments: { 'currentTemplate': templateData, @@ -204,8 +204,7 @@ class _CustomSMSTemplateListPageState extends State { templateData.id = itemData.id; templateData.template = itemData.template; templateData.templateType = itemData.templateType; - templateData.templateName = - templateData.templateName == 1 ? '电子钥匙' : '密码'; + templateData.templateName = templateData.templateName == 1 ? '电子钥匙'.tr : '密码'.tr; templateData.channelType = itemData.channelType; templateData.isUpdate = true; final result = await Get.toNamed(Routers.newSMSTemplatePage, diff --git a/lib/network/api_provider_base.dart b/lib/network/api_provider_base.dart index 6eb0ac4a..e6563cdb 100755 --- a/lib/network/api_provider_base.dart +++ b/lib/network/api_provider_base.dart @@ -90,7 +90,7 @@ class BaseProvider extends GetConnect with Api { Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); break; case 500: - // EasyLoading.showToast('服务器错误', duration: 2000.milliseconds); + EasyLoading.showToast('服务器错误', duration: 2000.milliseconds); break; case 421: case 422: diff --git a/lib/versionUndate/versionUndateTool.dart b/lib/versionUndate/versionUndateTool.dart index 39849038..181395a8 100755 --- a/lib/versionUndate/versionUndateTool.dart +++ b/lib/versionUndate/versionUndateTool.dart @@ -36,10 +36,10 @@ class VersionUndateTool { // 获取版本号 void getVersionData() async { - DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); + final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); String brandName = ''; if (Platform.isAndroid) { - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; + final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; AppLog.log('androidInfo.manufacturer:${androidInfo.manufacturer}' 'androidInfo.device:${androidInfo.device}' 'androidInfo.model:${androidInfo.model}' @@ -54,14 +54,14 @@ class VersionUndateTool { 'androidInfo.bootloader:${androidInfo.bootloader}'); brandName = androidInfo.manufacturer; } else if (Platform.isIOS) { - IosDeviceInfo iosInfo = await deviceInfo.iosInfo; + final IosDeviceInfo iosInfo = await deviceInfo.iosInfo; brandName = iosInfo.systemName!; } - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - var version = packageInfo.version; - AppLog.log("updateGetversion:$version"); - var entity = await ApiRepository.to.getVersionData( + final PackageInfo packageInfo = await PackageInfo.fromPlatform(); + final String version = packageInfo.version; + // AppLog.log("updateGetversion:$version"); + final VersionUndateEntity entity = await ApiRepository.to.getVersionData( brandName: brandName, currentVersion: version, ); @@ -75,31 +75,31 @@ class VersionUndateTool { void showUpdateAlertDialog(VersionUndateEntity versionUndateEntity) { showCupertinoDialog( context: Get.context!, - builder: (context) { + builder: (BuildContext context) { return CupertinoAlertDialog( content: Column( mainAxisSize: MainAxisSize.min, - children: [ + children: [ Container( // color: AppColors.mainColor, alignment: Alignment.topCenter, height: 50.h, child: Text( - '版本更新', + '版本更新'.tr, style: TextStyle(fontSize: 28.sp, color: Colors.blue), )), Container( padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), alignment: Alignment.centerLeft, - child: Text(versionUndateEntity.data!.description! ?? "", + child: Text(versionUndateEntity.data!.description! ?? '', textAlign: TextAlign.start, style: TextStyle(fontSize: 20.sp))), ], ), actions: versionUndateEntity.data!.isForceUpdate == 0 - ? [ + ? [ CupertinoDialogAction( - child: Text("下次再说"), + child: Text('下次再说'.tr), onPressed: () { Navigator.pop(context); // Storage.setString( @@ -119,7 +119,7 @@ class VersionUndateTool { }, ), ] - : [ + : [ CupertinoDialogAction( child: Text('确定'.tr), onPressed: () async {