Merge branch 'master_hyx'
This commit is contained in:
commit
00f1528854
BIN
star_lock/images/icon_circle_dotted.png
Normal file
BIN
star_lock/images/icon_circle_dotted.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
BIN
star_lock/images/icon_lock_err.png
Normal file
BIN
star_lock/images/icon_lock_err.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
BIN
star_lock/images/icon_lock_fill.png
Normal file
BIN
star_lock/images/icon_lock_fill.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@ -127,7 +127,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||||
|
|
||||||
bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
|
||||||
if(!ifHaveKey){
|
if (!ifHaveKey) {
|
||||||
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
||||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||||
}
|
}
|
||||||
@ -232,79 +232,78 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Obx(() {
|
GestureDetector(
|
||||||
return GestureDetector(
|
onTap: state.openDoorBtnisUneable.value == true
|
||||||
onTap: state.openDoorBtnisUneable.value == true
|
? () {
|
||||||
? () {
|
setState(() {
|
||||||
setState(() {
|
startOpenLock();
|
||||||
startOpenLock();
|
});
|
||||||
});
|
}
|
||||||
}
|
: null,
|
||||||
: null,
|
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||||
onLongPressStart: state.openDoorBtnisUneable.value == true
|
? (details) {
|
||||||
? (details) {
|
setState(() {
|
||||||
setState(() {
|
startUnLock();
|
||||||
startUnLock();
|
});
|
||||||
});
|
}
|
||||||
}
|
: null,
|
||||||
: null,
|
child: Container(
|
||||||
child: Container(
|
width: 100.r,
|
||||||
decoration: BoxDecoration(
|
height: 100.r,
|
||||||
color: Colors.white.withOpacity(0.9),
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(100.w),
|
color: Colors.white.withOpacity(0.9),
|
||||||
boxShadow: [
|
borderRadius: BorderRadius.circular(100.w),
|
||||||
BoxShadow(
|
boxShadow: [
|
||||||
color: Colors.black.withOpacity(0.3),
|
BoxShadow(
|
||||||
offset: Offset(0, 0),
|
color: Colors.black.withOpacity(0.3),
|
||||||
blurRadius: 10.r,
|
offset: Offset(0, 0),
|
||||||
spreadRadius: 0,
|
blurRadius: 10.r,
|
||||||
),
|
spreadRadius: 0,
|
||||||
]),
|
|
||||||
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
FlavorsImg(
|
|
||||||
child: Image.asset(
|
|
||||||
state.openDoorBtnisUneable.value == false
|
|
||||||
? 'images/main/icon_main_openLockBtn_grey.png'
|
|
||||||
: (state.isOpenPassageMode.value == 1
|
|
||||||
? 'images/main/icon_main_normallyOpenMode_center.png'
|
|
||||||
: 'images/main/icon_main_openLockBtn_center.png'),
|
|
||||||
width: 96.r,
|
|
||||||
height: 96.r,
|
|
||||||
// color: AppColors.primaryTopColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
state.openDoorBtnisUneable.value == false
|
]),
|
||||||
? Positioned(
|
margin: EdgeInsets.only(left: 35.w, bottom: 15.h),
|
||||||
child: FlavorsImg(
|
child: Stack(
|
||||||
|
alignment: AlignmentDirectional.center,
|
||||||
|
children: [
|
||||||
|
state.openDoorBtnisUneable.value == false
|
||||||
|
? Icon(
|
||||||
|
Icons.bluetooth_searching,
|
||||||
|
size: 48.r,
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
)
|
||||||
|
: Image.asset(
|
||||||
|
state.isOpenPassageMode.value == 1
|
||||||
|
? 'images/icon_lock_err.png'
|
||||||
|
: 'images/icon_lock_fill.png',
|
||||||
|
width: 38.r,
|
||||||
|
height: 38.r,
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
state.openDoorBtnisUneable.value == false
|
||||||
|
? Positioned(
|
||||||
|
child: Icon(
|
||||||
|
Icons.bluetooth_searching,
|
||||||
|
size: 96.r,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: state.openLockBtnState.value == 1
|
||||||
|
? xhjBuildRotationTransition(
|
||||||
|
width: 88.r,
|
||||||
|
height: 88.r,
|
||||||
|
)
|
||||||
|
: Positioned(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'images/main/icon_main_openLockBtn_grey.png',
|
'images/icon_circle_dotted.png',
|
||||||
width: 96.r,
|
width: 88.r,
|
||||||
height: 96.r,
|
height: 88.r,
|
||||||
),
|
color: state.isOpenPassageMode.value == 1
|
||||||
),
|
? Colors.red
|
||||||
)
|
: AppColors.mainColor,
|
||||||
: state.openLockBtnState.value == 1
|
)),
|
||||||
? buildRotationTransition(
|
],
|
||||||
width: 96.r,
|
|
||||||
height: 96.r,
|
|
||||||
)
|
|
||||||
: Positioned(
|
|
||||||
child: FlavorsImg(
|
|
||||||
child: Image.asset(
|
|
||||||
state.isOpenPassageMode.value == 1
|
|
||||||
? 'images/main/icon_main_normallyOpenMode_circle.png'
|
|
||||||
: 'images/main/icon_main_openLockBtn_circle.png',
|
|
||||||
width: 96.r,
|
|
||||||
height: 96.r,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -735,6 +734,28 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//旋转动画
|
||||||
|
Widget xhjBuildRotationTransition(
|
||||||
|
{required double width, required double height}) {
|
||||||
|
return Positioned(
|
||||||
|
child: RotationTransition(
|
||||||
|
//设置动画的旋转中心
|
||||||
|
alignment: Alignment.center,
|
||||||
|
//动画控制器
|
||||||
|
turns: state.animationController!,
|
||||||
|
//将要执行动画的子view
|
||||||
|
child: Image.asset(
|
||||||
|
'images/icon_circle_dotted.png',
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
color: state.isOpenPassageMode.value == 1
|
||||||
|
? Colors.red
|
||||||
|
: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//旋转动画
|
//旋转动画
|
||||||
Widget buildRotationTransition(
|
Widget buildRotationTransition(
|
||||||
{required double width, required double height}) {
|
{required double width, required double height}) {
|
||||||
|
|||||||
@ -161,24 +161,52 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 检查文件头
|
// 检查文件头
|
||||||
Future<Map?> getHeadFile(Uint8List data) async {
|
Future<Map?> getHeadFile(Uint8List data) async {
|
||||||
|
if (data.length <= 16) {
|
||||||
|
showToast('错误D固件,请选择正确的文件');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// 检查文件头
|
// 检查文件头
|
||||||
String header = utf8.decode(data.sublist(0, 12));
|
String header;
|
||||||
|
try {
|
||||||
|
header = utf8.decode(data.sublist(0, 12));
|
||||||
|
} catch (e) {
|
||||||
|
showToast('非SYD固件,请选择正确的文件');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (header != 'SYD-BIN-DATA') {
|
if (header != 'SYD-BIN-DATA') {
|
||||||
showToast('非SYD固件,请选择正确的文件');
|
showToast('非SYD固件,请选择正确的文件');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 解析元数据长度
|
// 解析元数据长度
|
||||||
Uint8List metaLenList = data.sublist(12, 16);
|
Uint8List metaLenList;
|
||||||
int metaLen = ByteData.sublistView(metaLenList).getUint32(0);
|
int metaLen;
|
||||||
|
try {
|
||||||
|
metaLenList = data.sublist(12, 16);
|
||||||
|
metaLen = ByteData.sublistView(metaLenList).getUint32(0);
|
||||||
|
} catch (e) {
|
||||||
|
showToast('文件校验失败 0x01');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (metaLen < 2 || metaLen > 10240) {
|
if (metaLen < 2 || metaLen > 10240) {
|
||||||
showToast('文件校验失败 0x01');
|
showToast('文件校验失败 0x01');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 读取和解析元数据
|
// 读取和解析元数据
|
||||||
Uint8List metaStrList = data.sublist(16, 16 + metaLen);
|
Uint8List metaStrList;
|
||||||
String metaStr = utf8.decode(metaStrList);
|
String metaStr;
|
||||||
|
try {
|
||||||
|
metaStrList = data.sublist(16, 16 + metaLen);
|
||||||
|
metaStr = utf8.decode(metaStrList);
|
||||||
|
} catch (e) {
|
||||||
|
showToast('解析元数据失败,请选择正确的文件');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
AppLog.log(metaStr);
|
AppLog.log(metaStr);
|
||||||
var meta = jsonDecode(metaStr);
|
var meta = jsonDecode(metaStr);
|
||||||
|
if (meta is! Map) {
|
||||||
|
showToast('解析元数据失败,请选择正确的文件');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return meta..['metaLen'] = metaLen;
|
return meta..['metaLen'] = metaLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user