Merge branch 'master_hyx'

This commit is contained in:
anfe 2024-05-04 13:37:21 +08:00
commit 529ada69e4
25 changed files with 870 additions and 532 deletions

View File

@ -8,6 +8,7 @@ import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/storage.dart';
@ -28,7 +29,8 @@ class AuthorizedAdminPage extends StatefulWidget {
State<AuthorizedAdminPage> createState() => _AuthorizedAdminPageState();
}
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTickerProviderStateMixin {
class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
with SingleTickerProviderStateMixin {
final logic = Get.put(AuthorizedAdminLogic());
final state = Get.find<AuthorizedAdminLogic>().state;
@ -37,10 +39,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
// TODO: implement initState
super.initState();
state.tabController = TabController(
vsync: this,
length: _itemTabs.length,
initialIndex: 0);
state.tabController =
TabController(vsync: this, length: _itemTabs.length, initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
state.seletType.value = state.tabController.index;
@ -96,7 +96,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
children: [
keyInfoWidget(),
keyRealNameWidget(),
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
keyBottomWidget(
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
],
),
);
@ -159,7 +160,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.beginDate.value = DateTool().getYMDHNDateString(p, 1);
});
@ -170,8 +174,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
rightTitle: state.endDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.endDate.value = DateTool().getYMDHNDateString(p, 1);
});
@ -194,14 +200,18 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
tipsImgAction: () {
ShowTipView().showSureAlertDialog("授权管理员只能查看和管理自己下发的钥匙、密码等权限");
},
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _onlyManageYouCreatesUserSwitch())),
rightWidget: SizedBox(
width: 60.w,
height: 50.h,
child: _onlyManageYouCreatesUserSwitch())),
Container(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
rightTitle: "",
isTipsImg: true,
tipsImgAction: () {
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。");
ShowTipView().showSureAlertDialog(
"人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。");
},
isHaveRightWidget: true,
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
@ -327,8 +337,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
Get.toNamed(Routers.sendEmailNotificationPage);
} else {
// _openModalBottomSheet();
NativeInteractionTool().loadNativeShare(
shareText: state.pwdShareStr);
NativeInteractionTool()
.loadNativeShare(shareText: state.pwdShareStr);
}
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
},
@ -340,7 +350,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
btnName: '微信通知',
onClick: () {
// _openModalBottomSheet();
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
NativeInteractionTool()
.loadNativeShare(shareText: state.pwdShareStr);
},
),
SizedBox(
@ -472,7 +483,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
value: state.onlyManageYouCreatesUser.value,
onChanged: (value) {
setState(() {
state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
state.onlyManageYouCreatesUser.value =
!state.onlyManageYouCreatesUser.value;
});
},
);
@ -594,7 +606,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
return TabBar(
controller: state.tabController,
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
onTap: (index){
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
isScrollable: true,
@ -635,9 +647,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> with SingleTi
Widget _pageWidget() {
return Expanded(
child: TabBarView(
controller: state.tabController,
children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
),
controller: state.tabController,
children: _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList()),
);
}

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
// import 'package:flutter_pickers/pickers.dart';
// import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -12,6 +13,7 @@ import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../tools/commonItem.dart';
@ -169,8 +171,9 @@ class _VolumeAuthorizationLockPageState
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(_effectiveDateTime);
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
_selectEffectiveDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
@ -183,8 +186,9 @@ class _VolumeAuthorizationLockPageState
rightTitle: _selectFailureDate,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(_failureDateTime);
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
_selectFailureDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
@ -270,10 +274,18 @@ class _VolumeAuthorizationLockPageState
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
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)),
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),
),
// decoration: InputDecoration(
@ -333,22 +345,22 @@ class _VolumeAuthorizationLockPageState
_effectiveDateTime.millisecondsSinceEpoch.toString();
}
var entity = await ApiRepository.to.addAuthorizedAdmin(
createUser:_isCreateUser ? "1" : "0",
endDate:getFailureDateTime,
isRemoteUnlock:_isRemoteUnlock == true ? '1' : '2',
keyGroupIdList:[],
lockIdList:_lockIdList,
name:_keyNameController.text,
startDate:getEffectiveDateTime,
userid:_emailOrPhoneController.text,
countryCode:countryCode,
usernameType:'1',
createUser: _isCreateUser ? "1" : "0",
endDate: getFailureDateTime,
isRemoteUnlock: _isRemoteUnlock == true ? '1' : '2',
keyGroupIdList: [],
lockIdList: _lockIdList,
name: _keyNameController.text,
startDate: getEffectiveDateTime,
userid: _emailOrPhoneController.text,
countryCode: countryCode,
usernameType: '1',
);
if (entity.errorCode!.codeIsSuccessful) {
_isSendSuccess = true;
setState(() {});
} else {
EasyLoading.showToast('${entity.errorMsg}',duration: 2000.milliseconds);
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
if (entity.errorCode == 425) {
//
_isCreateUser = true;

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -6,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -25,7 +25,8 @@ class AddCardPage extends StatefulWidget {
State<AddCardPage> createState() => _AddCardPageState();
}
class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStateMixin {
class _AddCardPageState extends State<AddCardPage>
with SingleTickerProviderStateMixin {
final logic = Get.put(AddCardTypeLogic());
final state = Get.find<AddCardTypeLogic>().state;
@ -36,7 +37,9 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
state.tabController = TabController(
vsync: this,
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
length: state.fromType.value == 1
? _itemTabs.length
: _fromCheckInTypeItemTabs.length,
initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -48,14 +51,14 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}",
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
@ -148,9 +151,12 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
isHaveLine: true,
isHaveDirection: true,
action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
PDuration selectDate = PDuration.parse(
DateTime.parse(state.timeLimitBeginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitBeginTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Obx(() => CommonItem(
@ -158,9 +164,12 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitEndTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Container(height: 10.h),
@ -174,11 +183,13 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
rightTitle:
"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
var result =
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
@ -201,13 +212,14 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
@ -220,16 +232,18 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
rightTitle:
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
@ -250,7 +264,8 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
rightTitle: "",
isTipsImg: false,
isHaveRightWidget: true,
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
SizedBox(height: 10.h),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
@ -260,14 +275,13 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
rightWidget: SizedBox(
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
Container(
color: Colors.white,
padding: EdgeInsets.only(left:20.w, right: 20.w, bottom: 20.h),
child: Text(
"${"当被胁迫要求强行开锁时,使用胁迫卡会触发报警,报警信息回推送给管理员,该功能需要锁联网。".tr}\n${"请不要将胁迫卡用于日常开锁".tr}",
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
)
),
color: Colors.white,
padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h),
child: Text(
"${"当被胁迫要求强行开锁时,使用胁迫卡会触发报警,报警信息回推送给管理员,该功能需要锁联网。".tr}\n${"请不要将胁迫卡用于日常开锁".tr}",
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
)),
SizedBox(height: 30.h),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.next!.tr,
@ -368,13 +382,14 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
);
}
final List<ItemView> _itemTabs = <ItemView>[
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
ItemView(
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
@ -385,7 +400,11 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: state.fromType.value == 1
? _itemTabs.map((ItemView item) => _tab(item)).toList()
: _fromCheckInTypeItemTabs
.map((ItemView item) => _tab(item))
.toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -417,14 +436,16 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
return Expanded(
child: TabBarView(
controller: state.tabController,
children:
state.fromType.value == 1
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
children: state.fromType.value == 1
? _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList()
: _fromCheckInTypeItemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList(),
),
);
}
}
class ItemView {
@ -433,4 +454,3 @@ class ItemView {
final String title;
final String selectType;
}

View File

@ -1,4 +1,3 @@
import 'dart:ffi';
import 'package:flutter/material.dart';
@ -7,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/appRouteObserver.dart';
@ -24,7 +24,8 @@ class OtherTypeKeyChangeDatePage extends StatefulWidget {
_OtherTypeKeyChangeDatePageState();
}
class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage> with RouteAware {
class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
with RouteAware {
final logic = Get.put(OtherTypeKeyChangeDateLogic());
final state = Get.find<OtherTypeKeyChangeDateLogic>().state;
@ -44,14 +45,20 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 1);
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 1);
if (state.beginTimeTimestamp.value > state.endTimeTimestamp.value || state.beginTimeTimestamp.value == state.endTimeTimestamp.value) {
state.beginTimeTimestamp.value =
DateTool().dateToTimestamp(state.beginTime.value, 1);
state.endTimeTimestamp.value =
DateTool().dateToTimestamp(state.endTime.value, 1);
if (state.beginTimeTimestamp.value >
state.endTimeTimestamp.value ||
state.beginTimeTimestamp.value ==
state.endTimeTimestamp.value) {
logic.showToast("失效时间需大于生效时间".tr);
return;
}
if (state.endTimeTimestamp.value < DateTime.now().millisecondsSinceEpoch) {
if (state.endTimeTimestamp.value <
DateTime.now().millisecondsSinceEpoch) {
logic.showToast("生效时间需大于当前时间".tr);
return;
}
@ -92,8 +99,10 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
@ -104,8 +113,10 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
@ -165,5 +176,4 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0;
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
@ -20,7 +21,8 @@ class OtherTypeKeyChangeValidityDatePage extends StatefulWidget {
_OtherTypeKeyChangeValidityDatePageState();
}
class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeValidityDatePage> {
class _OtherTypeKeyChangeValidityDatePageState
extends State<OtherTypeKeyChangeValidityDatePage> {
final logic = Get.put(OtherTypeKeyChangeValidityDateLogic());
final state = Get.find<OtherTypeKeyChangeValidityDateLogic>().state;
@ -44,17 +46,23 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr,
onClick: () {
state.starDateTimestamp.value = DateTool().dateToTimestamp(state.starDate.value, 1);
state.endDateTimestamp.value = DateTool().dateToTimestamp(state.endDate.value, 1);
state.starTimeTimestamp.value = DateTool().dateToTimestamp(state.starTime.value, 0);
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 0);
state.starDateTimestamp.value =
DateTool().dateToTimestamp(state.starDate.value, 1);
state.endDateTimestamp.value =
DateTool().dateToTimestamp(state.endDate.value, 1);
state.starTimeTimestamp.value =
DateTool().dateToTimestamp(state.starTime.value, 0);
state.endTimeTimestamp.value =
DateTool().dateToTimestamp(state.endTime.value, 0);
if (state.starDateTimestamp.value >= state.endDateTimestamp.value) {
if (state.starDateTimestamp.value >=
state.endDateTimestamp.value) {
logic.showToast("失效日期要大于生效日期".tr);
return;
}
if (state.starTimeTimestamp.value >= state.endTimeTimestamp.value) {
if (state.starTimeTimestamp.value >=
state.endTimeTimestamp.value) {
logic.showToast("失效时间要大于生效时间".tr);
return;
}
@ -98,20 +106,27 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD,
onConfirm: (p) {
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.starDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMD, onConfirm: (p) {
state.starDate.value =
DateTool().getYMDHNDateString(p, 2);
});
})),
Obx(() => CommonItem(
leftTitel: "失效日期".tr,
rightTitle: state.endDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD,
onConfirm: (p) {
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMD, onConfirm: (p) {
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
});
})),
Container(height: 10.h),
],
@ -135,7 +150,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
padding: EdgeInsets.only(left: 30.w, top: 15.h),
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
style:
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
Container(
height: 100.h,
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
@ -230,10 +245,13 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.starTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
state.starTime.value =
DateTool().getYMDHNDateString(p, 3);
});
});
})),
@ -243,10 +261,13 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
state.endTime.value =
DateTool().getYMDHNDateString(p, 3);
});
});
})),

View File

@ -4,6 +4,7 @@ import 'package:get/get.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
@ -46,11 +47,14 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.beginTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.beginTime.value = DateTool().getYMDHNDateString(p, 3);
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 0).toString();
state.beginTimeTimestamp.value = DateTool()
.dateToTimestamp(state.beginTime.value, 0)
.toString();
});
});
})),
@ -59,11 +63,14 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 0).toString();
state.endTimeTimestamp.value = DateTool()
.dateToTimestamp(state.endTime.value, 0)
.toString();
});
});
})),
@ -87,7 +94,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
return;
}
if (int.parse(state.beginTimeTimestamp.value) >= int.parse(state.endTimeTimestamp.value)) {
if (int.parse(state.beginTimeTimestamp.value) >=
int.parse(state.endTimeTimestamp.value)) {
logic.showToast("结束时间必须要比开始时间晚,请重新选择");
return;
}

View File

@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
@ -59,27 +60,30 @@ class _ElectronicKeyDetailChangeDateState
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
});
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
});
})),
],
);
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
@ -20,7 +21,8 @@ class ElectronicKeyPeriodValidityPage extends StatefulWidget {
_ElectronicKeyPeriodValidityPageState();
}
class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodValidityPage> {
class _ElectronicKeyPeriodValidityPageState
extends State<ElectronicKeyPeriodValidityPage> {
final logic = Get.put(ElectronicKeyPeriodValidityLogic());
final state = Get.find<ElectronicKeyPeriodValidityLogic>().state;
@ -46,9 +48,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
onClick: () {
if (state.pushType.value == 0) {
logic.updateKeyDateRequest();
} else if (state.pushType.value == 1) {
}
} else if (state.pushType.value == 1) {}
}),
),
],
@ -68,20 +68,27 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD,
onConfirm: (p) {
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMD, onConfirm: (p) {
state.starDate.value =
DateTool().getYMDHNDateString(p, 2);
});
})),
Obx(() => CommonItem(
leftTitel: "失效日期".tr,
rightTitle: state.endDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD,
onConfirm: (p) {
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMD, onConfirm: (p) {
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
});
})),
Container(height: 10.h),
],
@ -105,7 +112,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
padding: EdgeInsets.only(left: 30.w, top: 15.h),
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
style:
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
Container(
height: 100.h,
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
@ -163,18 +170,18 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
});
},
child: Obx(() => Container(
width: 40.w,
height: 40.w,
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
color: state.weekDay.value.contains(index)
? AppColors.mainColor
: Colors.white,
border: Border.all(width: 1, color: AppColors.btnDisableColor),
borderRadius: BorderRadius.circular(30.w),
),
child: Center(
child: Text(
width: 40.w,
height: 40.w,
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
color: state.weekDay.value.contains(index)
? AppColors.mainColor
: Colors.white,
border: Border.all(width: 1, color: AppColors.btnDisableColor),
borderRadius: BorderRadius.circular(30.w),
),
child: Center(
child: Text(
dateStr,
style: TextStyle(
fontSize: 20.sp,
@ -182,7 +189,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
? Colors.white
: AppColors.darkGrayTextColor),
)),
)),
)),
);
}
@ -195,30 +202,36 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
children: [
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
"${TranslationLoader.lanKeys!.begin!.tr}${TranslationLoader.lanKeys!.time!.tr}",
rightTitle: state.starTime.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
setState(() {
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
});
});
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.starTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.starTime.value =
DateTool().getYMDHNDateString(p, 3);
});
});
})),
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.end!.tr}${TranslationLoader.lanKeys!.time!.tr}",
"${TranslationLoader.lanKeys!.end!.tr}${TranslationLoader.lanKeys!.time!.tr}",
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
setState(() {
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
});
});
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.endTime.value =
DateTool().getYMDHNDateString(p, 3);
});
});
})),
Container(height: 10.h),
],

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -6,6 +5,7 @@ import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../../../tools/commonItem.dart';
import '../../../../../../tools/submitBtn.dart';
@ -48,7 +48,9 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
state.type.value = widget.type;
return SingleChildScrollView(
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
child: state.isDemoMode
? indexChangeWidget()
: Obx(() => indexChangeWidget()),
);
}
@ -178,7 +180,8 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
var result = await Navigator.pushNamed(
@ -223,20 +226,24 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
Container(height: 10.h),
],
@ -268,15 +275,15 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
var result =
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate'];
state.endTime.value = result['endDate'];
@ -300,40 +307,41 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate'];
state.endTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
}
})
)),
}))),
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate'];
state.endTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
Get.back(result: result);
}
}),
)),
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle:
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(
Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate'];
state.endTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
Get.back(result: result);
}
}),
)),
Container(height: 10.h),
],
);
@ -364,5 +372,4 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
},
);
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -11,6 +10,7 @@ import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/storage.dart';
@ -31,7 +31,8 @@ class SendElectronicKeyPage extends StatefulWidget {
State<SendElectronicKeyPage> createState() => _SendElectronicKeyPageState();
}
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with SingleTickerProviderStateMixin {
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
with SingleTickerProviderStateMixin {
final logic = Get.put(SendElectronicKeyLogic());
final state = Get.find<SendElectronicKeyLogic>().state;
@ -46,10 +47,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
getDemoMode();
state.tabController = TabController(
vsync: this,
length: _itemTabs.length,
initialIndex: 0);
state.tabController =
TabController(vsync: this, length: _itemTabs.length, initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
state.seletType.value = state.tabController.index;
@ -203,9 +202,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
PDuration selectDate = PDuration.parse(
DateTime.parse(state.timeLimitBeginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitBeginTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Obx(() => CommonItem(
@ -213,9 +215,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitEndTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Container(height: 10.h),
@ -232,7 +237,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
rightTitle: "",
isTipsImg: true,
tipsImgAction: () {
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。".tr);
ShowTipView().showSureAlertDialog(
"人脸实名认证指的是用户在使用手机APP开锁时需要先进行本人人脸验证验证通过才能开锁。".tr);
},
isHaveRightWidget: true,
rightWidget: SizedBox(
@ -250,19 +256,20 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle: "${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
rightTitle:
"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
var result =
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
state.cycleEndTime.value = result['endDate'];
@ -286,20 +293,20 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
}
})
)),
}))),
Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
rightTitle:
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
@ -310,15 +317,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if(result != null && result.isNotEmpty){
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime'];
}
})
)),
}))),
],
);
}
@ -568,7 +574,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
return Visibility(
visible: state.isDemoMode
? false
: (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 ? true : false),
: (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1
? true
: false),
child: Column(
children: [
CommonItem(
@ -647,7 +655,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
TabBar _tabBar() {
return TabBar(
controller: state.tabController,
onTap: (index){
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
@ -689,10 +697,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
Widget _pageWidget() {
return Expanded(
child: TabBarView(
controller: state.tabController,
children: _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
),
controller: state.tabController,
children: _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList()),
);
}

View File

@ -6,6 +6,7 @@ import 'package:get/get.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -24,7 +25,8 @@ class AddFaceTypePage extends StatefulWidget {
State<AddFaceTypePage> createState() => _AddFaceTypePageState();
}
class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProviderStateMixin {
class _AddFaceTypePageState extends State<AddFaceTypePage>
with SingleTickerProviderStateMixin {
final logic = Get.put(AddFaceTypeLogic());
final state = Get.find<AddFaceTypeLogic>().state;
@ -35,7 +37,9 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
state.tabController = TabController(
vsync: this,
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
length: state.fromType.value == 1
? _itemTabs.length
: _fromCheckInTypeItemTabs.length,
initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -54,7 +58,7 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
@ -147,20 +151,26 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
isHaveLine: true,
isHaveDirection: true,
action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
PDuration selectDate = PDuration.parse(
DateTime.parse(state.timeLimitBeginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitBeginTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitEndTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Container(height: 10.h),
],
@ -173,11 +183,13 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
rightTitle:
"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
var result =
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
@ -200,13 +212,14 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
@ -219,16 +232,18 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
rightTitle:
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
@ -337,13 +352,14 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
);
}
final List<ItemView> _itemTabs = <ItemView>[
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
ItemView(
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
@ -354,7 +370,11 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: state.fromType.value == 1
? _itemTabs.map((ItemView item) => _tab(item)).toList()
: _fromCheckInTypeItemTabs
.map((ItemView item) => _tab(item))
.toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -386,14 +406,16 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
return Expanded(
child: TabBarView(
controller: state.tabController,
children:
state.fromType.value == 1
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
children: state.fromType.value == 1
? _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList()
: _fromCheckInTypeItemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList(),
),
);
}
}
class ItemView {

View File

@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -148,7 +149,9 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
isHaveLine: true,
isHaveDirection: true,
action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitBeginTime.value));
Pickers.showDatePicker(context,selectDate:selectDate, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
@ -158,7 +161,9 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
Pickers.showDatePicker(context,selectDate:selectDate, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
});

View File

@ -7,6 +7,7 @@ import 'package:star_lock/main/lockDetail/iris/addIrisType/addIrisType_logic.dar
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -142,8 +143,10 @@ class _AddIrisTypePageState extends State<AddIrisTypePage> {
isHaveLine: true,
isHaveDirection: true,
action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
@ -152,8 +155,10 @@ class _AddIrisTypePageState extends State<AddIrisTypePage> {
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),

View File

@ -5,6 +5,7 @@ import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../../app_settings/app_colors.dart';
@ -228,7 +229,10 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
],
),
onTap: () {
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
PDuration selectDate = PDuration.parse(DateTime.tryParse(
isEndTime == false ? state.startDate.value : state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) {
if (isEndTime == false) {
state.startDate.value = DateTool().getYMDHNDateString(p, 3);
} else {

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -6,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
@ -23,7 +23,8 @@ class NormallyOpenModePage extends StatefulWidget {
State<NormallyOpenModePage> createState() => _NormallyOpenModePageState();
}
class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteAware{
class _NormallyOpenModePageState extends State<NormallyOpenModePage>
with RouteAware {
final logic = Get.put(NormallyOpenModeLogic());
final state = Get.find<NormallyOpenModeLogic>().state;
@ -112,13 +113,16 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
),
)),
Obx(() => Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
child: state.isJustForShow.value == true ? Container() :SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr,
onClick: () {
logic.sendAutoLock();
}),
)),
margin:
EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
child: state.isJustForShow.value == true
? Container()
: SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr,
onClick: () {
logic.sendAutoLock();
}),
)),
],
)));
}
@ -186,7 +190,7 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
}
return GestureDetector(
onTap: () {
if(state.isJustForShow.value == true){
if (state.isJustForShow.value == true) {
return;
}
@ -238,7 +242,7 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
rightWidget: GestureDetector(
onTap: () {
//
if(state.isJustForShow.value == true){
if (state.isJustForShow.value == true) {
return;
}
@ -281,12 +285,14 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
isHaveDirection: true,
isHaveLine: true,
action: () {
if(state.isJustForShow.value == true){
if (state.isJustForShow.value == true) {
return;
}
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(
DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.beginTimeMinute.value =
p.hour! * 60 + p.minute!;
@ -300,12 +306,14 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
if(state.isJustForShow.value == true){
if (state.isJustForShow.value == true) {
return;
}
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(
DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
setState(() {
state.endTimeMinute.value =
p.hour! * 60 + p.minute!;
@ -327,11 +335,13 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isOpenNormallyOpenMode.value,
onChanged: state.isJustForShow.value == true ? null : (value) {
setState(() {
state.isOpenNormallyOpenMode.value = value;
});
},
onChanged: state.isJustForShow.value == true
? null
: (value) {
setState(() {
state.isOpenNormallyOpenMode.value = value;
});
},
);
}
@ -385,5 +395,4 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> with RouteA
state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0;
}
}

View File

@ -7,6 +7,7 @@ import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmType_logic.dar
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -142,8 +143,10 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
isHaveLine: true,
isHaveDirection: true,
action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
@ -152,8 +155,10 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),

View File

@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
@ -21,7 +22,8 @@ class PasswordKeyDetailChangeDatePage extends StatefulWidget {
_PasswordKeyDetailChangeDatePage();
}
class _PasswordKeyDetailChangeDatePage extends State<PasswordKeyDetailChangeDatePage> with RouteAware {
class _PasswordKeyDetailChangeDatePage
extends State<PasswordKeyDetailChangeDatePage> with RouteAware {
final logic = Get.put(PasswordKeyDetailChangeDateLogic());
final state = Get.find<PasswordKeyDetailChangeDateLogic>().state;
@ -42,7 +44,7 @@ class _PasswordKeyDetailChangeDatePage extends State<PasswordKeyDetailChangeDate
),
onPressed: () {
// if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) {
logic.senderCustomPasswords();
logic.senderCustomPasswords();
// }
},
),
@ -59,27 +61,45 @@ class _PasswordKeyDetailChangeDatePage extends State<PasswordKeyDetailChangeDate
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
getStartDate = startDateStr.toLocal().toString().substring(0, 16);
}else{
} else {
// DateTime startDateStr =
// DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch);
// getStartDate = startDateStr.toLocal().toString().substring(0, 16);
getStartDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00"; //
getStartDate = "${formatDate(DateTime.now(), [
yyyy,
'-',
mm,
'-',
dd,
' ',
HH,
])}:00"; //生效时间
// state.selectEffectiveDate.value = getStartDate;
state.itemData.value.startDate = DateTime.parse(getStartDate).millisecondsSinceEpoch;
state.itemData.value.startDate =
DateTime.parse(getStartDate).millisecondsSinceEpoch;
}
if (state.itemData.value.endDate != 0) {
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
getEndDate = endDateStr.toLocal().toString().substring(0, 16);
}else{
} else {
// DateTime endDateStr =
// DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch);
// getEndDate = endDateStr.toLocal().toString().substring(0, 16);
getEndDate = "${formatDate(DateTime.now(), [yyyy, '-', mm, '-', dd, ' ', HH,])}:00"; //
state.itemData.value.endDate = DateTime.parse(getEndDate).millisecondsSinceEpoch;
getEndDate = "${formatDate(DateTime.now(), [
yyyy,
'-',
mm,
'-',
dd,
' ',
HH,
])}:00"; //失效时间
state.itemData.value.endDate =
DateTime.parse(getEndDate).millisecondsSinceEpoch;
}
return Column(
@ -92,10 +112,15 @@ class _PasswordKeyDetailChangeDatePage extends State<PasswordKeyDetailChangeDate
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) {
state.selectEffectiveDate.value = DateTool().getYMDHNDateString(p, 1);
PDuration selectDate = PDuration.parse(
DateTime.parse(state.selectEffectiveDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDH, onConfirm: (p) {
state.selectEffectiveDate.value =
DateTool().getYMDHNDateString(p, 1);
// state.effectiveDateTime = DateTime.parse(state.selectEffectiveDate.value);
state.itemData.value.startDate = DateTool().dateToTimestamp(state.selectEffectiveDate.value, 1); //
state.itemData.value.startDate = DateTool().dateToTimestamp(
state.selectEffectiveDate.value, 1); //
});
})),
Obx(() => CommonItem(
@ -105,9 +130,14 @@ class _PasswordKeyDetailChangeDatePage extends State<PasswordKeyDetailChangeDate
: getEndDate,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) {
state.selectFailureDate.value = DateTool().getYMDHNDateString(p, 1);
state.itemData.value.endDate = DateTool().dateToTimestamp(state.selectFailureDate.value, 1); //
PDuration selectDate = PDuration.parse(
DateTime.parse(state.selectFailureDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDH, onConfirm: (p) {
state.selectFailureDate.value =
DateTool().getYMDHNDateString(p, 1);
state.itemData.value.endDate = DateTool()
.dateToTimestamp(state.selectFailureDate.value, 1); //
});
})),
],

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -28,15 +27,15 @@ import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyPerpetualPage extends StatefulWidget {
const PasswordKeyPerpetualPage(
{Key? key}) : super(key: key);
const PasswordKeyPerpetualPage({Key? key}) : super(key: key);
@override
State<PasswordKeyPerpetualPage> createState() =>
_PasswordKeyPerpetualPageState();
}
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware, SingleTickerProviderStateMixin{
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
with RouteAware, SingleTickerProviderStateMixin {
final logic = Get.put(PasswordKeyPerpetualLogic());
final state = Get.find<PasswordKeyPerpetualLogic>().state;
@ -45,10 +44,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
// TODO: implement initState
super.initState();
state.tabController = TabController(
vsync: this,
length: _itemTabs.length,
initialIndex: 0);
state.tabController =
TabController(vsync: this, length: _itemTabs.length, initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
state.widgetType.value = state.tabController.index;
@ -78,7 +75,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
}
Widget indexChangeWidget() {
if (state.isSendSuccess.value == true && state.sendSucceedType.value == state.widgetType.value) {
if (state.isSendSuccess.value == true &&
state.sendSucceedType.value == state.widgetType.value) {
return sendElectronicKeySucceed();
} else {
switch (state.widgetType.value) {
@ -89,11 +87,13 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
child: Column(
children: [
perpetualKeyWidget(
false,
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget("密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。".tr)
keyBottomWidget(
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。"
.tr)
],
),
);
@ -110,7 +110,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget("密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。".tr)
keyBottomWidget(
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。"
.tr)
],
),
);
@ -126,7 +128,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
keyBottomWidget(
TranslationLoader.lanKeys!.getPasswordTip3!.tr)
],
),
);
@ -149,10 +152,11 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.password!.tr,
"请输入6-9位数字", state.pwdController
),
"请输入6-9位数字",
state.pwdController),
keyIfAdministratorWidget(),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
keyBottomWidget(
TranslationLoader.lanKeys!.getPasswordTip4!.tr)
],
),
);
@ -169,7 +173,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget("密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。".tr)
keyBottomWidget(
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。"
.tr)
],
),
);
@ -181,11 +187,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
child: Column(
children: [
perpetualKeyWidget(
false,
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget("密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。".tr)
keyBottomWidget(
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。".tr)
],
),
);
@ -197,8 +204,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
}
//
Widget perpetualKeyWidget(
bool isTopHeight, String titleStr, String rightTitle, TextEditingController controller) {
Widget perpetualKeyWidget(bool isTopHeight, String titleStr,
String rightTitle, TextEditingController controller) {
return Column(
children: [
isTopHeight ? SizedBox(height: 10.h) : Container(),
@ -217,19 +224,25 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
return Column(
children: [
Visibility(
visible: CommonDataManage().currentKeyInfo.vendor == "XHJ" ? false : true,
visible:
CommonDataManage().currentKeyInfo.vendor == "XHJ" ? false : true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(
context,
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
maxDate: PDuration(
year: DateTime.now().year + 3,
month: DateTime.now().month,
day: DateTime.now().day,
hour: 24),
// minDate: PDuration.now(),
mode: DateMode.YMDHM,
onConfirm: (p) {
mode: DateMode.YMDHM, onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
});
}),
@ -239,14 +252,21 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(
context,
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
// maxDate传入三年以后得今天的时间
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day),
minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
mode: DateMode.YMDH,
onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
maxDate: PDuration(
year: DateTime.now().year + 3,
month: DateTime.now().month,
day: DateTime.now().day),
minDate: PDuration(
year: DateTime.now().year,
month: DateTime.now().month,
day: DateTime.now().day),
mode: DateMode.YMDH, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
});
}),
Container(height: 10.h),
@ -264,28 +284,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(
context,
PDuration selectDate = PDuration.parse(
DateTime.tryParse(state.customBeginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
// maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
// minDate: PDuration.now(),
mode: DateMode.YMDHM,
onConfirm: (p) {
state.customBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
mode: DateMode.YMDHM, onConfirm: (p) {
state.customBeginTime.value =
DateTool().getYMDHNDateString(p, 1);
});
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.customEndTime.value,
isHaveDirection: true,
action: () {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.customEndTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
// maxDate传入三年以后得今天的时间
// maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day),
// minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
mode: DateMode.YMDHM,
onConfirm: (p) {
state.customEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
mode: DateMode.YMDHM, onConfirm: (p) {
state.customEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
}),
Container(height: 10.h),
],
@ -350,15 +374,26 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
showPickerView(context, pickerDataList);
}),
Visibility(
visible: (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) ? true : false,
visible: (CommonDataManage().currentKeyInfo.vendor ==
IoModelVendor.vendor_XL &&
(CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_BLE ||
CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_WIFI))
? true
: false,
child: CommonItem(
leftTitel: '结束日期',
rightTitle: state.endTime.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMDH, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
});
}),
),
@ -368,8 +403,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
state.loopEffectiveDate.value = DateTool().getYMDHNDateString(p, 5);
PDuration selectDate = PDuration.parse(
DateTool().dateToDateTime(state.loopEffectiveDate.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.H, onConfirm: (p) {
state.loopEffectiveDate.value =
DateTool().getYMDHNDateString(p, 5);
state.loopStartHours.value = p.hour!;
});
}),
@ -378,8 +417,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
rightTitle: state.loopFailureDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
state.loopFailureDate.value = DateTool().getYMDHNDateString(p, 5);
PDuration selectDate = PDuration.parse(
DateTool().dateToDateTime(state.loopFailureDate.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.H, onConfirm: (p) {
state.loopFailureDate.value =
DateTool().getYMDHNDateString(p, 5);
state.loopEndHours.value = p.hour!;
});
}),
@ -423,7 +466,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
height: 20.h,
),
SubmitBtn(
btnName: state.widgetType.value == 3 ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
btnName: state.widgetType.value == 3
? "设置密码"
: TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
@ -523,10 +568,14 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(editController == state.nameController ? 50 : 9),
LengthLimitingTextInputFormatter(
editController == state.nameController ? 50 : 9),
],
keyboardType: editController == state.nameController ? TextInputType.text: TextInputType.number,
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
keyboardType: editController == state.nameController
? TextInputType.text
: TextInputType.number,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: editController,
autofocus: false,
textAlign: TextAlign.end,
@ -543,10 +592,18 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
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)),
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),
),
),
@ -629,7 +686,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
TabBar _tabBar() {
return TabBar(
controller: state.tabController,
onTap: (index){
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
@ -672,7 +729,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
return Expanded(
child: TabBarView(
controller: state.tabController,
children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
children: _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList(),
),
);
}
@ -697,7 +756,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
return widgetList;
}
GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) {
GestureDetector buildCenter3(
String imageName, String titleStr, int itemIndex) {
return GestureDetector(
child: Container(
width: 120.w,
@ -735,13 +795,13 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
case 0:
//
{
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
}
break;
case 1:
//
{
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
}
break;
case 2:
@ -753,7 +813,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
case 3:
//
{
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
}
break;
default:

View File

@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -18,14 +19,14 @@ import '../../../../translations/trans_lib.dart';
import 'addRemoteControl_logic.dart';
class AddRemoteControlPage extends StatefulWidget {
const AddRemoteControlPage({Key? key})
: super(key: key);
const AddRemoteControlPage({Key? key}) : super(key: key);
@override
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
}
class _AddRemoteControlPageState extends State<AddRemoteControlPage> with SingleTickerProviderStateMixin {
class _AddRemoteControlPageState extends State<AddRemoteControlPage>
with SingleTickerProviderStateMixin {
final logic = Get.put(AddRemoteControlLoigc());
final state = Get.find<AddRemoteControlLoigc>().state;
@ -36,7 +37,9 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
state.tabController = TabController(
vsync: this,
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
length: state.fromType.value == 1
? _itemTabs.length
: _fromCheckInTypeItemTabs.length,
initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -55,7 +58,7 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
@ -145,20 +148,26 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
isHaveLine: true,
isHaveDirection: true,
action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
PDuration selectDate = PDuration.parse(
DateTime.parse(state.timeLimitBeginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitBeginTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
state.timeLimitEndTime.value =
DateTool().getYMDHNDateString(p, 1);
});
})),
Container(height: 10.h),
],
@ -171,11 +180,13 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
rightTitle:
"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
var result =
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
@ -198,13 +209,14 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
@ -217,16 +229,18 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem(
leftTitel: "有效时间".tr,
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
rightTitle:
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true,
action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: {
'validityValue': state.weekdaysList.value,
'starDate': state.cycleBeginTime.value,
'endDate': state.cycleEndTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.cycleBeginTime.value = result['starDate'];
@ -359,7 +373,8 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: state.nameController,
autofocus: false,
textAlign: TextAlign.end,
@ -368,10 +383,18 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
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)),
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),
),
),
@ -399,13 +422,14 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
);
}
final List<ItemView> _itemTabs = <ItemView>[
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
ItemView(
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
@ -416,7 +440,11 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: state.fromType.value == 1
? _itemTabs.map((ItemView item) => _tab(item)).toList()
: _fromCheckInTypeItemTabs
.map((ItemView item) => _tab(item))
.toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -448,14 +476,16 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> with Single
return Expanded(
child: TabBarView(
controller: state.tabController,
children:
state.fromType.value == 1
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
children: state.fromType.value == 1
? _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList()
: _fromCheckInTypeItemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.toList(),
),
);
}
}
class ItemView {

View File

@ -9,6 +9,7 @@ import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -19,7 +20,8 @@ import 'addAuthorizedAdministrator_logic.dart';
class AddAuthorizedAdministratorPage extends StatefulWidget {
String type;
AddAuthorizedAdministratorPage({Key? key, required this.type}) : super(key: key);
AddAuthorizedAdministratorPage({Key? key, required this.type})
: super(key: key);
@override
State<StatefulWidget> createState() {
@ -27,20 +29,24 @@ class AddAuthorizedAdministratorPage extends StatefulWidget {
}
}
class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministratorPage> with SingleTickerProviderStateMixin {
class _AddAuthorizedAdministratorPageState
extends State<AddAuthorizedAdministratorPage>
with SingleTickerProviderStateMixin {
final logic = Get.put(AddAuthorizedAdministratorLogic());
final state = Get.find<AddAuthorizedAdministratorLogic>().state;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
state.type.value = widget.type;
return Obx(() => SingleChildScrollView(child: widget.type == '0' ? _timeLimitAdministrator() : _permanentAdministrator()));
return Obx(() => SingleChildScrollView(
child: widget.type == '0'
? _timeLimitAdministrator()
: _permanentAdministrator()));
}
//
@ -191,7 +197,8 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: editController,
// autofocus: false,
textAlign: TextAlign.end,
@ -200,10 +207,18 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
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)),
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),
),
),
@ -268,7 +283,10 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.beginDate.value = DateTool().getYMDHNDateString(p, 1);
});
@ -279,8 +297,10 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
rightTitle: state.endDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
state.endDate.value = DateTool().getYMDHNDateString(p, 1);
});
@ -409,14 +429,14 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
),
OutLineBtn(
btnName:
state.emailOrPhoneController.text.contains("@") ? '邮件通知' : "短信通知",
state.emailOrPhoneController.text.contains("@") ? '邮件通知' : "短信通知",
onClick: () {
if (state.emailOrPhoneController.text.contains("@")) {
Get.toNamed(Routers.sendEmailNotificationPage);
} else {
// _openModalBottomSheet();
NativeInteractionTool().loadNativeShare(
shareText: state.pwdShareStr);
NativeInteractionTool()
.loadNativeShare(shareText: state.pwdShareStr);
}
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
},
@ -428,7 +448,8 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
btnName: '微信通知',
onClick: () {
// _openModalBottomSheet();
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
NativeInteractionTool()
.loadNativeShare(shareText: state.pwdShareStr);
},
),
SizedBox(
@ -462,7 +483,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
width: 120.w,
// height: 64.h,
margin:
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -491,25 +512,25 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
Get.back();
switch (itemIndex) {
case 0:
//
//
{
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
}
break;
case 1:
//
//
{
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
}
break;
case 2:
//
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
}
break;
case 3:
//
//
{
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
}
@ -517,5 +538,4 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
default:
}
}
}

View File

@ -8,6 +8,7 @@ import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
@ -69,8 +70,9 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(_effectiveDateTime);
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
_selectEffectiveDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
@ -83,8 +85,9 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
rightTitle: _selectFailureDate,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
PDuration selectDate = PDuration.parse(_failureDateTime);
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
setState(() {
_selectFailureDate =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
@ -105,8 +108,7 @@ class _AdminDetailChangeDatePage extends State<AdminDetailChangeDatePage> {
_effectiveDateTime.millisecondsSinceEpoch.toString(),
'');
if (entity.errorCode!.codeIsSuccessful) {
EasyLoading.showToast("修改成功",duration: 2000.milliseconds);
EasyLoading.showToast("修改成功", duration: 2000.milliseconds);
setState(() {
Navigator.pop(context);
});

View File

@ -122,6 +122,9 @@ class DateTool {
int timestamp = 0;
if (type == 0) {
List<String> timeParts = dateStr.split(":");
if (timeParts.length < 2) {
return 0;
}
DateTime now = DateTime.now();
DateTime dateTime = DateTime(now.year, now.month, now.day,
int.parse(timeParts[0]), int.parse(timeParts[1]));
@ -133,6 +136,17 @@ class DateTool {
return timestamp;
}
///
/// type 0: 12:00 1:
DateTime? dateToDateTime(String dateStr, int type) {
int timestamp = dateToTimestamp(dateStr, type);
if (timestamp == 0) {
return null;
} else {
return DateTime.fromMillisecondsSinceEpoch(timestamp);
}
}
/// (-- :)
String dateToYMDHNString(String? timestamp) {
timestamp ??= '0';

View File

@ -10,6 +10,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/pickers/time_picker/model/suffix.dart';
import 'package:star_lock/tools/pickers/time_picker/route/date_picker_route.dart';
// import 'package:flutter_pickers/address_picker/route/address_picker_route.dart';
// import 'package:flutter_pickers/more_pickers/init_data.dart';
// import 'package:flutter_pickers/more_pickers/route/multiple_link_picker_route.dart';
@ -165,7 +166,7 @@ class Pickers {
/// [Suffix] : Suffix(years: '',month: '');
/// [selectDate] :
/// PDuration.now();
/// PDuration.parse(DateTime.parse('20210139'));
/// PDuration.parse(DateTime.tryParse('20210139'));
/// PDuration(year: 2020,month: 2);
/// [maxDate] :
/// tip: item限制 maxDate>day = 3 minDate>day = 10,3-10
@ -173,7 +174,7 @@ class Pickers {
/// [mode] : 16 DateMode.YMD
static void showDatePicker(BuildContext context,
{DateMode mode: DateMode.YMD,
PDuration? selectDate,
required PDuration? selectDate,
PDuration? maxDate,
PDuration? minDate,
Suffix? suffix,

View File

@ -13,7 +13,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_type.dart';
/// AppLog.log('longer2 >>> ${m.toString()}');
/// {year: 2011, month: 0, day: 0, hour: 0, minute: 0, second: 0}
///
/// var d = PDuration.parse(DateTime.parse('20200304'));
/// var d = PDuration.parse(DateTime.tryParse('20200304'));
/// AppLog.log('longer3 >>> ${d.toString()}');
/// {year: 2020, month: 3, day: 4, hour: 0, minute: 0, second: 0}
@ -42,7 +42,8 @@ class PDuration {
this.second: 0});
// 0 null
PDuration.parse(DateTime dateTime) {
PDuration.parse(DateTime? dateTime) {
dateTime ??= DateTime.now();
this.year = dateTime.year;
this.month = dateTime.month;
this.day = dateTime.day;

View File

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import '../../app_settings/app_colors.dart';
import '../../translations/trans_lib.dart';
@ -43,19 +43,18 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
SizedBox(height: 10.h),
bottomWidget(),
Obx(() => Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr,
isDisabled:
(state.starDate.value.isNotEmpty &&
state.endDate.value.isNotEmpty &&
state.starTime.value.isNotEmpty &&
state.endTime.value.isNotEmpty &&
state.weekDay.value.isNotEmpty),
onClick: () {
logic.subBtnAction();
}),
)),
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr,
isDisabled: (state.starDate.value.isNotEmpty &&
state.endDate.value.isNotEmpty &&
state.starTime.value.isNotEmpty &&
state.endTime.value.isNotEmpty &&
state.weekDay.value.isNotEmpty),
onClick: () {
logic.subBtnAction();
}),
)),
],
));
}
@ -73,20 +72,27 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD,
onConfirm: (p) {
state.starDate.value = DateTool().getYMDHNDateString(p, 2);
});
PDuration selectDate = PDuration.parse(
DateTime.tryParse(state.starDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMD, onConfirm: (p) {
state.starDate.value =
DateTool().getYMDHNDateString(p, 2);
});
})),
Obx(() => CommonItem(
leftTitel: "失效日期".tr,
rightTitle: state.endDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD,
onConfirm: (p) {
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
});
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endDate.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMD, onConfirm: (p) {
state.endDate.value = DateTool().getYMDHNDateString(p, 2);
});
})),
Container(height: 10.h),
],
@ -110,12 +116,13 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
padding: EdgeInsets.only(left: 30.w, top: 15.h),
child: Text(TranslationLoader.lanKeys!.effectiveDay!.tr,
style:
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600))),
Container(
height: 100.h,
padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 10.h),
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 7, childAspectRatio: 1.0),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7, childAspectRatio: 1.0),
itemCount: 7,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
@ -167,18 +174,18 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
});
},
child: Obx(() => Container(
width: 40.w,
height: 40.w,
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
color: state.weekDay.value.contains(index)
? AppColors.mainColor
: Colors.white,
border: Border.all(width: 1, color: AppColors.btnDisableColor),
borderRadius: BorderRadius.circular(30.w),
),
child: Center(
child: Text(
width: 40.w,
height: 40.w,
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
color: state.weekDay.value.contains(index)
? AppColors.mainColor
: Colors.white,
border: Border.all(width: 1, color: AppColors.btnDisableColor),
borderRadius: BorderRadius.circular(30.w),
),
child: Center(
child: Text(
dateStr,
style: TextStyle(
fontSize: 20.sp,
@ -186,7 +193,7 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
? Colors.white
: AppColors.darkGrayTextColor),
)),
)),
)),
);
}
@ -203,17 +210,24 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
isHaveDirection: true,
isHaveLine: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
state.starTime.value = DateTool().getYMDHNDateString(p, 3);
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.starTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
state.starTime.value =
DateTool().getYMDHNDateString(p, 3);
});
})),
Obx(() => CommonItem(
leftTitel:"失效时间".tr,
leftTitel: "失效时间".tr,
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.HM, onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
});
})),
Container(height: 10.h),