Merge branch 'master' of gitee.com:starlock-cn/app-starlock

This commit is contained in:
Daisy 2024-03-19 18:26:24 +08:00
commit e5af81daa0
35 changed files with 433 additions and 338 deletions

View File

@ -88,7 +88,7 @@ class _StarLockForgetPasswordPageState
height: 0.5.h,
color: Colors.grey,
),
LoginInput(
LoginInput().tfInput(
controller: state.phoneController,
onchangeAction: (v) {
logic.checkNext(state.phoneController);
@ -107,7 +107,7 @@ class _StarLockForgetPasswordPageState
LengthLimitingTextInputFormatter(30),
]),
SizedBox(height: 10.h),
LoginInput(
LoginInput().tfInput(
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
@ -134,7 +134,7 @@ class _StarLockForgetPasswordPageState
color: AppColors.placeholderTextColor, fontSize: 20.sp),
),
SizedBox(height: 10.w),
LoginInput(
LoginInput().tfInput(
controller: state.sureController,
onchangeAction: (v) {
logic.checkNext(state.sureController);
@ -158,7 +158,7 @@ class _StarLockForgetPasswordPageState
Row(
children: [
Expanded(
child: LoginInput(
child: LoginInput().tfInput(
controller: state.codeController,
onchangeAction: (v) {
logic.checkNext(state.codeController);

View File

@ -1,11 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/tools/storage.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -57,42 +54,34 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
child: Image.asset('images/icon_main_1024.png',
width: 110.w, height: 110.w))),
SizedBox(height: 50.w),
LoginInput(
LoginInput().tfInput(
controller: state.emailOrPhoneController,
onchangeAction: (v) {
logic.checkNext(state.emailOrPhoneController);
},
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
child: Image.asset(
'images/icon_login_account.png',
width: 36.w,
height: 36.w,
),
leftWidget: Image.asset(
'images/icon_login_account.png',
width: 36.w,
height: 36.w,
),
hintText:
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
keyboardType: TextInputType.number,
// keyboardType: TextInputType.number,
inputFormatters: [
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(30),
]),
SizedBox(height: 10.h),
LoginInput(
LoginInput().tfInput(
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
child: Image.asset(
'images/icon_login_password.png',
width: 36.w,
height: 36.w,
),
leftWidget: Image.asset(
'images/icon_login_password.png',
width: 36.w,
height: 36.w,
),
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",

View File

@ -13,6 +13,9 @@ class StarLockLoginState {
TextEditingController emailOrPhoneController = TextEditingController();
TextEditingController pwdController = TextEditingController();
late FocusNode myFocusNode1;
late FocusNode myFocusNode2;
StarLockLoginState() {
// emailOrPhone.value = StoreService.to.getLastUserAccount() as String;
emailOrPhoneController.text = emailOrPhone.value;

View File

@ -196,7 +196,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Widget middleTFWidget() {
return Column(
children: [
LoginInput(
LoginInput().tfInput(
controller: state.phoneOrEmailController,
onchangeAction: (v) {
logic.checkNext(state.phoneOrEmailController);
@ -218,7 +218,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
LengthLimitingTextInputFormatter(30),
]),
SizedBox(height: 10.w),
LoginInput(
LoginInput().tfInput(
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
@ -244,7 +244,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
),
SizedBox(height: 10.w),
LoginInput(
LoginInput().tfInput(
controller: state.sureController,
onchangeAction: (v) {
logic.checkNext(state.sureController);
@ -267,7 +267,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Row(
children: [
Expanded(
child: LoginInput(
child: LoginInput().tfInput(
controller: state.codeController,
onchangeAction: (v) {
logic.checkNext(state.codeController);

View File

@ -78,8 +78,8 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
"keyInfo": state.keyInfo.value
}).then((val) {
if (val != null) {
logic.mockNetworkDataRequest();
setState(() {});
logic.pageNo = 1;
mockRequest();
}
});
},
@ -130,6 +130,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),

View File

@ -40,7 +40,9 @@ class _AddCardPageState extends State<AddCardPage> {
Widget build(BuildContext context) {
state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId;
state.nameController.text = widget.fromTypeTwoStaffName;
if(widget.fromTypeTwoStaffName.isNotEmpty){
state.nameController.text = widget.fromTypeTwoStaffName;
}
state.fromType.value = widget.fromType;
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -75,7 +77,7 @@ class _AddCardPageState extends State<AddCardPage> {
TranslationLoader.lanKeys!.pleaseEnter!.tr,
state.nameController),
keyTimeLimitWidget(),
SizedBox(height: 10.h),
// SizedBox(height: 10.h),
keyBottomWidget()
],
);

View File

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

View File

@ -340,13 +340,18 @@ class CardListLogic extends BaseGetXController {
);
if(entity.errorCode!.codeIsSuccessful){
if(state.isDeletAll == false){
showToast("删除成功");
showToast("删除成功", something: (){
state.isDeletCardData = false;
pageNo = 1;
getICCardListData();
});
}else{
showToast("重置成功");
showToast("重置成功", something: (){
state.isDeletCardData = false;
pageNo = 1;
getICCardListData();
});
}
state.isDeletCardData = false;
getICCardListData();
}
}

View File

@ -88,7 +88,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.getICCardListData();
logic.pageNo = 1;
getHttpData();
},
),
SizedBox(height: 20.h),
@ -103,7 +104,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
"fromType": 1 // 1 2
});
if (data != null) {
logic.getICCardListData();
logic.pageNo = 1;
getHttpData();
}
},
),
@ -136,6 +138,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),

View File

@ -76,6 +76,7 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),

View File

@ -86,7 +86,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.mockNetworkDataRequest();
logic.pageNo = 1;
mockRequest();
},
),
SizedBox(
@ -106,8 +107,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
"keyInfo": state.keyInfo.value
}).then((val) {
if (val != null) {
logic.mockNetworkDataRequest();
setState(() {});
logic.pageNo = 1;
mockRequest();
}
});
},
@ -166,6 +167,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),

View File

@ -39,7 +39,9 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
Widget build(BuildContext context) {
state.seletType.value = widget.selectType;
state.lockId.value = widget.lockId;
state.nameController.text = widget.fromTypeTwoStaffName;
if(widget.fromTypeTwoStaffName.isNotEmpty){
state.nameController.text = widget.fromTypeTwoStaffName;
}
state.fromType.value = widget.fromType;
return indexChangeWidget();

View File

@ -40,7 +40,9 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
Widget build(BuildContext context) {
state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId;
state.nameController.text = widget.fromTypeTwoStaffName;
if(widget.fromTypeTwoStaffName.isNotEmpty){
state.nameController.text = widget.fromTypeTwoStaffName;
}
state.fromType.value = widget.fromType;
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -143,10 +145,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
onConfirm: (p) {
state.beginTime.value =
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
state.beginTimeTimestamp.value =
DateTime.parse(state.beginTime.value)
.millisecondsSinceEpoch
.toString();
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch.toString();
});
})),
Obx(() => CommonItem(
@ -156,12 +155,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.endTime.value =
'${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
state.endTimeTimestamp.value =
DateTime.parse(state.endTime.value)
.millisecondsSinceEpoch
.toString();
state.endTime.value = '${p.year}-${p.month!.toString().padLeft(2, '0')}-${p.day!.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}';
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch.toString();
});
})),
Container(height: 10.h),
@ -299,7 +294,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: state.nameController,
autofocus: false,
// autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//

View File

@ -334,6 +334,7 @@ class FingerprintListLogic extends BaseGetXController{
//
Future<FingerprintListDataEntity> getFingerprintsListData() async{
// state.fingerprintItemListData.value.clear();
FingerprintListDataEntity entity = await ApiRepository.to.getFingerprintsListData(
lockId: state.lockId.value.toString(),
pageNo: pageNo.toString(),
@ -372,13 +373,18 @@ class FingerprintListLogic extends BaseGetXController{
);
if(entity.errorCode!.codeIsSuccessful){
if(state.isDeletAll == false){
showToast("删除成功");
showToast("删除成功", something:(){
state.isDeletFingerprintData = false;
pageNo = 1;
getFingerprintsListData();
});
}else{
showToast("重置成功");
showToast("重置成功", something:(){
state.isDeletFingerprintData = false;
pageNo = 1;
getFingerprintsListData();
});
}
state.isDeletFingerprintData = false;
getFingerprintsListData();
}
}

View File

@ -68,7 +68,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
showDeletAlertDialog(context);
showDeletAlertDialog();
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
@ -90,7 +90,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.getFingerprintsListData();
logic.pageNo = 1;
getHttpData();
},
),
SizedBox(
@ -106,7 +107,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
"fromType": 1 // 1 2
});
if (data != null) {
logic.getFingerprintsListData();
logic.pageNo = 1;
getHttpData();
}
},
),
@ -133,11 +135,12 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context);
showIosTipViewDialog(fingerprintItemData.fingerprintId);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
// foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),
@ -156,7 +159,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
"fingerprintItemData": fingerprintItemData,
});
if (data != null) {
logic.getFingerprintsListData();
logic.pageNo = 1;
getHttpData();
}
}),
);
@ -171,9 +175,9 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
}
void showIosTipViewDialog(BuildContext context) {
void showIosTipViewDialog(int? fingerprintId) {
showDialog(
context: context,
context: Get.context!,
builder: (BuildContext context) {
return ShowIosTipView(
title: "提示",
@ -182,6 +186,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
Get.back();
state.isDeletFingerprintData = true;
state.isDeletAll = false;
state.deletKeyID = fingerprintId.toString();
state.deletUserID = (await Storage.getUid())!;
logic.senderAddFingerprint();
},
@ -262,9 +267,9 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
);
}
void showDeletAlertDialog(BuildContext context) {
void showDeletAlertDialog() {
showCupertinoDialog(
context: context,
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: const Text("提示"),

View File

@ -6,6 +6,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
import '../../../blue/blue_manage.dart';
@ -20,6 +21,7 @@ import '../../../network/api_repository.dart';
import '../../../tools/baseGetXController.dart';
import '../../../tools/eventBusEventManage.dart';
import '../../../tools/storage.dart';
import '../../../translations/trans_lib.dart';
import '../lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import 'lockDetail_state.dart';
import 'lockNetToken_entity.dart';
@ -93,8 +95,6 @@ class LockDetailLogic extends BaseGetXController {
getLockRecordLastUploadDataTime();
state.openLockBtnState.value = 0;
eventBus.fire(RefreshLockDetailInfoDataEvent());
break;
case 0x06:
@ -651,7 +651,8 @@ class LockDetailLogic extends BaseGetXController {
lockUserNo: state.lockUserNo.toString());
if (entity.errorCode!.codeIsSuccessful) {
if (state.isOpenLockNeedOnline.value == 0) {
state.bottomBtnisUneable.value = false;
state.bottomBtnisEable.value = true;
eventBus.fire(RefreshLockDetailInfoDataEvent());
eventBus.fire(RefreshLockListInfoDataEvent());
openDoorAction(1);
} else {
@ -725,6 +726,23 @@ class LockDetailLogic extends BaseGetXController {
});
}
String getKeyStatusTextAndShow(){
String text = "";
if (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitIneffective ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
text = "你的钥匙${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
} else {
text = state.isOpenPassageMode.value == 1
? "常开模式启动!长按闭锁"
: TranslationLoader
.lanKeys!.clickUnlockAndHoldDownClose!.tr;
}
return text;
}
// late StreamSubscription<List<DiscoveredDevice>>
// _scanListDiscoveredDeviceSubscription;
// void _scanListDiscoveredDeviceSubscriptionAction() {

View File

@ -11,6 +11,7 @@ import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_tool.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/eventBusEventManage.dart';
@ -43,45 +44,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
void initState() {
// TODO: implement initState
super.initState();
// Get.log("LockDetailPage initState1111");
Get.log("LockDetailPage initState1111");
state.keyInfos.value = widget.lockListInfoItemEntity;
state.lockUserNo = state.keyInfos.value.lockUserNo!;
if (state.lockUserNo == 0) {
state.bottomBtnisUneable.value = true;
}
state.isOnlyOneData = widget.isOnlyOneData;
// print("state.lockUserNo==${state.lockUserNo}");
state.senderUserId = state.keyInfos.value.senderUserId!;
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
state.isOpenLockNeedOnline.value =
state.keyInfos.value.lockSetting!.appUnlockOnline!;
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
state.lockAlias.value = state.keyInfos.value.lockAlias!;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList);
//
List<int> privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey
List<int> signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
Storage.setStringList(saveBlueToken, saveTokenList);
// logic.startScanAction();
listeningAnimations();
@ -93,6 +57,14 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
_initRefreshLockDetailInfoDataEventAction();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
Get.log("LockDetailPage didChangeDependencies2222");
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
}
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
void _initRefreshLockDetailInfoDataEventAction() {
// eventBus
@ -101,12 +73,74 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
});
}
void loadData(){
// print("widget.lockListInfoItemEntity.lockUserNo:${widget.lockListInfoItemEntity.lockUserNo}");
// print("state.lockUserNo:${state.lockUserNo}");
state.keyInfos.value = widget.lockListInfoItemEntity;
state.lockUserNo = state.keyInfos.value.lockUserNo!;
if (state.lockUserNo == 0) {
state.bottomBtnisEable.value = false;
}else{
state.bottomBtnisEable.value = true;
}
// print("state.keyInfos.value.keyStatus:${state.keyInfos.value.keyStatus}");
if (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitIneffective ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
state.openDoorBtnisUneable.value = false;
}else{
state.openDoorBtnisUneable.value = true;
}
state.isOnlyOneData = widget.isOnlyOneData;
// print("state.lockUserNo==${state.lockUserNo}");
state.senderUserId = state.keyInfos.value.senderUserId!;
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
state.isOpenLockNeedOnline.value =
state.keyInfos.value.lockSetting!.appUnlockOnline!;
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
state.lockAlias.value = state.keyInfos.value.lockAlias!;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList);
//
List<int> privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey
List<int> signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
Storage.setStringList(saveBlueToken, saveTokenList);
}
@override
Widget build(BuildContext context) {
loadData();
return ListView(
children: [
Visibility(
visible: false,
visible: (
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) < 30 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) > 0) &&// 030
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive)// 使
) ? true : false,
child: Container(
// height: 30.h,
color: const Color(0xFFFBEFD4),
@ -114,7 +148,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("钥匙将在2天后失效",
Text("钥匙将在${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}天后失效",
style: TextStyle(
color: const Color(0xffCBA74B), fontSize: 24.sp))
],
@ -259,21 +293,39 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
children: [
Center(
child: GestureDetector(
onTap: state.openDoorBtnisUneable.value == true ? () {
// Get.log("点击开锁");
setState(() {
startOpenLock();
});
} : null,
onLongPressStart: state.openDoorBtnisUneable.value == true ? (details) {
Get.log("长按闭锁");
setState(() {
startUnLock();
});
// startUnLock();
}:null,
child: Stack(
children: [
Image.asset(
// state.connectState.value == 0 ? 'images/main/icon_main_openLockBtn_grey.png' : 'images/main/icon_main_openLockBtn_center.png',
state.isOpenPassageMode.value == 1
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',
: 'images/main/icon_main_openLockBtn_center.png'),
width: 330.w,
height: 330.w,
),
state.openDoorBtnisUneable.value == false ? Positioned(
child: Image.asset(
'images/main/icon_main_openLockBtn_grey.png',
width: 330.w,
height: 330.w,
),
) :
state.openLockBtnState.value == 1
? buildRotationTransition()
: Positioned(
child: Image.asset(
// 'images/main/icon_main_openLockBtn_circle.png',
state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_circle.png'
: 'images/main/icon_main_openLockBtn_circle.png',
@ -282,19 +334,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
)),
],
),
onTap: () {
// Get.log("点击开锁");
setState(() {
startOpenLock();
});
},
onLongPressStart: (details) {
Get.log("长按闭锁");
setState(() {
startUnLock();
});
// startUnLock();
},
)),
],
),
@ -321,10 +360,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
state.isOpenPassageMode.value == 1
? "常开模式启动!长按闭锁"
: TranslationLoader
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
logic.getKeyStatusTextAndShow(),
style: TextStyle(
fontSize: 22.sp,
color: AppColors.btnDisableColor,
@ -468,7 +504,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
//
showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件',
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Navigator.pushNamed(context, Routers.accessoriesListPage);
}));
@ -507,7 +543,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
}));
@ -516,14 +552,14 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
//
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, state.bottomBtnisUneable.value, () {
TranslationLoader.lanKeys!.set!.tr, state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": state.isOnlyOneData
@ -541,7 +577,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
}));
@ -551,7 +587,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_electronicKey.png',
TranslationLoader.lanKeys!.electronicKey!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.electronicKeyListPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
@ -560,7 +596,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_password.png',
TranslationLoader.lanKeys!.password!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.passwordKeyListPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
@ -570,7 +606,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
// logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () {
// logic.showEasyLoading();
// });
@ -585,7 +621,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.fingerprintListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
@ -597,7 +633,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_remoteControl.png',
TranslationLoader.lanKeys!.remoteControl!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.remoteControlListPage);
}));
}
@ -608,7 +644,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
bottomItem(
'images/main/icon_face.png',
TranslationLoader.lanKeys!.humanFace!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.faceList, arguments: {
"lockId": state.keyInfos.value.lockId,
}); // Toast.show(msg: "功能暂未开放");
@ -622,7 +658,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
bottomItem(
'images/main/icon_catEyes.png',
TranslationLoader.lanKeys!.monitoring!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.realTimePicturePage, arguments: {
"lockName": state.keyInfos.value.lockName,
"isMonitoring": true
@ -636,7 +672,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
showWidgetArr.add(bottomItem(
'images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.authorizedAdminListPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
@ -651,7 +687,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
bottomItem(
'images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
// Get.toNamed(Routers.lockOperatingRecordPage,
// arguments: {"keyInfo": state.keyInfos.value});
Get.toNamed(Routers.doorLockLogPage,
@ -661,7 +697,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
bottomItem(
'images/main/icon_lockDetail_videoLog.png',
TranslationLoader.lanKeys!.videoLog!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
//
Get.toNamed(Routers.videoLogPage);
}),
@ -669,14 +705,11 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
bottomItem(
'images/main/icon_lockDetail_messageReminding.png',
TranslationLoader.lanKeys!.messageReminding!.tr,
state.bottomBtnisUneable.value, () {
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.msgNotificationPage);
}),
//
bottomItem(
'images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr,
state.bottomBtnisUneable.value, () {
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
// logic.clickItemBtnAction(10);
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -689,16 +722,13 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
}
//
Widget bottomItem(
String iconUrl, String name, bool isForbidden, Function() onClick) {
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, bool bottomBtnisEable, Function() onClick) {
var width = 42.w;
var height = 42.h;
return GestureDetector(
onTap: isForbidden
? () {
logic.showToast("请在锁旁边完成第一次开锁");
}
: onClick,
onTap:openDoorBtnisUneable ? (bottomBtnisEable ? onClick : () {
logic.showToast("请在锁旁边完成第一次开锁");
}) : null,
child: Container(
// height: 300.h,
color: Colors.white,
@ -707,14 +737,13 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
children: [
SizedBox(
width: width,
height:
height, // isForbidden ? "${iconUrl}_uneable.png" :"${iconUrl}.png"
height: height,
child: Image.asset(iconUrl,
width: width,
height: height,
color: isForbidden
? AppColors.lockDetailBottomBtnUneable
: AppColors.mainColor,
color: openDoorBtnisUneable ? (bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable) : AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
SizedBox(height: 10.w),
@ -722,9 +751,9 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
child: Text(name,
style: TextStyle(
fontSize: 20.sp,
color: isForbidden
? AppColors.lockDetailBottomBtnUneable
: AppColors.blackColor),
color:openDoorBtnisUneable ? (bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable) : AppColors.lockDetailBottomBtnUneable),
textAlign: TextAlign.center))
],
)),
@ -747,8 +776,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
}
});
});
// logic.connectBlueAndAnimationController();
}
String showElectricIcon(int electricnumber) {
@ -865,7 +892,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
// lockUserNo为0
logic.addUserConnectBlue();
} else {
print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
// print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
if (state.isOpenLockNeedOnline.value == 0) {
//
logic.openDoorAction(1);
@ -894,14 +921,14 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
}
}
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
}
// @override
// void didChangeDependencies() {
// // TODO: implement didChangeDependencies
// super.didChangeDependencies();
//
// ///
// AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
// }
@override
void dispose() {

View File

@ -35,7 +35,8 @@ class LockDetailState {
var iSOpenLock = true.obs; //
Timer? closedUnlockSuccessfulTimer;
var bottomBtnisUneable = false.obs; //
var bottomBtnisEable = true.obs; //
var openDoorBtnisUneable = true.obs; // 使使,
//
AnimationController? animationController;

View File

@ -11,7 +11,9 @@ class BasicInformationState {
BasicInformationState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
if(map["lockSetInfoData"] != null){
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
}
}
}

View File

@ -42,7 +42,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
),
body: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: LoginInput(
child: LoginInput().tfInput(
controller: state.changeLockNameController,
leftWidget: const SizedBox(),
hintText: "请输入名称",

View File

@ -1,10 +1,10 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
import '../../../../blue/io_protocol/io_timing.dart';
import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_tool.dart';
@ -28,58 +28,56 @@ class LockTimeLogic extends BaseGetXController{
}
//
// if(reply is GetLockStatuReply) {
// _replyGetLockStatus(reply);
// }
if(reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) {
_replyGetStarLockStatusInfo(reply);
}
});
}
//
// Future<void> _replyGetLockStatus(Reply reply) async {
// int status = reply.data[2];
// switch(status){
// case 0x00:
// //
// print("${reply.commandType}数据解析成功");
//
// //
// var lockTime = reply.data.sublist(60, 64);
//
// int value = (
// (0xff & lockTime[(0)]) << 24 |
// (0xff & lockTime[1]) << 16 |
// (0xff & lockTime[2]) << 8 |
// (0xFF & lockTime[3]));
//
// String dataEime = DateTool().dateToYMDHNSString("$value");
// state.dateTime.value = dataEime;
//
// // String dataEime = DateTool().dateToYMDHNSString("${value}");
// // state.dateTime.value = dataEime;
// print("lockTime:$lockTime value:$value dataEime:$dataEime");
// break;
// case 0x06:
// //
// print("${reply.commandType}需要鉴权");
//
// break;
// case 0x07:
// //
// print("${reply.commandType}用户无权限");
//
// break;
// case 0x09:
// //
// print("${reply.commandType}权限校验错误");
//
// break;
// default:
// //
// print("${reply.commandType}失败");
//
// break;
// }
// }
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
int status = reply.data[2];
switch (status) {
case 0x00:
//
print("${reply.commandType}数据解析成功");
cancelBlueConnetctToastTimer();
dismissEasyLoading();
//
var indate = reply.data.sublist(149, 153);
int indateValue = ((0xff & indate[(0)]) << 24 |
(0xff & indate[1]) << 16 |
(0xff & indate[2]) << 8 |
(0xFF & indate[3]));
state.dateTime.value = DateTool().dateToYMDHNSString("$indateValue");
// state.dateTime = indateValue * 1000;
print("indate:$indate indateValue:$indateValue");
break;
case 0x06:
//
print("${reply.commandType}需要鉴权");
break;
case 0x07:
//
print("${reply.commandType}用户无权限");
break;
case 0x09:
//
print("${reply.commandType}权限校验错误");
break;
default:
//
print("${reply.commandType}失败");
break;
}
}
//
Future<void> _replyTiming(Reply reply) async {
@ -88,17 +86,20 @@ class LockTimeLogic extends BaseGetXController{
case 0x00:
//
print("${reply.commandType}数据解析成功");
// var lockTime = reply.data.sublist(4, 8);
//
// int value = (
// (0xff & lockTime[(0)]) << 24 |
// (0xff & lockTime[1]) << 16 |
// (0xff & lockTime[2]) << 8 |
// (0xFF & lockTime[3]));
//
// String dataEime = DateTool().dateToYMDHNSString("$value");
// state.dateTime.value = dataEime;
String dataEime = DateTool().dateToYMDHNSString("${state.dateTimestamp.value}");
state.dateTime.value = dataEime;
state.sureBtnState.value = 0;
cancelBlueConnetctToastTimer();
dismissEasyLoading();
@ -153,7 +154,8 @@ class LockTimeLogic extends BaseGetXController{
IoSenderManage.senderTimingCommand(
lockID:BlueManage().connectDeviceName,
userID:await Storage.getUid(),
nowTime:DateTime.now().millisecondsSinceEpoch~/1000,
// nowTime:DateTime.now().millisecondsSinceEpoch~/1000,
nowTime: state.dateTimestamp.value,
token:getTokenList,
needAuthor:1,
signKey:getSignKeyList,
@ -170,6 +172,33 @@ class LockTimeLogic extends BaseGetXController{
});
}
//
Future<void> getStarLockStatus() async {
showEasyLoading();
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
dismissEasyLoading();
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
privateKey: getPrivateKeyList,
);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
}
});
}
//
void getLockTimeFromGateway() async{
var entity = await ApiRepository.to.getLockTimeFromGateway(
@ -186,8 +215,7 @@ class LockTimeLogic extends BaseGetXController{
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
String dataEime = DateTool().dateToYMDHNSString("${entity.data!.date!}");
state.dateTime.value = dataEime;
state.dateTimestamp.value = entity.data!.date!;
if(isSendBlue){
sendTiming();
}
@ -201,8 +229,10 @@ class LockTimeLogic extends BaseGetXController{
print("onReady()");
_initReplySubscription();
// getStarLockStatus();
// getLockTimeFromGateway();
getServerDatetime(false);
// getServerDatetime(false);
}
@override

View File

@ -5,6 +5,7 @@ import '../lockSet/lockSetInfo_entity.dart';
class LockTimeState{
var lockSetInfoData = LockSetInfoData().obs;
var dateTime = "".obs;
var dateTimestamp = 0.obs;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()

View File

@ -83,7 +83,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.mockNetworkDataRequest();
logic.pageNo = 1;
getHttpData();
},
),
SizedBox(
@ -100,7 +101,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
Navigator.pushNamed(context, Routers.passwordKeyManagePage,
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
if (val != null) {
logic.mockNetworkDataRequest();
logic.pageNo = 1;
getHttpData();
}
});
}),
@ -137,6 +139,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),

View File

@ -1,6 +1,7 @@
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/dateTool.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockList_state.dart';
@ -27,35 +28,11 @@ class LockListLogic extends BaseGetXController{
if(keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop){
// 使
if(keyInfo.keyStatus == XSConstantMacro.keyStatusNormalUse || keyInfo.keyStatus == XSConstantMacro.keyStatusWaitReceive) {
return "${compareTimeGetDaysFromNow(keyInfo.endDate!)}";
return "${DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!)}";
} else {
return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!);
}
}
return "";
}
///
bool compareTimeIsOvertime(int endTiem){
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(endTiem); // DateTime
DateTime now = DateTime.now(); //
if (now.isAfter(dateTime)) {
print('The timestamp is after the current time.');
//
return true;
} else {
print('The timestamp is not after the current time.');
return false;
}
}
/// 1705132260000
int compareTimeGetDaysFromNow(int endTiem){
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(endTiem); // DateTime
DateTime now = DateTime.now(); //
Duration difference = dateTime.difference(now); //
int days = difference.inDays; //
print('dateTime:$dateTime now:$now The difference is $days days.');
return days;
}
}

View File

@ -6,6 +6,7 @@ import 'package:get/get.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/dateTool.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockListGroup_page.dart';
import 'lockList_logic.dart';
@ -98,7 +99,7 @@ class _LockListPageState extends State<LockListPage> {
}
// print("lockItemList.length:${lockItemList.length} == ${index+1} $isLast");
return lockInfoListItem(keyInfo, isLast, () {
if(logic.compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime){
if(DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime){
logic.showToast("钥匙已过期");
return;
}
@ -123,7 +124,7 @@ class _LockListPageState extends State<LockListPage> {
// height: 122.h,
margin: isLast ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
decoration: BoxDecoration(
color: (logic.compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime) ? AppColors.greyBackgroundColor : Colors.white,
color: (DateTool().compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime) ? AppColors.greyBackgroundColor : Colors.white,
borderRadius: BorderRadius.circular(20.w),
),
child: Column(
@ -193,7 +194,7 @@ class _LockListPageState extends State<LockListPage> {
)),
SizedBox(height: 20.h),
Visibility(
visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) ? true : false,
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) < 30 && DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!) > 0)) ? true : false,
// visible: true,
child:Row(
children: [
@ -202,7 +203,7 @@ class _LockListPageState extends State<LockListPage> {
padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
color: logic.compareTimeIsOvertime(keyInfo.endDate!) ? AppColors.listTimeYellowColor : AppColors.mainColor,
color: DateTool().compareTimeIsOvertime(keyInfo.endDate!) ? AppColors.listTimeYellowColor : AppColors.mainColor,
),
child: Text(logic.getKeyEffective(keyInfo), style: TextStyle(fontSize: 18.sp, color: Colors.white)
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}", style: TextStyle(fontSize: 18.sp, color: Colors.white)

View File

@ -85,7 +85,7 @@ class LockMainLogic extends BaseGetXController {
print("onReady()");
// UDP
UdpHelp().openUDP();
// UdpHelp().openUDP();
BlueManage();
}

View File

@ -139,6 +139,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
case 1:
//
Storage.setBool(ifIsDemoModeOrNot, false);
print("state.lockListInfoEntity.value.data!.groupList![0].lockList![0]:${state.lockListInfoEntity.value.data!.groupList![0].lockList![0].endDate}");
returnWidget = LockDetailPage(
isOnlyOneData: true,
lockListInfoItemEntity: state

View File

@ -77,6 +77,7 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),

View File

@ -89,7 +89,7 @@ class _MinePersonInfoEditIphonePageState
color: Colors.grey,
),
SizedBox(height: 10.w),
LoginInput(
LoginInput().tfInput(
controller: _phoneController,
isPwd: true,
leftWidget: const SizedBox(),
@ -102,7 +102,7 @@ class _MinePersonInfoEditIphonePageState
Row(
children: [
Expanded(
child: LoginInput(
child: LoginInput().tfInput(
controller: _codeController,
isPwd: true,
leftWidget: const SizedBox(),

View File

@ -50,7 +50,7 @@ class _MinePersonInfoEditNamePageState
padding: EdgeInsets.all(15.w),
child: Column(
children: [
LoginInput(
LoginInput().tfInput(
controller: state.nickNameController,
onchangeAction: (textStr) {
logic.checkNext(state.nickNameController);

View File

@ -45,7 +45,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
: TranslationLoader.lanKeys!.changeEmailTip!.tr,
style: TextStyle(fontSize: 20.sp),
)),
LoginInput(
LoginInput().tfInput(
controller: state.accountController,
isPwd: false,
onchangeAction: (textStr) {
@ -62,7 +62,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
Row(
children: [
Expanded(
child: LoginInput(
child: LoginInput().tfInput(
controller: state.codeController,
isPwd: false,
leftWidget: const SizedBox(),

View File

@ -36,7 +36,7 @@ class _MinePersonInfoResetPasswordPageState
margin: EdgeInsets.only(left: 30.w, right: 30.w),
child: Column(
children: [
LoginInput(
LoginInput().tfInput(
controller: state.oldPwdController,
onchangeAction: (textStr) {
logic.changeInput(state.oldPwdController);
@ -50,7 +50,7 @@ class _MinePersonInfoResetPasswordPageState
inputFormatters: [
LengthLimitingTextInputFormatter(20),
]),
LoginInput(
LoginInput().tfInput(
controller: state.newPwdController,
onchangeAction: (textStr) {
logic.changeInput(state.newPwdController);
@ -64,7 +64,7 @@ class _MinePersonInfoResetPasswordPageState
inputFormatters: [
LengthLimitingTextInputFormatter(20),
]),
LoginInput(
LoginInput().tfInput(
controller: state.surePwdController,
onchangeAction: (textStr) {
logic.changeInput(state.surePwdController);

View File

@ -47,6 +47,7 @@ class _EasyRefreshToolState extends State<EasyRefreshTool> {
controller: _controller,
header: const MaterialHeader(),
footer: const MaterialFooter(),
triggerAxis: Axis.vertical,
onRefresh: widget.onRefresh!=null?() async {
if(widget.onRefresh != null){
widget.onRefresh!();

View File

@ -53,4 +53,28 @@ class DateTool {
String appointmentDate = formatDate(nowDate, [HH,':',nn]);
return appointmentDate;
}
///
bool compareTimeIsOvertime(int endTiem){
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(endTiem); // DateTime
DateTime now = DateTime.now(); //
if (now.isAfter(dateTime)) {
print('The timestamp is after the current time.');
//
return true;
} else {
print('The timestamp is not after the current time.');
return false;
}
}
/// 1705132260000
int compareTimeGetDaysFromNow(int endTiem){
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(endTiem); // DateTime
DateTime now = DateTime.now(); //
Duration difference = dateTime.difference(now); //
int days = difference.inDays; //
print('dateTime:$dateTime now:$now The difference is $days days.');
return days;
}
}

View File

@ -8,67 +8,61 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
* */
typedef BlockStrCallback = void Function(dynamic textStr);
class LoginInput extends StatelessWidget {
TextEditingController? controller;
List<TextInputFormatter>? inputFormatters;
TextInputType? keyboardType;
Color? background;
String? hintText;
bool? isHaveLeftWidget;
Widget? leftWidget;
String? label;
bool? isPwd;
Widget? rightSlot;
BlockStrCallback? onchangeAction;
LoginInput(
{Key? key,
required this.controller,
this.rightSlot,
this.label,
this.isPwd,
this.inputFormatters,
this.keyboardType,
this.background,
this.hintText,
this.isHaveLeftWidget = true,
this.leftWidget,
this.onchangeAction})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
class LoginInput{
Widget tfInput({
TextEditingController? controller,
List<TextInputFormatter>? inputFormatters,
TextInputType? keyboardType,
Color? background,
String? hintText,
bool? isHaveLeftWidget,
Widget? leftWidget,
String? label,
bool? isPwd,
Widget? rightSlot,
BlockStrCallback? onchangeAction}) {
return SizedBox(
// color: Colors.red,
// width: 1.sp,
width: 1.sp,
// height: 200.h,
child: Column(
children: [
TextField(
//
maxLines: 1,
controller: controller,
onChanged: onchangeAction,
autofocus: false,
inputFormatters:inputFormatters,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
labelText: label,
labelStyle: TextStyle(fontSize: 22.sp),
hintStyle: TextStyle(fontSize: 22.sp),
hintText: hintText,
//线
border: InputBorder.none,
//
icon: isHaveLeftWidget == true
? leftWidget
: SizedBox(
width: 20.w,
height: 40.w,
),
),
obscureText: isPwd ?? false,
Row(
children: [
leftWidget ?? SizedBox(width: 36.w, height: 36.w),
SizedBox(width: 40.w,),
Expanded(
child: TextField(
//
maxLines: 1,
controller: controller,
onChanged: onchangeAction,
// autofocus: false,
inputFormatters:inputFormatters,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
labelText: label,
labelStyle: TextStyle(fontSize: 22.sp),
hintStyle: TextStyle(fontSize: 22.sp),
hintText: hintText,
//线
border: InputBorder.none,
//
// icon: isHaveLeftWidget == true
// ? leftWidget
// : SizedBox(
// width: 20.w,
// height: 40.w,
// ),
),
obscureText: isPwd ?? false,
),
),
],
),
Container(
height: 0.5.h,