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

This commit is contained in:
Daisy 2024-01-12 12:00:03 +08:00
commit 61fe70e3ab
39 changed files with 485 additions and 303 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View File

@ -127,4 +127,7 @@ class AppColors {
Color.fromRGBO(223, 237, 254, 1); // 139 148 176
static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //
static const alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); //
static Color openPassageModeColor = const Color(0xFFEB2A3B);// ()
static Color listTimeYellowColor = const Color(0xFFF3BA37);// ()
}

View File

@ -122,7 +122,7 @@ class BlueManage {
stateCallBack(deviceConnectionState!);
});
}else{
stopScan();
// stopScan();
stateCallBack(deviceConnectionState!);
}
}else{
@ -151,7 +151,7 @@ class BlueManage {
connectDeviceMacAddress = "";
connectStateCallBack(DeviceConnectionState.disconnected);
completer.complete();
await stopScan();
stopScan();
timer.cancel();
// deviceConnectionState = DeviceConnectionState.disconnected;
// print("timer index1:$index");
@ -162,6 +162,7 @@ class BlueManage {
if (knownDeviceIndex >= 0) {
//
connectDeviceMacAddress = scanDevices[knownDeviceIndex].id;
stopScan();
completer.complete();
timer.cancel();
// print("timer index2:$index");
@ -185,7 +186,7 @@ class BlueManage {
await completer.future;
}
print("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
await stopScan();
// stopScan();
if (connectDeviceMacAddress.isEmpty) {
return;
}
@ -194,6 +195,7 @@ class BlueManage {
_currentConnectionStream = _flutterReactiveBle!.connectToDevice(id: connectDeviceMacAddress, connectionTimeout: const Duration(seconds: 5)).listen((connectionStateUpdate) async {
//
deviceConnectionState = connectionStateUpdate.connectionState;
stopScan();
print('2 deviceConnectionState:$deviceConnectionState connectionStateUpdate.connectionState:${connectionStateUpdate.connectionState}');
if (connectionStateUpdate.connectionState == DeviceConnectionState.connected) {
//
@ -326,7 +328,7 @@ class BlueManage {
}
//
Future<void> stopScan() async {
void stopScan() {
// print("444444444");
if(_scanSubscription != null){
// print("555555555555");

View File

@ -23,7 +23,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
int? startTime;
int? endTime;
int? needAuthor;
List<int>? publicKey;
List<int>? signKey;
List<int>? privateKey;
SenderCustomPasswordsCommand({
@ -36,7 +36,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
this.startTime,
this.endTime,
this.needAuthor,
this.publicKey,
this.signKey,
this.privateKey,
}) : super(CommandType.generalExtendedCommond);
@ -102,16 +102,16 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
} else {
List<int> authCodeData = [];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID
authCodeData.addAll(utf8.encode(keyID!));
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//token 4 Token 0
authCodeData.addAll(token!);
authCodeData.addAll(publicKey!);
authCodeData.addAll(signKey!);
print("${commandType!.typeValue}-authCodeData:$authCodeData");

View File

@ -268,7 +268,7 @@ class IoSenderManage {
required int? startTime,
required int? endTime,
required int? needAuthor,
required List<int>? publicKey,
required List<int>? signKey,
required List<int>? privateKey,
CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData(
@ -282,7 +282,7 @@ class IoSenderManage {
startTime: startTime,
endTime: endTime,
needAuthor: needAuthor,
publicKey: publicKey,
signKey: signKey,
privateKey: privateKey,
), callBack:callBack);
}

View File

@ -5,7 +5,6 @@ import 'package:star_lock/tools/baseGetXController.dart';
import '../../mine/mine/starLockMine_logic.dart';
import '../../network/api_repository.dart';
import '../../tools/store_service.dart';
import 'starLock_login_state.dart';
class StarLockLoginLogic extends BaseGetXController {

View File

@ -1,5 +1,6 @@
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/tools/pickers/pickers.dart';
@ -301,24 +302,35 @@ class _AddCardPageState extends State<AddCardPage> {
//
Widget getTFWidget(String tfStr) {
return Container(
height: 50.h,
// color: Colors.red,
height: 65.h,
width: 300.w,
padding: EdgeInsets.only(top: 5.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: TextField(
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
controller: state.nameController,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 24.sp),
//线
border: InputBorder.none,
hintStyle: TextStyle(fontSize: 22.sp),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
),
),

View File

@ -1,12 +1,14 @@
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 '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/dateTool.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/noData.dart';
import '../../../../tools/showIosTipView.dart';
@ -57,7 +59,12 @@ class _CardListPageState extends State<CardListPage> {
),
body: Column(
children: [
_searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.getICCardListData();
},
),
SizedBox(height: 20.h),
Expanded(child: _buildMainUI()),
AddBottomWhiteBtn(
@ -82,49 +89,6 @@ class _CardListPageState extends State<CardListPage> {
);
}
Widget _searchWidget() {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: TextField(
//
maxLines: 1,
controller: state.searchController,
autofocus: false,
onChanged: (value) {
print("onChanged:$value");
},
onEditingComplete: () {
print("onEditingComplete:");
},
onSubmitted: (value) {
logic.getICCardListData();
},
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
//线
border: InputBorder.none,
//
icon: Padding(
padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
),
),
);
}
Widget _buildMainUI() {
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
? ListView.separated(

View File

@ -11,6 +11,7 @@ import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/submitBtn.dart';
@ -73,7 +74,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
),
body: Column(
children: [
_searchWidget(),
// _searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.mockNetworkDataRequest();
},
),
SizedBox(
height: 20.h,
),
@ -128,45 +135,45 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
_refreshController.refreshCompleted();
}
Widget _searchWidget() {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: TextField(
//
maxLines: 1,
// controller: _controller,
autofocus: false,
controller: state.searchController,
onSubmitted: (value) {
logic.mockNetworkDataRequest();
},
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 18.0, left: -19.0, right: -15.0, bottom: 2),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
//线
border: InputBorder.none,
//
icon: Padding(
padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
),
style:
TextStyle(fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
),
);
}
// Widget _searchWidget() {
// return Container(
// height: 60.h,
// margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
// decoration: BoxDecoration(
// color: Colors.white, borderRadius: BorderRadius.circular(5)),
// child: TextField(
// //
// maxLines: 1,
// // controller: _controller,
// autofocus: false,
// controller: state.searchController,
// onSubmitted: (value) {
// logic.mockNetworkDataRequest();
// },
// decoration: InputDecoration(
// //
// contentPadding: const EdgeInsets.only(
// top: 18.0, left: -19.0, right: -15.0, bottom: 2),
// hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
// hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
// //线
// border: InputBorder.none,
// //
// icon: Padding(
// padding: EdgeInsets.only(
// top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
// child: Image.asset(
// 'images/main/icon_main_search.png',
// width: 40.w,
// height: 40.w,
// ),
// ),
// ),
// style:
// TextStyle(fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
// ),
// );
// }
Widget _buildMainUI(itemData) {
List<ElectronicKeyListItem> getItemData = itemData;

View File

@ -431,7 +431,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
//
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
return SizedBox(
height: 50.h,
height: 65.h,
width: 320.w,
child: Row(
children: [
@ -442,16 +442,31 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
: state.keyNameController,
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
// controller: _controller,
autofocus: false,
textAlign: TextAlign.end,
// decoration: InputDecoration(
// //
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// hintText: tfStr,
// hintStyle: TextStyle(fontSize: 22.sp),
// //线
// border: InputBorder.none,
// ),
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
style: TextStyle(
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),

View File

@ -118,7 +118,7 @@ class AddFingerprintLogic extends BaseGetXController {
print("${reply.commandType!.typeValue} 数据解析成功");
if(reply.data[5] == 255){
//
print("${reply.commandType!.typeValue} 注册指纹失败");
// print("${reply.commandType!.typeValue} 注册指纹失败");
Toast.show(msg: "添加失败");
Get.close(2);
}else{

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// import 'package:flutter_pickers/pickers.dart';
// import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -284,24 +285,35 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
//
Widget getTFWidget(String tfStr) {
return Container(
height: 50.h,
// color: Colors.red,
height: 65.h,
width: 300.w,
padding: EdgeInsets.only(top: 5.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: TextField(
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
controller: state.nameController,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 24.sp),
//线
border: InputBorder.none,
hintStyle: TextStyle(fontSize: 22.sp),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
),
),

View File

@ -32,7 +32,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}",
barTitle: "指纹详情",
haveBack: true,
backgroundColor: AppColors.mainColor,
// actionsList: [

View File

@ -1,12 +1,14 @@
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 '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/dateTool.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/noData.dart';
import '../../../../tools/showIosTipView.dart';
@ -57,7 +59,12 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
),
body: Column(
children: [
_searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.getFingerprintsListData();
},
),
SizedBox(
height: 20.h,
),
@ -81,49 +88,6 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
);
}
Widget _searchWidget() {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: TextField(
//
maxLines: 1,
controller: state.searchController,
autofocus: false,
onChanged: (value) {
print("onChanged:$value");
},
onEditingComplete: () {
print("onEditingComplete:");
},
onSubmitted: (value) {
logic.getFingerprintsListData();
},
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
//线
border: InputBorder.none,
//
icon: Padding(
padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
),
),
);
}
Widget _buildMainUI() {
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
? ListView.separated(

View File

@ -316,6 +316,7 @@ class LockBasicInfo {
String? mac;
int? keyRight;
int? senderUserId;
int? lockUserNo;
LockBasicInfo(
{this.keyId,
@ -332,7 +333,8 @@ class LockBasicInfo {
this.endDate,
this.mac,
this.keyRight,
this.senderUserId});
this.senderUserId,
this.lockUserNo});
LockBasicInfo.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
@ -355,7 +357,7 @@ class LockBasicInfo {
mac = json['mac'];
keyRight = json['keyRight'];
senderUserId = json['senderUserId'];
lockUserNo = json['lockUserNo'];
}
Map<String, dynamic> toJson() {
@ -377,6 +379,7 @@ class LockBasicInfo {
data['mac'] = mac;
data['keyRight'] = keyRight;
data['senderUserId'] = senderUserId;
data['lockUserNo'] = lockUserNo;
return data;
}
}

View File

@ -449,7 +449,11 @@ class LockSetLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = "";
eventBus.fire(RefreshLockListInfoDataEvent());
Get.close(2);
if(state.isOnlyOneData.value == true){
Get.close(1);
}else{
Get.close(2);
}
}
}
@ -462,7 +466,11 @@ class LockSetLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = "";
eventBus.fire(RefreshLockListInfoDataEvent());
Get.close(2);
if(state.isOnlyOneData.value == true){
Get.close(1);
}else{
Get.close(2);
}
// Get.offAllNamed(Routers.starLockMain);
}
}
@ -510,8 +518,14 @@ class LockSetLogic extends BaseGetXController {
//
factoryDataResetAction();
} else {
//
deletUserAction();
//
if(state.lockSetInfoData.value.lockBasicInfo!.lockUserNo != 0){
//
deletUserAction();
}else{
//
deletKeyData();
}
}
return;
}
@ -573,8 +587,14 @@ class LockSetLogic extends BaseGetXController {
//
factoryDataResetAction();
} else {
//
deletUserAction();
//
if(state.lockSetInfoData.value.lockBasicInfo!.lockUserNo != 0){
//
deletUserAction();
}else{
//
deletKeyData();
}
}
}else if(state.currentDeviceUUid.value[31] == "0"){
//

View File

@ -107,8 +107,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1 ? true : false,
// visible:true,
// visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible:true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
@ -287,8 +287,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
SizedBox(height: 10.h),
//
Obx(() => Visibility(
// visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible:true,
visible: state.lockFeature.value.passageMode == 1 ? true : false,
// visible:true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1

View File

@ -13,7 +13,9 @@ class LockSetState {
final lockBasicInfo = LockBasicInfo().obs;
final lockId = 0.obs;
// var lockCount = 1;
var isOnlyOneData = false.obs;
var isAttendance = 0.obs;//
var currentDeviceUUid = "".obs;// uuid
var isOpenLockNeedOnline = 0.obs;// APP开锁时是否需联网
@ -34,7 +36,7 @@ class LockSetState {
LockSetState() {
Map map = Get.arguments;
lockId.value = map["lockId"];
isOnlyOneData.value = map["isOnlyOneData"];
// getKeyInfosData.value = Get.arguments as KeyInfos;
// isAttendance.value = getKeyInfosData.value.isAttendance!;
// isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;

View File

@ -29,7 +29,7 @@ class LockSoundSetLogic extends BaseGetXController {
if(entity.errorCode!.codeIsSuccessful){
// eventBus.fire(RefreshLockListInfoDataEvent());
state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :2;
state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :0;
state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");

View File

@ -25,7 +25,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
//
void configPassageMode() async{
if(state.weekDays.value.isNotEmpty){
if(state.weekDays.value.isEmpty){
Toast.show(msg:"请选择常开日期");
return;
}
@ -35,24 +35,27 @@ class NormallyOpenModeLogic extends BaseGetXController{
return;
}
var passageModeConfig = [];
var map = {
"isAllDay":state.isAllDay.value,
"weekDays":state.weekDays.value,
"startDate":state.beginTimeMinute.value,
"endDate":state.endTimeMinute.value,
};
passageModeConfig.add(map);
// print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}");
var entity = await ApiRepository.to.setNormallyModeData(
lockId: state.lockSetInfoData.value.lockId!,
passageMode:state.isOpenNormallyOpenMode.value == true ? 1:0,
passageModeConfig: map,
passageModeConfig: passageModeConfig,
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2;
state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(2, state.lockSetInfoData.value.lockSettingInfo!.passageMode!));
Toast.show(msg: "操作成功");
}
}
@ -218,7 +221,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
list.add(state.isAllDay.value == 1 ? 1:0);
list.add(number);
list.add(0);
print("listlistlistlist:$list");
// print("listlistlistlist:$list");
IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),

View File

@ -193,7 +193,7 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
}
state.weekDays.value.sort();
setState(() {});
// print("index:$index data:${state.normallyOpenPeriod.value}");
print("index:$index data:${state.weekDays.value}");
},
child: Obx(() => Container(
width: 40.w,

View File

@ -8,7 +8,7 @@ class NormallyOpenModeState{
var isJustForShow = false.obs;//
// var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
var isOpenNormallyOpenMode = false.obs;// 1-2-
var isOpenNormallyOpenMode = false.obs;// 1-0-
// var isOpenAutomaticUnLock = false.obs;// :1-2-
var isAllDay = 0.obs;// 1-2-, startDate和endDate参数将被忽略.
var weekDays = [].obs;//

View File

@ -653,6 +653,10 @@ class LockDetailLogic extends BaseGetXController {
// 1
state.isOpenLockNeedOnline.value = event.setResult;
state.keyInfos.value.lockSetting!.appUnlockOnline = event.setResult;
} else if (event.type == 2) {
// 2
state.isOpenPassageMode.value = event.setResult;
state.keyInfos.value.passageMode = event.setResult;
}
});
}

View File

@ -25,7 +25,7 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
@override
Widget build(BuildContext context) {
final bool isFrist;
final bool isOnlyOneData;
LockListInfoItemEntity keyInfos = LockListInfoItemEntity();
// LockMainEntity lockEntity = LockMainEntity();
@ -36,13 +36,15 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
if (obj != null && (obj["keyInfo"] != null)) {
keyInfos = obj["keyInfo"];
}
isOnlyOneData = obj["isOnlyOneData"];
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.starLock!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: LockDetailPage(isFrist:true, lockListInfoItemEntity: keyInfos),
body: LockDetailPage(isOnlyOneData:isOnlyOneData, lockListInfoItemEntity: keyInfos),
// body: Container(),
);
}

View File

@ -16,11 +16,11 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart';
class LockDetailPage extends StatefulWidget {
final bool isFrist;
final bool isOnlyOneData;
final LockListInfoItemEntity lockListInfoItemEntity;
const LockDetailPage(
{Key? key, required this.isFrist, required this.lockListInfoItemEntity})
{Key? key, required this.isOnlyOneData, required this.lockListInfoItemEntity})
: super(key: key);
@override
@ -38,7 +38,7 @@ class _LockDetailPageState extends State<LockDetailPage>
void initState() {
// TODO: implement initState
super.initState();
print("LockDetailPage isOnlyOneData==${widget.isOnlyOneData}");
state.keyInfos.value = widget.lockListInfoItemEntity;
state.lockUserNo = state.keyInfos.value.lockUserNo!;
state.senderUserId = state.keyInfos.value.senderUserId!;
@ -46,6 +46,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.isOpenLockNeedOnline.value =
state.keyInfos.value.lockSetting!.appUnlockOnline!;
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
@ -119,12 +120,13 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [
SizedBox(
width: 1.sw - 120.w * 2,
child: Center(
child: Obx(() => Center(
child: Text(
widget.lockListInfoItemEntity.lockAlias!,
style:
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
))),
widget.lockListInfoItemEntity.lockAlias!,
style:
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400, color: state.isOpenPassageMode.value == 1 ? AppColors.openPassageModeColor : AppColors.darkGrayTextColor),
)))
),
Positioned(
child: Obx(() => Row(
mainAxisAlignment: MainAxisAlignment.end,
@ -156,7 +158,7 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [
Image.asset(
// state.connectState.value == 0 ? 'images/main/icon_main_openLockBtn_grey.png' : 'images/main/icon_main_openLockBtn_center.png',
'images/main/icon_main_openLockBtn_center.png',
state.isOpenPassageMode.value == 1 ? 'images/main/icon_main_normallyOpenMode_center.png' : 'images/main/icon_main_openLockBtn_center.png',
width: 330.w,
height: 330.w,
),
@ -164,7 +166,8 @@ class _LockDetailPageState extends State<LockDetailPage>
? buildRotationTransition()
: Positioned(
child: Image.asset(
'images/main/icon_main_openLockBtn_circle.png',
// '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',
width: 330.w,
height: 330.w,
)),
@ -203,13 +206,13 @@ class _LockDetailPageState extends State<LockDetailPage>
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr,
Obx(() => Text(
state.isOpenPassageMode.value == 1 ? "常开模式启动!长按闭锁" : TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.btnDisableColor,
fontWeight: FontWeight.w500),
),
)),
],
),
SizedBox(
@ -222,43 +225,32 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/icon_electronicKey_admin.png',
width: 24.w,
height: 20.w,
color: AppColors.mainColor, //
),
SizedBox(
width: 6.w,
color: AppColors.blackColor, //
),
SizedBox(width: 6.w),
Text(
state.keyInfos.value.isLockOwner == 1
? TranslationLoader.lanKeys!.superAdmin!.tr
: (state.keyInfos.value.keyRight == 1
? TranslationLoader.lanKeys!.authorizedAdmin!.tr
: TranslationLoader.lanKeys!.normalUser!.tr),
: (state.keyInfos.value.keyRight == 1 ? TranslationLoader.lanKeys!.authorizedAdmin!.tr : TranslationLoader.lanKeys!.normalUser!.tr),
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
width: 80.w,
),
SizedBox(width: 80.w),
Image.asset(
state.keyInfos.value.remoteEnable == 1
? 'images/main/icon_main_remoteUnlocking.png'
: 'images/main/icon_main_remoteUnlocking_grey.png',
state.keyInfos.value.remoteEnable == 1 ? 'images/main/icon_main_remoteUnlocking.png' : 'images/main/icon_main_remoteUnlocking_grey.png',
width: 24.w,
height: 20.w,
// color: state.keyInfos.value.remoteEnable == 1
// ? AppColors.btnDisableColor
// : AppColors.mainColor,
),
SizedBox(
width: 6.w,
),
SizedBox(width: 6.w),
Text(
TranslationLoader.lanKeys!.gatewayDevice!.tr,
style: TextStyle(
fontSize: 20.sp,
color: state.keyInfos.value.remoteEnable == 1
? AppColors.mainColor
: AppColors.btnDisableColor),
color: state.keyInfos.value.remoteEnable == 1 ? AppColors.mainColor : AppColors.btnDisableColor
),
),
],
),
@ -285,7 +277,7 @@ class _LockDetailPageState extends State<LockDetailPage>
turns: state.animationController,
//view
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',
width: 330.w,
height: 330.w,
),
@ -322,19 +314,16 @@ class _LockDetailPageState extends State<LockDetailPage>
List<Widget> getNormalWidget() {
var showWidgetArr = [
//
bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: {"keyInfo": widget.lockListInfoItemEntity});
bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": widget.lockListInfoItemEntity});
}),
//
bottomItem(
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() {
// BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage,
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
"isOnlyOneData": widget.isOnlyOneData,
});
}),
];
return showWidgetArr;
@ -455,8 +444,10 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() {
// BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage,
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
"isOnlyOneData": widget.isOnlyOneData,
});
}),
];
showWidgetArr.addAll(endWiddget);

View File

@ -25,6 +25,7 @@ class LockDetailState {
var isAttendance = 0.obs;//
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
var electricQuantity = 0.obs; //
var isOpenPassageMode = 0.obs; //
var currentDeviceUUid = "".obs;// uuid
@ -38,4 +39,9 @@ class LockDetailState {
// var lockState = 0.obs;// 0 1() 2 3 4 5
var openLockBtnState = 0.obs;// 0() 1()
// var connectState = 0.obs;// 0 1
// LockDetailState() {
// Map map = Get.arguments;
// lockCount = map["lockCount"];
// }
}

View File

@ -10,6 +10,7 @@ import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/submitBtn.dart';
@ -71,7 +72,13 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
),
body: Column(
children: [
_searchWidget(),
// _searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.mockNetworkDataRequest();
},
),
SizedBox(
height: 20.h,
),

View File

@ -178,17 +178,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 0x00:
//
print("${reply.commandType!.typeValue} 数据解析成功");
addKeyboardPwdRequest();
break;
case 0x06:
//
print("${reply.commandType!.typeValue} 需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
print('得到的开始时间时间戳$getStartDate');
@ -201,7 +200,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
startTime: 0x11223344,
endTime: 0x11223344,
needAuthor: 1,
publicKey: publicKeyDataList,
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: token);
break;
@ -231,11 +230,10 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
//
Future<void> senderCustomPasswords() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(DeviceConnectionState state) async {
if (state == DeviceConnectionState.connected) {
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
if (deviceConnectionState == DeviceConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -248,12 +246,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
keyID: "1",
userID: await Storage.getUid(),
pwdNo: 1,
pwd: "123456",
pwd:state.pwdController.text,
useCountLimit: 0xff,
startTime: 0x11223344,
endTime: 0x11223344,
needAuthor: 1,
publicKey: publicKeyDataList,
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
}

View File

@ -430,7 +430,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
}
}
logic.addKeyboardPwdRequest();
logic.senderCustomPasswords();
} else {
if (state.nameController.text.isEmpty) {
Toast.show(msg: '请输入姓名');
@ -539,7 +539,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
//
Widget getTFWidget(String tfStr, TextEditingController editController) {
return SizedBox(
height: 50.h,
height: 65.h,
width: 300.w,
child: Row(
children: [
@ -547,16 +547,31 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
child: TextField(
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
controller: editController,
autofocus: false,
textAlign: TextAlign.end,
// decoration: InputDecoration(
// //
// contentPadding: EdgeInsets.only(top: 24.h, bottom: 16.h),
// hintText: tfStr,
// hintStyle: TextStyle(fontSize: 22.sp),
// //线
// border: InputBorder.none,
// ),
decoration: InputDecoration(
//
contentPadding: EdgeInsets.only(top: 24.h, bottom: 16.h),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
),
),

View File

@ -1,5 +1,76 @@
import 'package:star_lock/tools/baseGetXController.dart';
class LockListLogic extends BaseGetXController{
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockList_state.dart';
class LockListLogic extends BaseGetXController{
LockListState state = LockListState();
String getUseKeyTypeStr(LockListInfoItemEntity indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
useDateStr = '永久';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
useDateStr = '单次';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';
}
return useDateStr;
}
String showElectricIcon (int electricnumber){
if(electricnumber >= 100){
return 'images/main/icon_lockElectricLevel_5.png';
}else if((electricnumber > 50) && (electricnumber < 100)){
return 'images/main/icon_lockElectricLevel_4.png';
}else if((electricnumber > 25) && (electricnumber <= 50)){
return 'images/main/icon_lockElectricLevel_3.png';
}else if((electricnumber > 5) && (electricnumber <= 25)){
return 'images/main/icon_lockElectricLevel_2.png';
}else if(electricnumber <= 5){
return 'images/main/icon_lockElectricLevel_1.png';
}
return 'images/main/icon_lockElectricLevel_5.png';
}
///
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,9 +6,9 @@ import 'package:get/get.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/ExpandedListView.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockListGroup_page.dart';
import 'lockList_logic.dart';
class LockListPage extends StatefulWidget {
final LockListInfoGroupEntity lockListInfoGroupEntity;
@ -20,6 +20,9 @@ class LockListPage extends StatefulWidget {
}
class _LockListPageState extends State<LockListPage> {
final logic = Get.put(LockListLogic());
final state = Get.find<LockListLogic>().state;
var groupDataList = <GroupList>[];
@override
@ -95,9 +98,18 @@ 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){
logic.showToast("钥匙已过期");
return;
}
// var lockCount = 0;
// for(GroupList itemData in groupDataList){
// lockCount+=itemData.lockList!.length;
// }
Get.toNamed(Routers.lockDetailMainPage, arguments: {
// "lockMainEntity": widget.lockMainEntity,
"keyInfo": keyInfo
"keyInfo": keyInfo,
"isOnlyOneData": false,
});
});
}),
@ -111,7 +123,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: Colors.white,
color: (logic.compareTimeIsOvertime(keyInfo.endDate!) && keyInfo.keyType == XSConstantMacro.keyTypeTime) ? AppColors.greyBackgroundColor : Colors.white,
borderRadius: BorderRadius.circular(20.w),
),
child: Column(
@ -131,7 +143,7 @@ class _LockListPageState extends State<LockListPage> {
Text(
keyInfo.lockAlias!,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w500),
fontSize: 24.sp, fontWeight: FontWeight.w500, color: keyInfo.passageMode == 1 ? AppColors.openPassageModeColor : AppColors.darkGrayTextColor),
),
],
),
@ -144,21 +156,53 @@ class _LockListPageState extends State<LockListPage> {
),
SizedBox(width: 2.w),
Image.asset(
showElectricIcon(keyInfo.electricQuantity!),
logic.showElectricIcon(keyInfo.electricQuantity!),
width: 30.w,
height: 24.w,
),
SizedBox(width: 30.w),
],
),
SizedBox(
height: 5.h,
),
Visibility(
visible: keyInfo.remoteEnable == 1 ? true : false,
child:Row(
children: [
SizedBox(width: 30.w),
Text(
"远程开锁", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
],
)),
SizedBox(
height: 20.h,
),
Visibility(
visible: keyInfo.keyType == XSConstantMacro.keyTypeTime ? true : false,
// visible: true,
child:Row(
children: [
SizedBox(width: 30.w),
Container(
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,
),
child: Text(
logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}", style: TextStyle(fontSize: 18.sp, color: Colors.white)
),
),
],
)),
SizedBox(height: 5.h),
Row(
children: [
SizedBox(width: 30.w),
Text(
"${getUseDateStr(keyInfo)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}",
"${logic.getUseKeyTypeStr(keyInfo)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
@ -173,47 +217,4 @@ class _LockListPageState extends State<LockListPage> {
);
}
String getUseDateStr(LockListInfoItemEntity indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} ${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
useDateStr = '永久';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
useDateStr = '单次';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';
}
return useDateStr;
}
String showElectricIcon (int electricnumber){
if(electricnumber >= 100){
return 'images/main/icon_lockElectricLevel_5.png';
}else if((electricnumber > 50) && (electricnumber < 100)){
return 'images/main/icon_lockElectricLevel_4.png';
}else if((electricnumber > 25) && (electricnumber <= 50)){
return 'images/main/icon_lockElectricLevel_3.png';
}else if((electricnumber > 5) && (electricnumber <= 25)){
return 'images/main/icon_lockElectricLevel_2.png';
}else if(electricnumber <= 5){
return 'images/main/icon_lockElectricLevel_1.png';
}
return 'images/main/icon_lockElectricLevel_5.png';
}
}

View File

@ -83,7 +83,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
case 1:
//
Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = LockDetailPage(isFrist: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
returnWidget = LockDetailPage(isOnlyOneData: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
break;
case 2:
//

View File

@ -3,10 +3,8 @@ import 'dart:async';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:get/get.dart';
import '../../../appRouters.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_protocol/io_addUser.dart';
import '../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
import '../../../blue/io_reply.dart';
import '../../../blue/io_tool/io_tool.dart';
import '../../../blue/io_tool/manager_event_bus.dart';
@ -49,7 +47,7 @@ class SaveLockLogic extends BaseGetXController {
case 0x00:
//
print("添加用户数据解析成功");
state.lockUserNo = reply.data[47] + 1;
state.lockUserNo = reply.data[47];
cancelBlueConnetctToastTimer();
dismissEasyLoading();

View File

@ -640,7 +640,7 @@ class ApiProvider extends BaseProvider {
}));
//
Future<Response> setNormallyModeData(int lockId, int passageMode, Map passageModeConfig) =>
Future<Response> setNormallyModeData(int lockId, int passageMode, List passageModeConfig) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({

View File

@ -676,7 +676,7 @@ class ApiRepository {
Future<LoginEntity> setNormallyModeData({
required int lockId,
required int passageMode,
required Map passageModeConfig,
required List passageModeConfig,
}) async {
final res =
await apiProvider.setNormallyModeData(lockId, passageMode, passageModeConfig);

View File

@ -1,13 +1,10 @@
import 'dart:async';
import 'package:async/async.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import '../login/login/entity/LoginEntity.dart';
import '../translations/trans_lib.dart';
import 'manager/client_manager.dart';
class BaseGetXController extends GetxController{

View File

@ -45,7 +45,7 @@ class LockGroupEditGroupLockRefreshEvent {
///
class LockSetChangeSetRefreshLockDetailWithType {
int type; // 0 1
int type; // 0 1 2
int setResult;
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
}

View File

@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../translations/trans_lib.dart';
class KeySearchWidget extends StatelessWidget {
TextEditingController editingController;
Function() onSubmittedAction;
KeySearchWidget(
{Key? key,
required this.editingController,
required this.onSubmittedAction})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
padding: EdgeInsets.only(top: 5.h,right: 10.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(
top: 15.h, bottom: 15.h, right: 5.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
Expanded(
child: Container(
height: 60.h,
// width: 1.sw,
// color: Colors.red,
child: TextField(
//
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
controller: editingController,
autofocus: false,
textAlign: TextAlign.start,
onChanged: (value) {
print("onChanged:$value");
},
onEditingComplete: () {
print("onEditingComplete:");
},
onSubmitted: (value) {
onSubmittedAction!();
},
decoration: InputDecoration(
//
// contentPadding: const EdgeInsets.only(
// top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
// hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintText:"搜索",
hintStyle: TextStyle(fontSize: 22.sp),
// border: InputBorder.none,
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
),
),
),
],
),
);
}
}