1,锁详情页面新增权限处理
2,头像权限处理(待完善)
This commit is contained in:
parent
04d17f6483
commit
d9e93fbdea
@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||||
|
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||||
|
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
import '../../../blue/io_protocol/io_addUser.dart';
|
import '../../../blue/io_protocol/io_addUser.dart';
|
||||||
@ -50,7 +51,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 开完锁之后上传记录
|
// 开完锁之后上传记录
|
||||||
if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) {
|
if (reply is SenderReferEventRecordTimeReply &&
|
||||||
|
state.ifCurrentScreen.value == true) {
|
||||||
_replyReferEventRecordTime(reply);
|
_replyReferEventRecordTime(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +75,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// _showFullScreenOverlay(Get.context!);
|
// _showFullScreenOverlay(Get.context!);
|
||||||
|
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
if (state.closedUnlockSuccessfulTimer != null ) {
|
if (state.closedUnlockSuccessfulTimer != null) {
|
||||||
state.closedUnlockSuccessfulTimer!.cancel();
|
state.closedUnlockSuccessfulTimer!.cancel();
|
||||||
state.closedUnlockSuccessfulTimer = null;
|
state.closedUnlockSuccessfulTimer = null;
|
||||||
}
|
}
|
||||||
@ -379,7 +381,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
});
|
});
|
||||||
|
|
||||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
BlueManage()
|
||||||
|
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// 私钥
|
// 私钥
|
||||||
@ -411,7 +414,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
@ -466,7 +470,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
@ -698,17 +703,21 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||||
void _initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
void _initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
|
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus
|
||||||
|
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||||
|
.listen((event) {
|
||||||
if (event.type == 0) {
|
if (event.type == 0) {
|
||||||
// 0考勤
|
// 0考勤
|
||||||
state.isAttendance.value = int.parse(event.setResult);
|
state.isAttendance.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.attendance = int.parse(event.setResult);
|
state.keyInfos.value.lockSetting!.attendance =
|
||||||
|
int.parse(event.setResult);
|
||||||
} else if (event.type == 1) {
|
} else if (event.type == 1) {
|
||||||
// 1 开锁时是否需联网
|
// 1 开锁时是否需联网
|
||||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||||
int.parse(event.setResult);
|
int.parse(event.setResult);
|
||||||
print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
print(
|
||||||
|
"state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
||||||
} else if (event.type == 2) {
|
} else if (event.type == 2) {
|
||||||
// 2 常开模式
|
// 2 常开模式
|
||||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||||
@ -726,19 +735,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyStatusTextAndShow(){
|
String getKeyStatusTextAndShow() {
|
||||||
String text = "";
|
String text = "";
|
||||||
if (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitIneffective ||
|
if (state.keyInfos.value.keyStatus ==
|
||||||
|
XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
||||||
text = "你的钥匙${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
text =
|
||||||
|
"你的钥匙${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
||||||
} else {
|
} else {
|
||||||
text = state.isOpenPassageMode.value == 1
|
text = state.isOpenPassageMode.value == 1
|
||||||
? "常开模式启动!长按闭锁"
|
? "常开模式启动!长按闭锁"
|
||||||
: TranslationLoader
|
: TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr;
|
||||||
.lanKeys!.clickUnlockAndHoldDownClose!.tr;
|
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@ -826,6 +836,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
return formattedTime;
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> positionPermissionAlert() async {
|
||||||
|
//安卓平台下首次进入应用需向用户告知获取权限用途弹窗
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
AppFirstEnterHandle()
|
||||||
|
.getAppFirstEnter(state.widgetContext, isAgreePosition);
|
||||||
|
var getFlag = await Storage.getString(isAgreePosition);
|
||||||
|
if (getFlag == isAgreePosition) {
|
||||||
|
openBlueSet();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
openBlueSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
openBlueSet() {
|
openBlueSet() {
|
||||||
if (!Platform.isIOS) {
|
if (!Platform.isIOS) {
|
||||||
getMicrophonePermission().then((value) {
|
getMicrophonePermission().then((value) {
|
||||||
@ -862,7 +886,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
openBlueSet();
|
// openBlueSet();
|
||||||
|
|
||||||
|
positionPermissionAlert();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
_initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
_initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||||||
@ -886,5 +912,4 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
||||||
// _scanListDiscoveredDeviceSubscription.cancel();
|
// _scanListDiscoveredDeviceSubscription.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,8 @@ class LockDetailPage extends StatefulWidget {
|
|||||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStateMixin, RouteAware {
|
class _LockDetailPageState extends State<LockDetailPage>
|
||||||
|
with TickerProviderStateMixin, RouteAware {
|
||||||
// with RouteAware
|
// with RouteAware
|
||||||
final logic = Get.put(LockDetailLogic());
|
final logic = Get.put(LockDetailLogic());
|
||||||
final state = Get.find<LockDetailLogic>().state;
|
final state = Get.find<LockDetailLogic>().state;
|
||||||
@ -61,6 +62,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
Get.log("LockDetailPage didChangeDependencies2222");
|
Get.log("LockDetailPage didChangeDependencies2222");
|
||||||
|
|
||||||
/// 路由订阅
|
/// 路由订阅
|
||||||
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
}
|
}
|
||||||
@ -68,12 +70,13 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
||||||
void _initRefreshLockDetailInfoDataEventAction() {
|
void _initRefreshLockDetailInfoDataEventAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockRefreshLockDetailInfoDataEvent = eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
_lockRefreshLockDetailInfoDataEvent =
|
||||||
|
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadData(){
|
void loadData() {
|
||||||
// print("widget.lockListInfoItemEntity.lockUserNo:${widget.lockListInfoItemEntity.lockUserNo}");
|
// print("widget.lockListInfoItemEntity.lockUserNo:${widget.lockListInfoItemEntity.lockUserNo}");
|
||||||
// print("state.lockUserNo:${state.lockUserNo}");
|
// print("state.lockUserNo:${state.lockUserNo}");
|
||||||
|
|
||||||
@ -81,17 +84,18 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
if (state.lockUserNo == 0) {
|
if (state.lockUserNo == 0) {
|
||||||
state.bottomBtnisEable.value = false;
|
state.bottomBtnisEable.value = false;
|
||||||
}else{
|
} else {
|
||||||
state.bottomBtnisEable.value = true;
|
state.bottomBtnisEable.value = true;
|
||||||
}
|
}
|
||||||
// print("state.keyInfos.value.keyStatus:${state.keyInfos.value.keyStatus}");
|
// print("state.keyInfos.value.keyStatus:${state.keyInfos.value.keyStatus}");
|
||||||
if (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitIneffective ||
|
if (state.keyInfos.value.keyStatus ==
|
||||||
|
XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
||||||
state.openDoorBtnisUneable.value = false;
|
state.openDoorBtnisUneable.value = false;
|
||||||
}else{
|
} else {
|
||||||
state.openDoorBtnisUneable.value = true;
|
state.openDoorBtnisUneable.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,28 +104,28 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
state.senderUserId = state.keyInfos.value.senderUserId!;
|
state.senderUserId = state.keyInfos.value.senderUserId!;
|
||||||
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
|
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
|
||||||
state.isOpenLockNeedOnline.value =
|
state.isOpenLockNeedOnline.value =
|
||||||
state.keyInfos.value.lockSetting!.appUnlockOnline!;
|
state.keyInfos.value.lockSetting!.appUnlockOnline!;
|
||||||
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
||||||
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
|
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
|
||||||
state.lockAlias.value = state.keyInfos.value.lockAlias!;
|
state.lockAlias.value = state.keyInfos.value.lockAlias!;
|
||||||
|
|
||||||
BlueManage().connectDeviceName =
|
BlueManage().connectDeviceName =
|
||||||
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
|
|
||||||
List<int> publicKeyData =
|
List<int> publicKeyData =
|
||||||
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
List<int> privateKeyData =
|
List<int> privateKeyData =
|
||||||
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
|
|
||||||
// signKey
|
// signKey
|
||||||
List<int> signKeyData =
|
List<int> signKeyData =
|
||||||
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
||||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||||
|
|
||||||
@ -131,16 +135,29 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
state.widgetContext = context;
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: (
|
visible:
|
||||||
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) < 30 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) > 0) &&// 0到30天
|
state.keyInfos.value.keyType ==
|
||||||
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive)// 正常使用、待接收
|
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
) ? true : false,
|
(DateTool().compareTimeGetDaysFromNow(
|
||||||
|
state.keyInfos.value.endDate!) <
|
||||||
|
30 &&
|
||||||
|
DateTool().compareTimeGetDaysFromNow(
|
||||||
|
state.keyInfos.value.endDate!) >
|
||||||
|
0) && // 0到30天
|
||||||
|
(state.keyInfos.value.keyStatus ==
|
||||||
|
XSConstantMacro.keyStatusNormalUse ||
|
||||||
|
state.keyInfos.value.keyStatus ==
|
||||||
|
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||||
|
)
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 30.h,
|
// height: 30.h,
|
||||||
color: const Color(0xFFFBEFD4),
|
color: const Color(0xFFFBEFD4),
|
||||||
@ -148,7 +165,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text("钥匙将在${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}天后失效",
|
Text(
|
||||||
|
"钥匙将在${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}天后失效",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: const Color(0xffCBA74B), fontSize: 24.sp))
|
color: const Color(0xffCBA74B), fontSize: 24.sp))
|
||||||
],
|
],
|
||||||
@ -185,21 +203,21 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||||
// visible: true,
|
// visible: true,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||||
color: Colors.black.withOpacity(0.3),
|
color: Colors.black.withOpacity(0.3),
|
||||||
child: _unlockSuccessWidget()),
|
child: _unlockSuccessWidget()),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -215,73 +233,70 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 120.w * 2,
|
width: 1.sw - 120.w * 2,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
state.lockAlias.value,
|
state.lockAlias.value,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: state.isOpenPassageMode.value == 1
|
color: state.isOpenPassageMode.value == 1
|
||||||
? AppColors.openPassageModeColor
|
? AppColors.openPassageModeColor
|
||||||
: AppColors.darkGrayTextColor),
|
: AppColors.darkGrayTextColor),
|
||||||
))),
|
))),
|
||||||
Positioned(
|
Positioned(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// logic.getStarLockStatus();
|
// logic.getStarLockStatus();
|
||||||
showDeletAlertDialog(
|
showDeletAlertDialog(
|
||||||
context,
|
context,
|
||||||
DateTool().dateToYMDHNSString(state
|
DateTool().dateToYMDHNSString(state
|
||||||
.keyInfos.value.electricQuantityDate!
|
.keyInfos.value.electricQuantityDate!
|
||||||
.toString()));
|
.toString()));
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
showElectricIcon(
|
showElectricIcon(state.electricQuantity.value),
|
||||||
state.electricQuantity.value),
|
width: 30.w,
|
||||||
width: 30.w,
|
height: 24.w),
|
||||||
height: 24.w),
|
SizedBox(width: 2.w),
|
||||||
SizedBox(width: 2.w),
|
Text("${state.electricQuantity.value}%",
|
||||||
Text("${state.electricQuantity.value}%",
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 18.sp,
|
||||||
fontSize: 18.sp,
|
color: AppColors.darkGrayTextColor)),
|
||||||
color: AppColors.darkGrayTextColor)),
|
SizedBox(width: 2.w),
|
||||||
SizedBox(width: 2.w),
|
Icon(
|
||||||
Icon(
|
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
size: 25.w, // 设置图标大小为 30
|
||||||
size: 25.w, // 设置图标大小为 30
|
),
|
||||||
),
|
SizedBox(width: 20.w),
|
||||||
SizedBox(width: 20.w),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
children: [
|
||||||
children: [
|
Image.asset(showElectricIcon(state.electricQuantity.value),
|
||||||
Image.asset(
|
width: 30.w, height: 24.w),
|
||||||
showElectricIcon(state.electricQuantity.value),
|
SizedBox(width: 2.w),
|
||||||
width: 30.w,
|
Text("--%",
|
||||||
height: 24.w),
|
style: TextStyle(
|
||||||
SizedBox(width: 2.w),
|
fontSize: 18.sp,
|
||||||
Text("--%",
|
color: AppColors.darkGrayTextColor)),
|
||||||
style: TextStyle(
|
SizedBox(width: 2.w),
|
||||||
fontSize: 18.sp,
|
Icon(
|
||||||
color: AppColors.darkGrayTextColor)),
|
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||||
SizedBox(width: 2.w),
|
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||||
Icon(
|
size: 25.w, // 设置图标大小为 30
|
||||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
),
|
||||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
SizedBox(width: 20.w),
|
||||||
size: 25.w, // 设置图标大小为 30
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.w),
|
],
|
||||||
],
|
))
|
||||||
),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 30.h),
|
SizedBox(height: 30.h),
|
||||||
@ -293,36 +308,43 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: state.openDoorBtnisUneable.value == true ? () {
|
onTap: state.openDoorBtnisUneable.value == true
|
||||||
// Get.log("点击开锁");
|
? () {
|
||||||
setState(() {
|
// Get.log("点击开锁");
|
||||||
startOpenLock();
|
setState(() {
|
||||||
});
|
startOpenLock();
|
||||||
} : null,
|
});
|
||||||
onLongPressStart: state.openDoorBtnisUneable.value == true ? (details) {
|
}
|
||||||
Get.log("长按闭锁");
|
: null,
|
||||||
setState(() {
|
onLongPressStart: state.openDoorBtnisUneable.value == true
|
||||||
startUnLock();
|
? (details) {
|
||||||
});
|
Get.log("长按闭锁");
|
||||||
// startUnLock();
|
setState(() {
|
||||||
}:null,
|
startUnLock();
|
||||||
|
});
|
||||||
|
// startUnLock();
|
||||||
|
}
|
||||||
|
: null,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
state.openDoorBtnisUneable.value == false ? 'images/main/icon_main_openLockBtn_grey.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_normallyOpenMode_center.png'
|
||||||
: 'images/main/icon_main_openLockBtn_center.png'),
|
: 'images/main/icon_main_openLockBtn_center.png'),
|
||||||
width: 330.w,
|
width: 330.w,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
),
|
),
|
||||||
state.openDoorBtnisUneable.value == false ? Positioned(
|
state.openDoorBtnisUneable.value == false
|
||||||
child: Image.asset(
|
? Positioned(
|
||||||
'images/main/icon_main_openLockBtn_grey.png',
|
child: Image.asset(
|
||||||
width: 330.w,
|
'images/main/icon_main_openLockBtn_grey.png',
|
||||||
height: 330.w,
|
width: 330.w,
|
||||||
),
|
height: 330.w,
|
||||||
) :
|
),
|
||||||
state.openLockBtnState.value == 1
|
)
|
||||||
|
: state.openLockBtnState.value == 1
|
||||||
? buildRotationTransition()
|
? buildRotationTransition()
|
||||||
: Positioned(
|
: Positioned(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -332,8 +354,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
width: 330.w,
|
width: 330.w,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -361,10 +383,10 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
logic.getKeyStatusTextAndShow(),
|
logic.getKeyStatusTextAndShow(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
color: AppColors.btnDisableColor,
|
color: AppColors.btnDisableColor,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -543,7 +565,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_clockingIn.png',
|
'images/main/icon_main_clockingIn.png',
|
||||||
TranslationLoader.lanKeys!.checkingIn!.tr,
|
TranslationLoader.lanKeys!.checkingIn!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.checkingInListPage,
|
Get.toNamed(Routers.checkingInListPage,
|
||||||
arguments: state.keyInfos.value);
|
arguments: state.keyInfos.value);
|
||||||
}));
|
}));
|
||||||
@ -552,14 +575,18 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_operatingRecord.png',
|
'images/main/icon_main_operatingRecord.png',
|
||||||
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.lockOperatingRecordPage,
|
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: {"keyInfo": state.keyInfos.value});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置
|
// 设置
|
||||||
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
showWidgetArr.add(bottomItem(
|
||||||
TranslationLoader.lanKeys!.set!.tr, state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
'images/main/icon_main_set.png',
|
||||||
|
TranslationLoader.lanKeys!.set!.tr,
|
||||||
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData
|
"isOnlyOneData": state.isOnlyOneData
|
||||||
@ -577,7 +604,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_clockingIn.png',
|
'images/main/icon_main_clockingIn.png',
|
||||||
TranslationLoader.lanKeys!.checkingIn!.tr,
|
TranslationLoader.lanKeys!.checkingIn!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.checkingInListPage,
|
Get.toNamed(Routers.checkingInListPage,
|
||||||
arguments: state.keyInfos.value);
|
arguments: state.keyInfos.value);
|
||||||
}));
|
}));
|
||||||
@ -587,7 +615,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_electronicKey.png',
|
'images/main/icon_main_electronicKey.png',
|
||||||
TranslationLoader.lanKeys!.electronicKey!.tr,
|
TranslationLoader.lanKeys!.electronicKey!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.electronicKeyListPage,
|
Get.toNamed(Routers.electronicKeyListPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: {"keyInfo": state.keyInfos.value});
|
||||||
}));
|
}));
|
||||||
@ -596,7 +625,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_password.png',
|
'images/main/icon_main_password.png',
|
||||||
TranslationLoader.lanKeys!.password!.tr,
|
TranslationLoader.lanKeys!.password!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.passwordKeyListPage,
|
Get.toNamed(Routers.passwordKeyListPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: {"keyInfo": state.keyInfos.value});
|
||||||
}));
|
}));
|
||||||
@ -606,7 +636,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_icCard.png',
|
'images/main/icon_main_icCard.png',
|
||||||
TranslationLoader.lanKeys!.card!.tr,
|
TranslationLoader.lanKeys!.card!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
// logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () {
|
// logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () {
|
||||||
// logic.showEasyLoading();
|
// logic.showEasyLoading();
|
||||||
// });
|
// });
|
||||||
@ -621,7 +652,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_fingerprint.png',
|
'images/main/icon_main_fingerprint.png',
|
||||||
TranslationLoader.lanKeys!.fingerprint!.tr,
|
TranslationLoader.lanKeys!.fingerprint!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.fingerprintListPage, arguments: {
|
Get.toNamed(Routers.fingerprintListPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
});
|
});
|
||||||
@ -633,7 +665,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_remoteControl.png',
|
'images/main/icon_main_remoteControl.png',
|
||||||
TranslationLoader.lanKeys!.remoteControl!.tr,
|
TranslationLoader.lanKeys!.remoteControl!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.remoteControlListPage);
|
Get.toNamed(Routers.remoteControlListPage);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -644,7 +677,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_face.png',
|
'images/main/icon_face.png',
|
||||||
TranslationLoader.lanKeys!.humanFace!.tr,
|
TranslationLoader.lanKeys!.humanFace!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.faceList, arguments: {
|
Get.toNamed(Routers.faceList, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
}); // Toast.show(msg: "功能暂未开放");
|
}); // Toast.show(msg: "功能暂未开放");
|
||||||
@ -658,7 +692,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_catEyes.png',
|
'images/main/icon_catEyes.png',
|
||||||
TranslationLoader.lanKeys!.monitoring!.tr,
|
TranslationLoader.lanKeys!.monitoring!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
||||||
"lockName": state.keyInfos.value.lockName,
|
"lockName": state.keyInfos.value.lockName,
|
||||||
"isMonitoring": true
|
"isMonitoring": true
|
||||||
@ -672,7 +707,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem(
|
||||||
'images/main/icon_main_authorizedAdmin.png',
|
'images/main/icon_main_authorizedAdmin.png',
|
||||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.authorizedAdminListPage,
|
Get.toNamed(Routers.authorizedAdminListPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: {"keyInfo": state.keyInfos.value});
|
||||||
}));
|
}));
|
||||||
@ -687,7 +723,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_main_operatingRecord.png',
|
'images/main/icon_main_operatingRecord.png',
|
||||||
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
// Get.toNamed(Routers.lockOperatingRecordPage,
|
// Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
// arguments: {"keyInfo": state.keyInfos.value});
|
// arguments: {"keyInfo": state.keyInfos.value});
|
||||||
Get.toNamed(Routers.doorLockLogPage,
|
Get.toNamed(Routers.doorLockLogPage,
|
||||||
@ -697,7 +734,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_lockDetail_videoLog.png',
|
'images/main/icon_lockDetail_videoLog.png',
|
||||||
TranslationLoader.lanKeys!.videoLog!.tr,
|
TranslationLoader.lanKeys!.videoLog!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
//视频日志
|
//视频日志
|
||||||
Get.toNamed(Routers.videoLogPage);
|
Get.toNamed(Routers.videoLogPage);
|
||||||
}),
|
}),
|
||||||
@ -705,11 +743,16 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_lockDetail_messageReminding.png',
|
'images/main/icon_lockDetail_messageReminding.png',
|
||||||
TranslationLoader.lanKeys!.messageReminding!.tr,
|
TranslationLoader.lanKeys!.messageReminding!.tr,
|
||||||
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.msgNotificationPage);
|
Get.toNamed(Routers.msgNotificationPage);
|
||||||
}),
|
}),
|
||||||
// 设置
|
// 设置
|
||||||
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
|
bottomItem(
|
||||||
|
'images/main/icon_main_set.png',
|
||||||
|
TranslationLoader.lanKeys!.set!.tr,
|
||||||
|
state.openDoorBtnisUneable.value,
|
||||||
|
state.bottomBtnisEable.value, () {
|
||||||
// logic.clickItemBtnAction(10);
|
// logic.clickItemBtnAction(10);
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
@ -722,13 +765,18 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, bool bottomBtnisEable, Function() onClick) {
|
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
|
||||||
|
bool bottomBtnisEable, Function() onClick) {
|
||||||
var width = 42.w;
|
var width = 42.w;
|
||||||
var height = 42.h;
|
var height = 42.h;
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap:openDoorBtnisUneable ? (bottomBtnisEable ? onClick : () {
|
onTap: openDoorBtnisUneable
|
||||||
logic.showToast("请在锁旁边完成第一次开锁");
|
? (bottomBtnisEable
|
||||||
}) : null,
|
? onClick
|
||||||
|
: () {
|
||||||
|
logic.showToast("请在锁旁边完成第一次开锁");
|
||||||
|
})
|
||||||
|
: null,
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 300.h,
|
// height: 300.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -741,9 +789,11 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
child: Image.asset(iconUrl,
|
child: Image.asset(iconUrl,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
color: openDoorBtnisUneable ? (bottomBtnisEable
|
color: openDoorBtnisUneable
|
||||||
? AppColors.mainColor
|
? (bottomBtnisEable
|
||||||
: AppColors.lockDetailBottomBtnUneable) : AppColors.lockDetailBottomBtnUneable,
|
? AppColors.mainColor
|
||||||
|
: AppColors.lockDetailBottomBtnUneable)
|
||||||
|
: AppColors.lockDetailBottomBtnUneable,
|
||||||
fit: BoxFit.fitWidth),
|
fit: BoxFit.fitWidth),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: 10.w),
|
||||||
@ -751,9 +801,11 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
child: Text(name,
|
child: Text(name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20.sp,
|
fontSize: 20.sp,
|
||||||
color:openDoorBtnisUneable ? (bottomBtnisEable
|
color: openDoorBtnisUneable
|
||||||
? AppColors.blackColor
|
? (bottomBtnisEable
|
||||||
: AppColors.lockDetailBottomBtnUneable) : AppColors.lockDetailBottomBtnUneable),
|
? AppColors.blackColor
|
||||||
|
: AppColors.lockDetailBottomBtnUneable)
|
||||||
|
: AppColors.lockDetailBottomBtnUneable),
|
||||||
textAlign: TextAlign.center))
|
textAlign: TextAlign.center))
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -762,7 +814,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
|
|
||||||
listeningAnimations() async {
|
listeningAnimations() async {
|
||||||
await Future.delayed(Duration.zero, () {
|
await Future.delayed(Duration.zero, () {
|
||||||
state.animationController = AnimationController(duration: const Duration(seconds: 1), vsync: this);
|
state.animationController = AnimationController(
|
||||||
|
duration: const Duration(seconds: 1), vsync: this);
|
||||||
state.animationController!.repeat();
|
state.animationController!.repeat();
|
||||||
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
||||||
state.animationController!.addStatusListener((status) {
|
state.animationController!.addStatusListener((status) {
|
||||||
@ -994,5 +1047,4 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
// state.animationController!.stop();
|
// state.animationController!.stop();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,6 +47,8 @@ class LockDetailState {
|
|||||||
final PageController pageController = PageController();
|
final PageController pageController = PageController();
|
||||||
var currentPage = 0.obs;
|
var currentPage = 0.obs;
|
||||||
|
|
||||||
|
late BuildContext widgetContext;
|
||||||
|
|
||||||
// LockDetailState() {
|
// LockDetailState() {
|
||||||
// Map map = Get.arguments;
|
// Map map = Get.arguments;
|
||||||
// lockCount = map["lockCount"];
|
// lockCount = map["lockCount"];
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -23,16 +22,34 @@ class MinePersonInfoPage extends StatefulWidget {
|
|||||||
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||||
|
with WidgetsBindingObserver {
|
||||||
final logic = Get.put(MinePersonInfoLogic());
|
final logic = Get.put(MinePersonInfoLogic());
|
||||||
final state = Get.find<MinePersonInfoLogic>().state;
|
final state = Get.find<MinePersonInfoLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addObserver(this); // 添加观察者
|
||||||
logic.getUserInfoRequest();
|
logic.getUserInfoRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
WidgetsBinding.instance.removeObserver(this); // 移除观察者
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当应用生命周期状态变化时调用
|
||||||
|
@override
|
||||||
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
|
super.didChangeAppLifecycleState(state);
|
||||||
|
if (state == AppLifecycleState.resumed) {
|
||||||
|
// 当应用从后台返回前台时检查相机权限
|
||||||
|
checkCameraPermission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -177,48 +194,28 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> requestCameraPermission() async {
|
Future<void> requestCameraPermission() async {
|
||||||
// 检查是否已经授予相机权限
|
var status = await Permission.camera.status;
|
||||||
PermissionStatus status = await Permission.camera.status;
|
|
||||||
|
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
// 如果权限已经被授予,执行您的相机操作
|
|
||||||
// 这里可以调用打开相机的方法或者跳转到相机页面等
|
|
||||||
selectCamera();
|
selectCamera();
|
||||||
} else {
|
} else {
|
||||||
// 如果权限尚未被授予,请求相机权限
|
|
||||||
// 此处会显示系统权限请求对话框
|
|
||||||
status = await Permission.camera.request();
|
status = await Permission.camera.request();
|
||||||
|
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
// 如果用户授予了相机权限,执行您的相机操作
|
|
||||||
selectCamera();
|
selectCamera();
|
||||||
} else {
|
} else {
|
||||||
// 如果用户拒绝了相机权限,您可以提供适当的提示
|
|
||||||
// 或者引导用户手动授予权限
|
|
||||||
showPermissionDeniedDialog();
|
showPermissionDeniedDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> requestPhotoPermission() async {
|
Future<void> requestPhotoPermission() async {
|
||||||
// 检查是否已经授予相机权限
|
var status = await Permission.photos.status;
|
||||||
PermissionStatus status = await Permission.photos.status;
|
|
||||||
|
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
// 如果权限已经被授予,执行您的相机操作
|
|
||||||
// 这里可以调用打开相机的方法或者跳转到相机页面等
|
|
||||||
selectImage();
|
selectImage();
|
||||||
} else {
|
} else {
|
||||||
// 如果权限尚未被授予,请求相机权限
|
|
||||||
// 此处会显示系统权限请求对话框
|
|
||||||
status = await Permission.photos.request();
|
status = await Permission.photos.request();
|
||||||
|
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
// 如果用户授予了相机权限,执行您的相机操作
|
|
||||||
selectImage();
|
selectImage();
|
||||||
} else {
|
} else {
|
||||||
// 如果用户拒绝了相机权限,您可以提供适当的提示
|
|
||||||
// 或者引导用户手动授予权限
|
|
||||||
showPermissionDeniedDialog();
|
showPermissionDeniedDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,8 +233,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('去设置'),
|
child: const Text('去设置'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
openAppSettings(); // 打开系统设置页面
|
|
||||||
Navigator.of(context).pop(); // 关闭对话框
|
Navigator.of(context).pop(); // 关闭对话框
|
||||||
|
openAppSettings(); // 打开系统设置页面
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -300,6 +297,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> checkCameraPermission() async {
|
||||||
|
var status = await Permission.camera.status;
|
||||||
|
if (status.isGranted) {
|
||||||
|
// 如果权限已经被授予,打开相机
|
||||||
|
} else if (status.isPermanentlyDenied || status.isDenied) {
|
||||||
|
// 如果权限被永久拒绝,显示对话框引导用户去设置页面
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> checkPhotosPermission() async {
|
||||||
|
var status = await Permission.photos.status;
|
||||||
|
if (status.isGranted) {
|
||||||
|
// 如果权限已经被授予,打开相机
|
||||||
|
} else if (status.isPermanentlyDenied || status.isDenied) {
|
||||||
|
// 如果权限被永久拒绝,显示对话框引导用户去设置页面
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// child: state.mineInfoData.value.headUrl != null
|
// child: state.mineInfoData.value.headUrl != null
|
||||||
// ? CachedNetworkImage(
|
// ? CachedNetworkImage(
|
||||||
// imageUrl: Uri.encodeFull(
|
// imageUrl: Uri.encodeFull(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user