1,完善循环逻辑处理
2,新增操作记录列表接口API
This commit is contained in:
parent
43d79320a5
commit
f6ef117fe7
@ -2,6 +2,7 @@ import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_pickers/pickers.dart';
|
||||
import 'package:flutter_pickers/style/default_style.dart';
|
||||
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -27,11 +28,15 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
late bool _isSendSuccess;
|
||||
late bool _isPermanent;
|
||||
late String _getPwdStr;
|
||||
String _selectEffectiveDate = ''; //生效时间
|
||||
String _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
late String cyclicModeStr;
|
||||
late String effectiveHourStr;
|
||||
late String failureHourStr;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,13 +48,21 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
super.initState();
|
||||
|
||||
_isSendSuccess = false;
|
||||
_isPermanent = false;
|
||||
DateTime dateTime = DateTime.now();
|
||||
_effectiveDateTime = dateTime;
|
||||
_failureDateTime = dateTime;
|
||||
_selectEffectiveDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
_selectFailureDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
if (int.parse(widget.type) == 4) {
|
||||
cyclicModeStr = '周末';
|
||||
|
||||
_selectEffectiveDate = formatDate(dateTime, [HH, ':', nn]); //默认为当前时间
|
||||
_selectFailureDate = formatDate(dateTime, [HH, ':', nn]); //默认为当前时间
|
||||
} else {
|
||||
_selectEffectiveDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
_selectFailureDate = formatDate(
|
||||
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间
|
||||
}
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
@ -103,6 +116,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
return Column(
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
_isPermanent == false ? keyTimeLimitWidget() : Container(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
@ -221,7 +235,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||
action: () {}),
|
||||
Container(height: 10.h),
|
||||
_isPermanent == true
|
||||
? Container(height: 10.h)
|
||||
: Container(height: 1.h),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -238,23 +254,68 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
rightTitle: "周末",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
List<String> pickerDataList = [
|
||||
'周末',
|
||||
'每日',
|
||||
'工作日',
|
||||
'星期一',
|
||||
'星期二',
|
||||
'星期三',
|
||||
'星期四',
|
||||
'星期五',
|
||||
'星期六',
|
||||
'星期日'
|
||||
];
|
||||
showPickerView(context, pickerDataList);
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: "10:00",
|
||||
rightTitle: _selectEffectiveDate,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_effectiveDateTime = DateTime.parse(
|
||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
||||
_selectEffectiveDate =
|
||||
formatDate(_effectiveDateTime, [HH, ':', nn]);
|
||||
});
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: "11:00",
|
||||
rightTitle: _selectFailureDate,
|
||||
isHaveDirection: true,
|
||||
action: () {}),
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_failureDateTime = DateTime.parse(
|
||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
||||
_selectFailureDate =
|
||||
formatDate(_effectiveDateTime, [HH, ':', nn]);
|
||||
});
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//底部选择pickerView
|
||||
showPickerView(BuildContext context, List dataList) {
|
||||
Pickers.showSinglePicker(context,
|
||||
data: dataList,
|
||||
pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) {
|
||||
setState(() {});
|
||||
}, onChanged: (p, position) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
Widget keyBottomWidget(String tipStr) {
|
||||
return Column(
|
||||
children: [
|
||||
@ -453,15 +514,14 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
}
|
||||
|
||||
CupertinoSwitch _switch() {
|
||||
bool _isOn = false;
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: _isOn,
|
||||
value: _isPermanent,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_isOn = value;
|
||||
_isPermanent = value;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@ -26,4 +26,5 @@ abstract class Api {
|
||||
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
||||
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||
final String lockRecordsListURL = '/lockRecords/list'; //操作记录列表
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user