修改未完成国际化字段
This commit is contained in:
parent
b25bf61db1
commit
e817883575
@ -861,5 +861,15 @@
|
|||||||
"QQ空间": "QQZone",
|
"QQ空间": "QQZone",
|
||||||
"微博": "Weibo",
|
"微博": "Weibo",
|
||||||
"FaceBook": "FaceBook",
|
"FaceBook": "FaceBook",
|
||||||
"链接": "Link"
|
"链接": "Link",
|
||||||
|
"今天": "Today",
|
||||||
|
"密码错误": "Password error",
|
||||||
|
"网络中断": "Network interruption",
|
||||||
|
"钥匙不存在": "Key does not exist",
|
||||||
|
"钥匙过期": "Key expired",
|
||||||
|
"钥匙已存在": "Key already exists",
|
||||||
|
"密码失效": "Password invalid",
|
||||||
|
"门锁时间异常": "Door lock time abnormal",
|
||||||
|
"APP(手机)未联网": "APP (mobile phone) is not connected to the Internet",
|
||||||
|
"数据不存在": "Data does not exist"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -893,5 +893,15 @@
|
|||||||
"QQ空间": "QQ空间",
|
"QQ空间": "QQ空间",
|
||||||
"微博": "微博",
|
"微博": "微博",
|
||||||
"FaceBook": "FaceBook",
|
"FaceBook": "FaceBook",
|
||||||
"链接": "链接"
|
"链接": "链接",
|
||||||
|
"今天": "今天",
|
||||||
|
"密码错误": "密码错误",
|
||||||
|
"网络中断": "网络中断",
|
||||||
|
"钥匙不存在": "钥匙不存在",
|
||||||
|
"钥匙过期": "钥匙过期",
|
||||||
|
"钥匙已存在": "钥匙已存在",
|
||||||
|
"密码失效": "密码失效",
|
||||||
|
"门锁时间异常": "门锁时间异常",
|
||||||
|
"APP(手机)未联网": "APP(手机)未联网",
|
||||||
|
"数据不存在": "数据不存在"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -859,5 +859,15 @@
|
|||||||
"QQ空间": "QQ空间",
|
"QQ空间": "QQ空间",
|
||||||
"微博": "微博",
|
"微博": "微博",
|
||||||
"FaceBook": "FaceBook",
|
"FaceBook": "FaceBook",
|
||||||
"链接": "链接"
|
"链接": "链接",
|
||||||
|
"今天": "今天",
|
||||||
|
"密码错误": "密码错误",
|
||||||
|
"网络中断": "网络中断",
|
||||||
|
"钥匙不存在": "钥匙不存在",
|
||||||
|
"钥匙过期": "钥匙过期",
|
||||||
|
"钥匙已存在": "钥匙已存在",
|
||||||
|
"密码失效": "密码失效",
|
||||||
|
"门锁时间异常": "门锁时间异常",
|
||||||
|
"APP(手机)未联网": "APP(手机)未联网",
|
||||||
|
"数据不存在": "数据不存在"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,23 +120,23 @@ class AppColors {
|
|||||||
static Color progressBgColor = const Color(0xFF022345);
|
static Color progressBgColor = const Color(0xFF022345);
|
||||||
static Color progressValueColor = const Color(0xFF0093E5);
|
static Color progressValueColor = const Color(0xFF0093E5);
|
||||||
|
|
||||||
static const greyLineColor = Color.fromRGBO(240, 240, 240, 1); //灰色分割线220
|
static const Color greyLineColor = Color.fromRGBO(240, 240, 240, 1); //灰色分割线220
|
||||||
static const darkGrayTextColor = Color.fromRGBO(65, 65, 65, 1); //深灰色字体
|
static const Color darkGrayTextColor = Color.fromRGBO(65, 65, 65, 1); //深灰色字体
|
||||||
static const placeholderTextColor = Color.fromRGBO(128, 128, 128, 1); //占位字体颜色
|
static const Color placeholderTextColor = Color.fromRGBO(128, 128, 128, 1); //占位字体颜色
|
||||||
static const greyBackgroundColor = Color.fromRGBO(240, 240, 240, 1); //灰色背景色
|
static const Color greyBackgroundColor = Color.fromRGBO(240, 240, 240, 1); //灰色背景色
|
||||||
static const btnDisableColor = Color.fromRGBO(178, 178, 178, 1); //按钮不可用灰色
|
static const Color btnDisableColor = Color.fromRGBO(178, 178, 178, 1); //按钮不可用灰色
|
||||||
static const toBeReceiveBgColor = Color.fromRGBO(246, 203, 203, 1); //待接收红色背景
|
static const Color toBeReceiveBgColor = Color.fromRGBO(246, 203, 203, 1); //待接收红色背景
|
||||||
static const expireTextBgColor = Color.fromRGBO(253, 166, 8, 1); //即将到期时间字体背景色
|
static const Color expireTextBgColor = Color.fromRGBO(253, 166, 8, 1); //即将到期时间字体背景色
|
||||||
static const blueTextTipsColor = Color.fromRGBO(0, 113, 255, 1); //蓝色字体tips
|
static const Color blueTextTipsColor = Color.fromRGBO(0, 113, 255, 1); //蓝色字体tips
|
||||||
static const blueViewBgColor =
|
static const Color blueViewBgColor =
|
||||||
Color.fromRGBO(223, 237, 254, 1); //蓝色背景板 139 148 176
|
Color.fromRGBO(223, 237, 254, 1); //蓝色背景板 139 148 176
|
||||||
static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //消息提醒字体颜色
|
static const Color msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //消息提醒字体颜色
|
||||||
static const alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); //透明度背景
|
static const Color alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); //透明度背景
|
||||||
static const vipFeatureBgColor =
|
static const Color vipFeatureBgColor =
|
||||||
Color.fromRGBO(251, 248, 229, 1); //需开通高级功能背景色
|
Color.fromRGBO(251, 248, 229, 1); //需开通高级功能背景色
|
||||||
static const vipFeatureBtnBgColor =
|
static const Color vipFeatureBtnBgColor =
|
||||||
Color.fromRGBO(197, 167, 109, 1); //需开通高级功能按钮背景色
|
Color.fromRGBO(197, 167, 109, 1); //需开通高级功能按钮背景色
|
||||||
static const vipFeatureBtnTextColor =
|
static const Color vipFeatureBtnTextColor =
|
||||||
Color.fromRGBO(110, 98, 81, 1); //需开通高级功能字体颜色
|
Color.fromRGBO(110, 98, 81, 1); //需开通高级功能字体颜色
|
||||||
|
|
||||||
static Color openPassageModeColor = const Color(0xFFEB2A3B); // 首页开启常开模式颜色(红色)
|
static Color openPassageModeColor = const Color(0xFFEB2A3B); // 首页开启常开模式颜色(红色)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/mine/about/debug/debug_console.dart';
|
import 'package:star_lock/mine/about/debug/debug_console.dart';
|
||||||
|
|
||||||
class AppLog {
|
class AppLog {
|
||||||
@ -103,7 +103,7 @@ class AppDate {
|
|||||||
static int timeZeroOffset() => DateTime.now().timeZoneOffset.inHours;
|
static int timeZeroOffset() => DateTime.now().timeZoneOffset.inHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO:错误类型
|
// 错误类型
|
||||||
enum ErrorType {
|
enum ErrorType {
|
||||||
modeNotMatch,
|
modeNotMatch,
|
||||||
notConnected,
|
notConnected,
|
||||||
|
|||||||
@ -24,27 +24,27 @@ abstract class Reply{
|
|||||||
case 0x01:
|
case 0x01:
|
||||||
// 包格式错误
|
// 包格式错误
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x01 包格式错误');
|
AppLog.log('$logTag ${commandType!.typeName} 0x01 包格式错误');
|
||||||
showErrorMessage('包格式错误');
|
// showErrorMessage('包格式错误');
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
// 密码错误
|
// 密码错误
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x02 密码错误');
|
AppLog.log('$logTag ${commandType!.typeName} 0x02 密码错误');
|
||||||
showErrorMessage('密码错误');
|
showErrorMessage('密码错误'.tr);
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
// 网络中断
|
// 网络中断
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x03 网络中断');
|
AppLog.log('$logTag ${commandType!.typeName} 0x03 网络中断');
|
||||||
showErrorMessage('网络中断');
|
showErrorMessage('网络中断'.tr);
|
||||||
break;
|
break;
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// 用户未登记
|
// 用户未登记
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x04 用户未登记');
|
AppLog.log('$logTag ${commandType!.typeName} 0x04 用户未登记');
|
||||||
showErrorMessage('用户未登记');
|
// showErrorMessage('用户未登记');
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
// 参数错误
|
// 参数错误
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x05 参数错误');
|
AppLog.log('$logTag ${commandType!.typeName} 0x05 参数错误');
|
||||||
showErrorMessage('参数错误');
|
// showErrorMessage('参数错误');
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
// 需要鉴权
|
// 需要鉴权
|
||||||
@ -59,42 +59,42 @@ abstract class Reply{
|
|||||||
case 0x08:
|
case 0x08:
|
||||||
// 应答超时
|
// 应答超时
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x08 应答超时');
|
AppLog.log('$logTag ${commandType!.typeName} 0x08 应答超时');
|
||||||
showErrorMessage('应答超时');
|
// showErrorMessage('应答超时');
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// 权限校验错误
|
// 权限校验错误
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x09 权限校验错误');
|
AppLog.log('$logTag ${commandType!.typeName} 0x09 权限校验错误');
|
||||||
showErrorMessage('权限校验错误');
|
// showErrorMessage('权限校验错误');
|
||||||
break;
|
break;
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
// 钥匙不存在
|
// 钥匙不存在
|
||||||
showErrorMessage('钥匙不存在');
|
showErrorMessage('钥匙不存在'.tr);
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x0a 钥匙不存在');
|
AppLog.log('$logTag ${commandType!.typeName} 0x0a 钥匙不存在');
|
||||||
break;
|
break;
|
||||||
case 0x0b:
|
case 0x0b:
|
||||||
// 钥匙过期
|
// 钥匙过期
|
||||||
showErrorMessage('钥匙过期');
|
showErrorMessage('钥匙过期'.tr);
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x0b 钥匙过期');
|
AppLog.log('$logTag ${commandType!.typeName} 0x0b 钥匙过期');
|
||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
// 钥匙数量已到上限
|
// 钥匙数量已到上限
|
||||||
showErrorMessage('钥匙数量已到上限');
|
// showErrorMessage('钥匙数量已到上限');
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限');
|
AppLog.log('$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限');
|
||||||
break;
|
break;
|
||||||
case 0x0d:
|
case 0x0d:
|
||||||
// 钥匙无效
|
// 钥匙无效
|
||||||
showErrorMessage('钥匙无效');
|
showErrorMessage('钥匙无效'.tr);
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x0d 钥匙无效');
|
AppLog.log('$logTag ${commandType!.typeName} 0x0d 钥匙无效');
|
||||||
break;
|
break;
|
||||||
case 0x0e:
|
case 0x0e:
|
||||||
// 钥匙已存在
|
// 钥匙已存在
|
||||||
showErrorMessage('钥匙已存在');
|
showErrorMessage('钥匙已存在'.tr);
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x0e 钥匙已存在');
|
AppLog.log('$logTag ${commandType!.typeName} 0x0e 钥匙已存在');
|
||||||
break;
|
break;
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
// 用户已存在
|
// 用户已存在
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x0f 用户已存在');
|
AppLog.log('$logTag ${commandType!.typeName} 0x0f 用户已存在');
|
||||||
showErrorMessage('用户已存在');
|
// showErrorMessage('用户已存在');
|
||||||
break;
|
break;
|
||||||
case 0x10:
|
case 0x10:
|
||||||
// 密码失效
|
// 密码失效
|
||||||
@ -104,27 +104,27 @@ abstract class Reply{
|
|||||||
case 0x11:
|
case 0x11:
|
||||||
// 无效指令
|
// 无效指令
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x11 无效指令');
|
AppLog.log('$logTag ${commandType!.typeName} 0x11 无效指令');
|
||||||
showErrorMessage('无效指令');
|
// showErrorMessage('无效指令');
|
||||||
break;
|
break;
|
||||||
case 0x12:
|
case 0x12:
|
||||||
// 门锁时间异常
|
// 门锁时间异常
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x12 门锁时间异常');
|
AppLog.log('$logTag ${commandType!.typeName} 0x12 门锁时间异常');
|
||||||
showErrorMessage('门锁时间异常');
|
showErrorMessage('门锁时间异常'.tr);
|
||||||
break;
|
break;
|
||||||
case 0x15:
|
case 0x15:
|
||||||
// APP(手机)未联网
|
// APP(手机)未联网
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0x15 APP(手机)未联网');
|
AppLog.log('$logTag ${commandType!.typeName} 0x15 APP(手机)未联网');
|
||||||
showErrorMessage('APP(手机)未联网');
|
showErrorMessage('APP(手机)未联网'.tr);
|
||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
// 正在开锁中...
|
// 正在开锁中...
|
||||||
AppLog.log('$logTag ${commandType!.typeName} $status 正在开锁中...');
|
AppLog.log('$logTag ${commandType!.typeName} $status 正在开锁中...');
|
||||||
showErrorMessage('正在开锁中...');
|
showErrorMessage('正在开锁中...'.tr);
|
||||||
break;
|
break;
|
||||||
case 0xff:
|
case 0xff:
|
||||||
// 异常,未知错误
|
// 异常,未知错误
|
||||||
AppLog.log('$logTag ${commandType!.typeName} 0xff 异常,未知错误');
|
AppLog.log('$logTag ${commandType!.typeName} 0xff 异常,未知错误');
|
||||||
showErrorMessage('异常,未知错误');
|
// showErrorMessage('异常,未知错误');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
|||||||
@ -14,7 +14,7 @@ abstract class SenderProtocol extends IOData {
|
|||||||
// var uint8View1 = Uint8List(300);
|
// var uint8View1 = Uint8List(300);
|
||||||
|
|
||||||
CommandType? commandType; //指令类型
|
CommandType? commandType; //指令类型
|
||||||
final List<int> header = [
|
final List<int> header = <int>[
|
||||||
0XEF,
|
0XEF,
|
||||||
0X01,
|
0X01,
|
||||||
0XEE,
|
0XEE,
|
||||||
@ -26,7 +26,7 @@ abstract class SenderProtocol extends IOData {
|
|||||||
int identifier =
|
int identifier =
|
||||||
0x20; // 高 4 位表示包版本,低 4 位用来指示后面数据的加密类型,长度为 1 字节,加密类型取值说明,0:明文,1:AES128,2:SM4(事先约定密钥),3:SM4(设备指定密钥)
|
0x20; // 高 4 位表示包版本,低 4 位用来指示后面数据的加密类型,长度为 1 字节,加密类型取值说明,0:明文,1:AES128,2:SM4(事先约定密钥),3:SM4(设备指定密钥)
|
||||||
|
|
||||||
List<int>? commandData = []; //数据块
|
List<int>? commandData = <int>[]; //数据块
|
||||||
// final int? tail = 0xFF; //用来校验包的完整性,采用 CRC 校验方法,长度为 2 个字节
|
// final int? tail = 0xFF; //用来校验包的完整性,采用 CRC 校验方法,长度为 2 个字节
|
||||||
|
|
||||||
SenderProtocol(this.commandType) {
|
SenderProtocol(this.commandType) {
|
||||||
@ -42,7 +42,7 @@ abstract class SenderProtocol extends IOData {
|
|||||||
//TODO:拼装数据
|
//TODO:拼装数据
|
||||||
List<int> packageData() {
|
List<int> packageData() {
|
||||||
commandData = messageDetail();
|
commandData = messageDetail();
|
||||||
List<int> commandList = [];
|
List<int> commandList = <int>[];
|
||||||
|
|
||||||
// 帧头
|
// 帧头
|
||||||
commandList.addAll(header);
|
commandList.addAll(header);
|
||||||
@ -78,7 +78,7 @@ abstract class SenderProtocol extends IOData {
|
|||||||
commandList.addAll(commandData!); //数据块
|
commandList.addAll(commandData!); //数据块
|
||||||
|
|
||||||
// 校验位
|
// 校验位
|
||||||
var mcrc = crc_16(commandList);
|
int mcrc = crc_16(commandList);
|
||||||
double mcrcDouble = mcrc / 256;
|
double mcrcDouble = mcrc / 256;
|
||||||
int mcrcDouble1 = mcrcDouble.toInt();
|
int mcrcDouble1 = mcrcDouble.toInt();
|
||||||
int mcrcDouble2 = mcrc % 256;
|
int mcrcDouble2 = mcrc % 256;
|
||||||
@ -94,7 +94,7 @@ abstract class SenderProtocol extends IOData {
|
|||||||
//TODO:长度
|
//TODO:长度
|
||||||
int dataSourceLength() => commandData!.length;
|
int dataSourceLength() => commandData!.length;
|
||||||
|
|
||||||
var crcTable = [
|
List<int> crcTable = <int>[
|
||||||
0x0000,
|
0x0000,
|
||||||
0x1021,
|
0x1021,
|
||||||
0x2042,
|
0x2042,
|
||||||
@ -355,9 +355,9 @@ abstract class SenderProtocol extends IOData {
|
|||||||
|
|
||||||
int crc_16(buffer) {
|
int crc_16(buffer) {
|
||||||
var len = buffer.length;
|
var len = buffer.length;
|
||||||
var value_ = 0x0000; //0xa635; //初始值,根据CRC类型设定
|
int value_ = 0x0000; //0xa635; //初始值,根据CRC类型设定
|
||||||
var tmp;
|
int tmp;
|
||||||
for (var i = 0; i < buffer.length; i++) {
|
for (int i = 0; i < buffer.length; i++) {
|
||||||
tmp = reverse8(buffer[i]);
|
tmp = reverse8(buffer[i]);
|
||||||
value_ =
|
value_ =
|
||||||
((value_ << 8) ^ crcTable[((value_ >> 8) ^ tmp) & 0xFF]) & 0xFFFF;
|
((value_ << 8) ^ crcTable[((value_ >> 8) ^ tmp) & 0xFF]) & 0xFFFF;
|
||||||
@ -367,8 +367,8 @@ abstract class SenderProtocol extends IOData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int reverse8(data) {
|
int reverse8(data) {
|
||||||
var i;
|
int i;
|
||||||
var temp = 0;
|
int temp = 0;
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
//字节反转
|
//字节反转
|
||||||
temp |= ((data >> i) & 0x01) << (7 - i);
|
temp |= ((data >> i) & 0x01) << (7 - i);
|
||||||
@ -377,8 +377,8 @@ abstract class SenderProtocol extends IOData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int reverse16(data) {
|
int reverse16(data) {
|
||||||
var i;
|
int i;
|
||||||
var temp = 0;
|
int temp = 0;
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
//反转
|
//反转
|
||||||
temp |= ((data >> i) & 0x0001) << (15 - i);
|
temp |= ((data >> i) & 0x0001) << (15 - i);
|
||||||
|
|||||||
@ -10,14 +10,6 @@ extension Extension on DataChannel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class EventSendModel {
|
class EventSendModel {
|
||||||
List<int> data = [];
|
|
||||||
String? topic = '';
|
|
||||||
DataChannel? sendChannel;
|
|
||||||
|
|
||||||
String? deviceId;
|
|
||||||
Uuid? serviceId;
|
|
||||||
Uuid? characteristicId;
|
|
||||||
bool? allowLongWrite = false;
|
|
||||||
|
|
||||||
EventSendModel(
|
EventSendModel(
|
||||||
{required this.data,
|
{required this.data,
|
||||||
@ -27,31 +19,39 @@ class EventSendModel {
|
|||||||
this.serviceId,
|
this.serviceId,
|
||||||
this.characteristicId,
|
this.characteristicId,
|
||||||
this.allowLongWrite});
|
this.allowLongWrite});
|
||||||
|
List<int> data = [];
|
||||||
|
String? topic = '';
|
||||||
|
DataChannel? sendChannel;
|
||||||
|
|
||||||
|
String? deviceId;
|
||||||
|
Uuid? serviceId;
|
||||||
|
Uuid? characteristicId;
|
||||||
|
bool? allowLongWrite = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///接收数据类
|
///接收数据类
|
||||||
class EventReceiveModel {
|
class EventReceiveModel {
|
||||||
|
|
||||||
|
EventReceiveModel({required this.data, this.sendChannel, this.tag});
|
||||||
dynamic data;
|
dynamic data;
|
||||||
String? tag = '';
|
String? tag = '';
|
||||||
DataChannel? sendChannel;
|
DataChannel? sendChannel;
|
||||||
|
|
||||||
EventReceiveModel({required this.data, this.sendChannel, this.tag});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///解析数据域
|
///解析数据域
|
||||||
class EventParseModel {
|
class EventParseModel {
|
||||||
|
|
||||||
|
EventParseModel({required this.type, required this.data, this.commandIndex});
|
||||||
int? type;
|
int? type;
|
||||||
int? commandIndex;
|
int? commandIndex;
|
||||||
dynamic data;
|
dynamic data;
|
||||||
|
|
||||||
EventParseModel({required this.type, required this.data, this.commandIndex});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///debug info model
|
///debug info model
|
||||||
class StateModel {
|
class StateModel {
|
||||||
|
|
||||||
|
StateModel({this.title = '', this.subTitle = '', this.result = false});
|
||||||
final String title;
|
final String title;
|
||||||
final String subTitle;
|
final String subTitle;
|
||||||
final bool result;
|
final bool result;
|
||||||
|
|
||||||
StateModel({this.title = '', this.subTitle = '', this.result = false});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ int _hexToInt(String hex) {
|
|||||||
// a..f
|
// a..f
|
||||||
val += (hexDigit - 87) * (1 << (4 * (len - 1 - i)));
|
val += (hexDigit - 87) * (1 << (4 * (len - 1 - i)));
|
||||||
} else {
|
} else {
|
||||||
throw FormatException("Invalid hexadecimal value");
|
throw const FormatException('Invalid hexadecimal value');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
@ -74,13 +74,13 @@ List<int> getFixedLengthList(List<int> data, int length) {
|
|||||||
//int ---> 指定长度的hex (如指定长度为6的情况,0x000001 0x001234, 0xefab23)
|
//int ---> 指定长度的hex (如指定长度为6的情况,0x000001 0x001234, 0xefab23)
|
||||||
String intToFormatHex(int num, int length) {
|
String intToFormatHex(int num, int length) {
|
||||||
final String hexString = num.toRadixString(16);
|
final String hexString = num.toRadixString(16);
|
||||||
final String formatString = hexString.padLeft(length, "0");
|
final String formatString = hexString.padLeft(length, '0');
|
||||||
return formatString;
|
return formatString;
|
||||||
}
|
}
|
||||||
|
|
||||||
String uint8ToHex(Uint8List byteArr) {
|
String uint8ToHex(Uint8List byteArr) {
|
||||||
if (byteArr.isEmpty) {
|
if (byteArr.isEmpty) {
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
final Uint8List result = Uint8List(byteArr.length << 1);
|
final Uint8List result = Uint8List(byteArr.length << 1);
|
||||||
final List<String> hexTable = <String>[
|
final List<String> hexTable = <String>[
|
||||||
|
|||||||
@ -8,8 +8,10 @@ class ECFieldElementFp {
|
|||||||
|
|
||||||
/// 判断相等
|
/// 判断相等
|
||||||
bool equals(ECFieldElementFp other) {
|
bool equals(ECFieldElementFp other) {
|
||||||
if (other == this) return true;
|
if (other == this) {
|
||||||
return (q == other.q && x == other.x);
|
return true;
|
||||||
|
}
|
||||||
|
return q == other.q && x == other.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 返回具体数值
|
/// 返回具体数值
|
||||||
|
|||||||
@ -3,41 +3,41 @@ import 'dart:convert';
|
|||||||
|
|
||||||
class SMUtils{
|
class SMUtils{
|
||||||
static int leftShift(int x, int n){
|
static int leftShift(int x, int n){
|
||||||
int s = n & 31;
|
final int s = n & 31;
|
||||||
x = (x & 0xFFFFFFFF).toSigned(32);
|
x = (x & 0xFFFFFFFF).toSigned(32);
|
||||||
return (((x << s) | ((x & 0xFFFFFFFF) >> (32 - s))) & 0xFFFFFFFF).toSigned(32);
|
return (((x << s) | ((x & 0xFFFFFFFF) >> (32 - s))) & 0xFFFFFFFF).toSigned(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rightShift(int x, int n) {
|
static int rightShift(int x, int n) {
|
||||||
int s = n & 31;
|
final int s = n & 31;
|
||||||
x = (x & 0xFFFFFFFF).toSigned(32);
|
x = (x & 0xFFFFFFFF).toSigned(32);
|
||||||
return ((x >> s) | ((x << (32 - s)) & 0xFFFFFFFF)).toSigned(32);
|
return ((x >> s) | ((x << (32 - s)) & 0xFFFFFFFF)).toSigned(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String bytesToHexString(List<int> bytes) {
|
static String bytesToHexString(List<int> bytes) {
|
||||||
final buffer = StringBuffer();
|
final StringBuffer buffer = StringBuffer();
|
||||||
for (final byte in bytes) {
|
for (final int byte in bytes) {
|
||||||
buffer.write(byte.toRadixString(16).padLeft(2, '0'));
|
buffer.write(byte.toRadixString(16).padLeft(2, '0'));
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<int> hexStringToBytes(String hexString) {
|
static List<int> hexStringToBytes(String hexString) {
|
||||||
final length = hexString.length ~/ 2;
|
final int length = hexString.length ~/ 2;
|
||||||
final bytes = List<int>.filled(length, 0);
|
final List<int> bytes = List<int>.filled(length, 0);
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
final byteString = hexString.substring(i * 2, i * 2 + 2);
|
final String byteString = hexString.substring(i * 2, i * 2 + 2);
|
||||||
bytes[i] = int.parse(byteString, radix: 16);
|
bytes[i] = int.parse(byteString, radix: 16);
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String utf8ToHexString(String input) {
|
static String utf8ToHexString(String input) {
|
||||||
List<int> utf8Encoded = utf8.encode(input);
|
final List<int> utf8Encoded = utf8.encode(input);
|
||||||
// 转换到16进制
|
// 转换到16进制
|
||||||
StringBuffer hexChars = StringBuffer();
|
final StringBuffer hexChars = StringBuffer();
|
||||||
for (int i = 0; i < utf8Encoded.length; i++) {
|
for (int i = 0; i < utf8Encoded.length; i++) {
|
||||||
int bite = utf8Encoded[i];
|
final int bite = utf8Encoded[i];
|
||||||
hexChars.write((bite >> 4).toRadixString(16));
|
hexChars.write((bite >> 4).toRadixString(16));
|
||||||
hexChars.write((bite & 0x0f).toRadixString(16));
|
hexChars.write((bite & 0x0f).toRadixString(16));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,7 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||||
break;
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
EasyLoading.showToast('服务器错误', duration: 2000.milliseconds);
|
// EasyLoading.showToast('服务器错误', duration: 2000.milliseconds);
|
||||||
break;
|
break;
|
||||||
case 421:
|
case 421:
|
||||||
case 422:
|
case 422:
|
||||||
@ -102,11 +102,11 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
// Toast.show(msg: "用户不存在");
|
// Toast.show(msg: "用户不存在");
|
||||||
// break;
|
// break;
|
||||||
case 10001:
|
case 10001:
|
||||||
EasyLoading.showToast('数据不存在', duration: 2000.milliseconds);
|
EasyLoading.showToast('数据不存在'.tr, duration: 2000.milliseconds);
|
||||||
break;
|
break;
|
||||||
case 434: //与后台约定弹出确认框提示
|
case 434: //与后台约定弹出确认框提示
|
||||||
ShowTipView()
|
ShowTipView()
|
||||||
.showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '确定');
|
.showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_connect/http/src/request/request.dart';
|
import 'package:get/get_connect/http/src/request/request.dart';
|
||||||
|
|
||||||
import '../tools/manager/client_manager.dart';
|
import '../tools/manager/client_manager.dart';
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class Header extends StatelessWidget {
|
|||||||
vertical: 4.0,
|
vertical: 4.0,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'今天',
|
'今天'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 24.sp,
|
fontSize: 24.sp,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
final monthPageIndex = widget.preloadMonthViewAmount ~/ 2;
|
final int monthPageIndex = widget.preloadMonthViewAmount ~/ 2;
|
||||||
|
|
||||||
_monthViewCurrentPage = ValueNotifier(monthPageIndex);
|
_monthViewCurrentPage = ValueNotifier(monthPageIndex);
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
initialPage: monthPageIndex,
|
initialPage: monthPageIndex,
|
||||||
);
|
);
|
||||||
|
|
||||||
final weekPageIndex = widget.preloadWeekViewAmount ~/ 2;
|
final int weekPageIndex = widget.preloadWeekViewAmount ~/ 2;
|
||||||
|
|
||||||
_weekPageController = PageController(
|
_weekPageController = PageController(
|
||||||
initialPage: weekPageIndex,
|
initialPage: weekPageIndex,
|
||||||
@ -130,7 +131,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
|
|
||||||
_monthRangeList = List.generate(
|
_monthRangeList = List.generate(
|
||||||
widget.preloadMonthViewAmount,
|
widget.preloadMonthViewAmount,
|
||||||
(index) => ViewRange.generateDates(
|
(int index) => ViewRange.generateDates(
|
||||||
_todayDate!,
|
_todayDate!,
|
||||||
_todayDate!.month + (index - _monthPageController!.initialPage),
|
_todayDate!.month + (index - _monthPageController!.initialPage),
|
||||||
widget.weeksInMonthViewAmount,
|
widget.weeksInMonthViewAmount,
|
||||||
@ -150,19 +151,19 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
_weekPageController!.jumpToPage(widget.preloadWeekViewAmount ~/ 2);
|
_weekPageController!.jumpToPage(widget.preloadWeekViewAmount ~/ 2);
|
||||||
});
|
});
|
||||||
if (widget.startWeekDay != null && widget.startWeekDay! < 7) {
|
if (widget.startWeekDay != null && widget.startWeekDay! < 7) {
|
||||||
final time = _controller.value.subtract(
|
final DateTime time = _controller.value.subtract(
|
||||||
Duration(days: _controller.value.weekday - widget.startWeekDay!),
|
Duration(days: _controller.value.weekday - widget.startWeekDay!),
|
||||||
);
|
);
|
||||||
final list = List<DateTime>.generate(
|
final List<DateTime> list = List<DateTime>.generate(
|
||||||
8,
|
8,
|
||||||
(index) => time.add(Duration(days: index * 1)),
|
(int index) => time.add(Duration(days: index * 1)),
|
||||||
).toList();
|
).toList();
|
||||||
// _weekNames = List<String>.generate(7, (index) {
|
// _weekNames = List<String>.generate(7, (index) {
|
||||||
// return DateFormat("EEEE").format(list[index]).split('').first;
|
// return DateFormat("EEEE").format(list[index]).split('').first;
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
//by DaisyWu 修改源文件为中文环境下 周一到周日
|
//by DaisyWu 修改源文件为中文环境下 周一到周日
|
||||||
_weekNames = List<String>.generate(7, (index) {
|
_weekNames = List<String>.generate(7, (int index) {
|
||||||
String fullWeekName =
|
String fullWeekName =
|
||||||
DateFormat.E('zh_CN').format(list[index]); // 获取星期的完整形式
|
DateFormat.E('zh_CN').format(list[index]); // 获取星期的完整形式
|
||||||
return fullWeekName
|
return fullWeekName
|
||||||
@ -173,23 +174,23 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final ThemeData theme = Theme.of(context);
|
||||||
return Material(
|
return Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: DefaultTextStyle.merge(
|
child: DefaultTextStyle.merge(
|
||||||
style: theme.textTheme.bodyMedium,
|
style: theme.textTheme.bodyMedium,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onVerticalDragStart: (details) {
|
onVerticalDragStart: (DragStartDetails details) {
|
||||||
_captureOffset = details.globalPosition;
|
_captureOffset = details.globalPosition;
|
||||||
},
|
},
|
||||||
onVerticalDragUpdate: (details) {
|
onVerticalDragUpdate: (DragUpdateDetails details) {
|
||||||
final moveOffset = details.globalPosition;
|
final Offset moveOffset = details.globalPosition;
|
||||||
final diffY = moveOffset.dy - _captureOffset!.dy;
|
final double diffY = moveOffset.dy - _captureOffset!.dy;
|
||||||
|
|
||||||
_animationController.value =
|
_animationController.value =
|
||||||
_animationValue + diffY / (widget.weekLineHeight * 5);
|
_animationValue + diffY / (widget.weekLineHeight * 5);
|
||||||
},
|
},
|
||||||
onVerticalDragEnd: (details) => _handleFinishDrag(),
|
onVerticalDragEnd: (DragEndDetails details) => _handleFinishDrag(),
|
||||||
onVerticalDragCancel: _handleFinishDrag,
|
onVerticalDragCancel: _handleFinishDrag,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
@ -197,10 +198,10 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
ValueListenableBuilder<int>(
|
ValueListenableBuilder<int>(
|
||||||
valueListenable: _monthViewCurrentPage,
|
valueListenable: _monthViewCurrentPage,
|
||||||
builder: (_, value, __) {
|
builder: (_, int value, __) {
|
||||||
return Header(
|
return Header(
|
||||||
monthDate:
|
monthDate:
|
||||||
_monthRangeList[_monthViewCurrentPage.value].firstDay,
|
_monthRangeList[_monthViewCurrentPage.value].firstDay,
|
||||||
@ -217,12 +218,12 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
keepLineSize: widget.keepLineSize,
|
keepLineSize: widget.keepLineSize,
|
||||||
weekNames: _weekNames != null
|
weekNames: _weekNames != null
|
||||||
? _weekNames!
|
? _weekNames!
|
||||||
: const <String>['日', '一', '二', '三', '四', '五', '六'],
|
: <String>['简写周日'.tr, '简写周一'.tr, '简写周二'.tr, '简写周三'.tr, '简写周四'.tr, '简写周五'.tr, '简写周六'.tr],
|
||||||
),
|
),
|
||||||
AnimatedBuilder(
|
AnimatedBuilder(
|
||||||
animation: _animationController,
|
animation: _animationController,
|
||||||
builder: (_, __) {
|
builder: (_, __) {
|
||||||
final height = Tween<double>(
|
final double height = Tween<double>(
|
||||||
begin: widget.weekLineHeight,
|
begin: widget.weekLineHeight,
|
||||||
end:
|
end:
|
||||||
widget.weekLineHeight * widget.weeksInMonthViewAmount,
|
widget.weekLineHeight * widget.weeksInMonthViewAmount,
|
||||||
@ -231,12 +232,12 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
height: height,
|
height: height,
|
||||||
child: ValueListenableBuilder<DateTime>(
|
child: ValueListenableBuilder<DateTime>(
|
||||||
valueListenable: _controller,
|
valueListenable: _controller,
|
||||||
builder: (_, selectedDate, __) {
|
builder: (_, DateTime selectedDate, __) {
|
||||||
AppLog.log('****selectedDate: $selectedDate');
|
AppLog.log('****selectedDate: $selectedDate');
|
||||||
eventBus.fire(DoorLockLogListRefreshUI(selectedDate));
|
eventBus.fire(DoorLockLogListRefreshUI(selectedDate));
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
IgnorePointer(
|
IgnorePointer(
|
||||||
ignoring: _animationController.value == 0.0,
|
ignoring: _animationController.value == 0.0,
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
@ -245,7 +246,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
end: 1.0,
|
end: 1.0,
|
||||||
).evaluate(_animationController),
|
).evaluate(_animationController),
|
||||||
child: PageView.builder(
|
child: PageView.builder(
|
||||||
onPageChanged: (pageIndex) {
|
onPageChanged: (int pageIndex) {
|
||||||
if (widget.onHorizontalDrag != null) {
|
if (widget.onHorizontalDrag != null) {
|
||||||
widget.onHorizontalDrag!(
|
widget.onHorizontalDrag!(
|
||||||
_monthRangeList[pageIndex].firstDay,
|
_monthRangeList[pageIndex].firstDay,
|
||||||
@ -258,7 +259,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
? const AlwaysScrollableScrollPhysics()
|
? const AlwaysScrollableScrollPhysics()
|
||||||
: const NeverScrollableScrollPhysics(),
|
: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: _monthRangeList.length,
|
itemCount: _monthRangeList.length,
|
||||||
itemBuilder: (_, pageIndex) {
|
itemBuilder: (_, int pageIndex) {
|
||||||
return MonthView(
|
return MonthView(
|
||||||
innerDot: widget.innerDot,
|
innerDot: widget.innerDot,
|
||||||
monthView: _monthRangeList[pageIndex],
|
monthView: _monthRangeList[pageIndex],
|
||||||
@ -278,12 +279,12 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
),
|
),
|
||||||
ValueListenableBuilder<int>(
|
ValueListenableBuilder<int>(
|
||||||
valueListenable: _monthViewCurrentPage,
|
valueListenable: _monthViewCurrentPage,
|
||||||
builder: (_, pageIndex, __) {
|
builder: (_, int pageIndex, __) {
|
||||||
final index = selectedDate.findWeekIndex(
|
final int index = selectedDate.findWeekIndex(
|
||||||
_monthRangeList[_monthViewCurrentPage.value]
|
_monthRangeList[_monthViewCurrentPage.value]
|
||||||
.dates,
|
.dates,
|
||||||
);
|
);
|
||||||
final offset = index /
|
final double offset = index /
|
||||||
(widget.weeksInMonthViewAmount - 1) *
|
(widget.weeksInMonthViewAmount - 1) *
|
||||||
2 -
|
2 -
|
||||||
1.0;
|
1.0;
|
||||||
@ -300,10 +301,10 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: widget.weekLineHeight,
|
height: widget.weekLineHeight,
|
||||||
child: PageView.builder(
|
child: PageView.builder(
|
||||||
onPageChanged: (indexPage) {
|
onPageChanged: (int indexPage) {
|
||||||
final pageIndex =
|
final int pageIndex =
|
||||||
_monthRangeList.indexWhere(
|
_monthRangeList.indexWhere(
|
||||||
(index) =>
|
(ViewRange index) =>
|
||||||
index.firstDay.month ==
|
index.firstDay.month ==
|
||||||
_weekRangeList[indexPage]
|
_weekRangeList[indexPage]
|
||||||
.first
|
.first
|
||||||
@ -323,7 +324,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
controller: _weekPageController,
|
controller: _weekPageController,
|
||||||
itemCount: _weekRangeList.length,
|
itemCount: _weekRangeList.length,
|
||||||
physics: _closeMonthScroll(),
|
physics: _closeMonthScroll(),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return WeekView(
|
return WeekView(
|
||||||
innerDot: widget.innerDot,
|
innerDot: widget.innerDot,
|
||||||
dates: _weekRangeList[index],
|
dates: _weekRangeList[index],
|
||||||
@ -384,7 +385,7 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
_handleDateChanged(date);
|
_handleDateChanged(date);
|
||||||
|
|
||||||
_monthViewCurrentPage.value = _monthRangeList
|
_monthViewCurrentPage.value = _monthRangeList
|
||||||
.lastIndexWhere((monthRange) => monthRange.dates.contains(date));
|
.lastIndexWhere((ViewRange monthRange) => monthRange.dates.contains(date));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleDateChanged(DateTime date) {
|
void _handleDateChanged(DateTime date) {
|
||||||
@ -411,10 +412,10 @@ class _AdvancedCalendarState extends State<AdvancedCalendar>
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScrollPhysics _closeMonthScroll() {
|
ScrollPhysics _closeMonthScroll() {
|
||||||
if ((_monthViewCurrentPage.value ==
|
if (_monthViewCurrentPage.value ==
|
||||||
(widget.preloadMonthViewAmount ~/ 2) + 3 ||
|
(widget.preloadMonthViewAmount ~/ 2) + 3 ||
|
||||||
_monthViewCurrentPage.value ==
|
_monthViewCurrentPage.value ==
|
||||||
(widget.preloadMonthViewAmount ~/ 2) - 3)) {
|
(widget.preloadMonthViewAmount ~/ 2) - 3) {
|
||||||
return const NeverScrollableScrollPhysics();
|
return const NeverScrollableScrollPhysics();
|
||||||
} else {
|
} else {
|
||||||
return const AlwaysScrollableScrollPhysics();
|
return const AlwaysScrollableScrollPhysics();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
|||||||
@ -4,6 +4,18 @@
|
|||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
|
||||||
class DateItemModel {
|
class DateItemModel {
|
||||||
|
|
||||||
|
DateItemModel(
|
||||||
|
this.year, this.month, this.day, this.hour, this.minute, this.second);
|
||||||
|
|
||||||
|
DateItemModel.parse(DateMode dateMode) {
|
||||||
|
year = DateModeMap[dateMode]!.contains('年');
|
||||||
|
month = DateModeMap[dateMode]!.contains('月');
|
||||||
|
day = DateModeMap[dateMode]!.contains('日');
|
||||||
|
hour = DateModeMap[dateMode]!.contains('时');
|
||||||
|
minute = DateModeMap[dateMode]!.contains('分');
|
||||||
|
second = DateModeMap[dateMode]!.contains('秒');
|
||||||
|
}
|
||||||
late bool year;
|
late bool year;
|
||||||
late bool month;
|
late bool month;
|
||||||
late bool day;
|
late bool day;
|
||||||
@ -11,34 +23,34 @@ class DateItemModel {
|
|||||||
late bool minute;
|
late bool minute;
|
||||||
late bool second;
|
late bool second;
|
||||||
|
|
||||||
DateItemModel(
|
|
||||||
this.year, this.month, this.day, this.hour, this.minute, this.second);
|
|
||||||
|
|
||||||
DateItemModel.parse(DateMode dateMode) {
|
|
||||||
this.year = DateModeMap[dateMode]!.contains('年');
|
|
||||||
this.month = DateModeMap[dateMode]!.contains('月');
|
|
||||||
this.day = DateModeMap[dateMode]!.contains('日');
|
|
||||||
this.hour = DateModeMap[dateMode]!.contains('时');
|
|
||||||
this.minute = DateModeMap[dateMode]!.contains('分');
|
|
||||||
this.second = DateModeMap[dateMode]!.contains('秒');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回需要显示多少个picker
|
// 返回需要显示多少个picker
|
||||||
int get length {
|
int get length {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (this.year) ++i;
|
if (year) {
|
||||||
if (this.month) ++i;
|
++i;
|
||||||
if (this.day) ++i;
|
}
|
||||||
if (this.hour) ++i;
|
if (month) {
|
||||||
if (this.minute) ++i;
|
++i;
|
||||||
if (this.second) ++i;
|
}
|
||||||
|
if (day) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
if (hour) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
if (minute) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
if (second) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DateModeMap = {
|
const DateModeMap = {
|
||||||
DateMode.YMDHMS: "年月日时分秒",
|
DateMode.YMDHMS: '年月日时分秒',
|
||||||
DateMode.YMDHM: '年月日时分',
|
DateMode.YMDHM: '年月日时分',
|
||||||
DateMode.YMDH: '年月日时',
|
DateMode.YMDH: '年月日时',
|
||||||
DateMode.YMD: '年月日',
|
DateMode.YMD: '年月日',
|
||||||
|
|||||||
@ -4,12 +4,12 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_type.dart';
|
|||||||
|
|
||||||
/// 时间选择器 item 生成的对应数据
|
/// 时间选择器 item 生成的对应数据
|
||||||
class DateTimeData {
|
class DateTimeData {
|
||||||
List _year = [];
|
final List _year = [];
|
||||||
List _month = [];
|
final List _month = [];
|
||||||
List _day = [];
|
final List _day = [];
|
||||||
List _hour = [];
|
final List _hour = [];
|
||||||
List _minute = [];
|
final List _minute = [];
|
||||||
List _second = [];
|
final List _second = [];
|
||||||
|
|
||||||
List getListByName(DateType type) {
|
List getListByName(DateType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@ -18,14 +18,43 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_type.dart';
|
|||||||
/// {year: 2020, month: 3, day: 4, hour: 0, minute: 0, second: 0}
|
/// {year: 2020, month: 3, day: 4, hour: 0, minute: 0, second: 0}
|
||||||
|
|
||||||
bool intEmpty(int? value) {
|
bool intEmpty(int? value) {
|
||||||
return (value == null || value == 0);
|
return value == null || value == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intNotEmpty(int? value) {
|
bool intNotEmpty(int? value) {
|
||||||
return (value != null && value != 0);
|
return value != null && value != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PDuration {
|
class PDuration {
|
||||||
|
|
||||||
|
PDuration(
|
||||||
|
{this.year = 0,
|
||||||
|
this.month = 0,
|
||||||
|
this.day = 0,
|
||||||
|
this.hour = 0,
|
||||||
|
this.minute = 0,
|
||||||
|
this.second = 0});
|
||||||
|
|
||||||
|
// 注意默认会设为0 不是null
|
||||||
|
PDuration.parse(DateTime? dateTime) {
|
||||||
|
dateTime ??= DateTime.now();
|
||||||
|
year = dateTime.year;
|
||||||
|
month = dateTime.month;
|
||||||
|
day = dateTime.day;
|
||||||
|
hour = dateTime.hour;
|
||||||
|
minute = dateTime.minute;
|
||||||
|
second = dateTime.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
PDuration.now() {
|
||||||
|
var thisInstant = new DateTime.now();
|
||||||
|
year = thisInstant.year;
|
||||||
|
month = thisInstant.month;
|
||||||
|
day = thisInstant.day;
|
||||||
|
hour = thisInstant.hour;
|
||||||
|
minute = thisInstant.minute;
|
||||||
|
second = thisInstant.second;
|
||||||
|
}
|
||||||
int? year;
|
int? year;
|
||||||
int? month;
|
int? month;
|
||||||
int? day;
|
int? day;
|
||||||
@ -33,54 +62,25 @@ class PDuration {
|
|||||||
int? minute;
|
int? minute;
|
||||||
int? second;
|
int? second;
|
||||||
|
|
||||||
PDuration(
|
|
||||||
{this.year: 0,
|
|
||||||
this.month: 0,
|
|
||||||
this.day: 0,
|
|
||||||
this.hour: 0,
|
|
||||||
this.minute: 0,
|
|
||||||
this.second: 0});
|
|
||||||
|
|
||||||
// 注意默认会设为0 不是null
|
|
||||||
PDuration.parse(DateTime? dateTime) {
|
|
||||||
dateTime ??= DateTime.now();
|
|
||||||
this.year = dateTime.year;
|
|
||||||
this.month = dateTime.month;
|
|
||||||
this.day = dateTime.day;
|
|
||||||
this.hour = dateTime.hour;
|
|
||||||
this.minute = dateTime.minute;
|
|
||||||
this.second = dateTime.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
PDuration.now() {
|
|
||||||
var thisInstant = new DateTime.now();
|
|
||||||
this.year = thisInstant.year;
|
|
||||||
this.month = thisInstant.month;
|
|
||||||
this.day = thisInstant.day;
|
|
||||||
this.hour = thisInstant.hour;
|
|
||||||
this.minute = thisInstant.minute;
|
|
||||||
this.second = thisInstant.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSingle(DateType dateType, var value) {
|
void setSingle(DateType dateType, var value) {
|
||||||
switch (dateType) {
|
switch (dateType) {
|
||||||
case DateType.Year:
|
case DateType.Year:
|
||||||
this.year = value;
|
year = value;
|
||||||
break;
|
break;
|
||||||
case DateType.Month:
|
case DateType.Month:
|
||||||
this.month = value;
|
month = value;
|
||||||
break;
|
break;
|
||||||
case DateType.Day:
|
case DateType.Day:
|
||||||
this.day = value;
|
day = value;
|
||||||
break;
|
break;
|
||||||
case DateType.Hour:
|
case DateType.Hour:
|
||||||
this.hour = value;
|
hour = value;
|
||||||
break;
|
break;
|
||||||
case DateType.Minute:
|
case DateType.Minute:
|
||||||
this.minute = value;
|
minute = value;
|
||||||
break;
|
break;
|
||||||
case DateType.Second:
|
case DateType.Second:
|
||||||
this.second = value;
|
second = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,17 +89,17 @@ class PDuration {
|
|||||||
int getSingle(DateType dateType) {
|
int getSingle(DateType dateType) {
|
||||||
switch (dateType) {
|
switch (dateType) {
|
||||||
case DateType.Year:
|
case DateType.Year:
|
||||||
return this.year ?? 0;
|
return year ?? 0;
|
||||||
case DateType.Month:
|
case DateType.Month:
|
||||||
return this.month ?? 0;
|
return month ?? 0;
|
||||||
case DateType.Day:
|
case DateType.Day:
|
||||||
return this.day ?? 0;
|
return day ?? 0;
|
||||||
case DateType.Hour:
|
case DateType.Hour:
|
||||||
return this.hour ?? 0;
|
return hour ?? 0;
|
||||||
case DateType.Minute:
|
case DateType.Minute:
|
||||||
return this.minute ?? 0;
|
return minute ?? 0;
|
||||||
case DateType.Second:
|
case DateType.Second:
|
||||||
return this.second ?? 0;
|
return second ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,23 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_type.dart';
|
|||||||
|
|
||||||
/// 后缀标签
|
/// 后缀标签
|
||||||
class Suffix {
|
class Suffix {
|
||||||
|
|
||||||
|
Suffix(
|
||||||
|
{this.years = '',
|
||||||
|
this.month = '',
|
||||||
|
this.days = '',
|
||||||
|
this.hours = '',
|
||||||
|
this.minutes = '',
|
||||||
|
this.seconds = ''});
|
||||||
|
|
||||||
|
Suffix.normal() {
|
||||||
|
years = '年';
|
||||||
|
month = '月';
|
||||||
|
days = '日';
|
||||||
|
hours = '时';
|
||||||
|
minutes = '分';
|
||||||
|
seconds = '秒';
|
||||||
|
}
|
||||||
late String years;
|
late String years;
|
||||||
late String month;
|
late String month;
|
||||||
late String days;
|
late String days;
|
||||||
@ -11,37 +28,20 @@ class Suffix {
|
|||||||
late String minutes;
|
late String minutes;
|
||||||
late String seconds;
|
late String seconds;
|
||||||
|
|
||||||
Suffix.normal() {
|
|
||||||
this.years = '年';
|
|
||||||
this.month = '月';
|
|
||||||
this.days = '日';
|
|
||||||
this.hours = '时';
|
|
||||||
this.minutes = '分';
|
|
||||||
this.seconds = '秒';
|
|
||||||
}
|
|
||||||
|
|
||||||
Suffix(
|
|
||||||
{this.years: '',
|
|
||||||
this.month: '',
|
|
||||||
this.days: '',
|
|
||||||
this.hours: '',
|
|
||||||
this.minutes: '',
|
|
||||||
this.seconds: ''});
|
|
||||||
|
|
||||||
String getSingle(DateType dateType) {
|
String getSingle(DateType dateType) {
|
||||||
switch (dateType) {
|
switch (dateType) {
|
||||||
case DateType.Year:
|
case DateType.Year:
|
||||||
return this.years;
|
return years;
|
||||||
case DateType.Month:
|
case DateType.Month:
|
||||||
return this.month;
|
return month;
|
||||||
case DateType.Day:
|
case DateType.Day:
|
||||||
return this.days;
|
return days;
|
||||||
case DateType.Hour:
|
case DateType.Hour:
|
||||||
return this.hours;
|
return hours;
|
||||||
case DateType.Minute:
|
case DateType.Minute:
|
||||||
return this.minutes;
|
return minutes;
|
||||||
case DateType.Second:
|
case DateType.Second:
|
||||||
return this.seconds;
|
return seconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class TimeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String intToStr(int v) {
|
String intToStr(int v) {
|
||||||
return (v < 10) ? "0$v" : "$v";
|
return (v < 10) ? '0$v' : '$v';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -282,7 +282,7 @@ class PermissionDialog {
|
|||||||
|
|
||||||
//显示权限判断申请框
|
//显示权限判断申请框
|
||||||
static Future<bool> request(Permission permission, [String? content]) async {
|
static Future<bool> request(Permission permission, [String? content]) async {
|
||||||
AppLog.log('context:${content}');
|
AppLog.log('context:$content');
|
||||||
if (Get.context == null) {
|
if (Get.context == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user