diff --git a/lib/main/lockDetail/checkingIn/checkingInList/checkingInListSeletMonth_page.dart b/lib/main/lockDetail/checkingIn/checkingInList/checkingInListSeletMonth_page.dart index 7e584566..0931ead4 100644 --- a/lib/main/lockDetail/checkingIn/checkingInList/checkingInListSeletMonth_page.dart +++ b/lib/main/lockDetail/checkingIn/checkingInList/checkingInListSeletMonth_page.dart @@ -2,19 +2,24 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; +typedef SelectDateCallback(DateTime dateTime); class CheckingInListSeletMonthPage extends StatefulWidget { - const CheckingInListSeletMonthPage({Key? key}) : super(key: key); + int selectYear; + int selectMonth; + SelectDateCallback? selectAction; + CheckingInListSeletMonthPage({required this.selectYear, required this.selectMonth, required this.selectAction, Key? key}) : super(key: key); @override State createState() => _CheckingInListSeletMonthPageState(); } class _CheckingInListSeletMonthPageState extends State { - var _selectMonth = 1; @override Widget build(BuildContext context) { + AppLog.log('selectYear:${widget.selectYear} selectMonth:${widget.selectMonth}'); return Dialog( // insetPadding: EdgeInsets.all(10), //距离 shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.w))), //形状 @@ -35,16 +40,20 @@ class _CheckingInListSeletMonthPageState extends State[ GestureDetector( onTap:(){ - + setState(() { + widget.selectYear--; + }); }, child: Image(width: 50.w, height: 40.w, image: const AssetImage('images/icon_left_black.png'),), ), SizedBox(width: 50.w,), - Text('2024', style: TextStyle(fontSize: 30.sp, color: Colors.black, fontWeight: FontWeight.w500)), + Text('${widget.selectYear}', style: TextStyle(fontSize: 30.sp, color: Colors.black, fontWeight: FontWeight.w500)), SizedBox(width: 50.w), GestureDetector( onTap: (){ - + setState(() { + widget.selectYear++; + }); }, child: Image(width: 50.w, height: 40.w, image: const AssetImage('images/icon_right_black.png')), ), @@ -67,10 +76,12 @@ class _CheckingInListSeletMonthPageState extends State now.year || (year == now.year && month > now.month)) { + return true; + } + return false; + } } diff --git a/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart b/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart index a8b44f0e..c5ba3d35 100755 --- a/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart +++ b/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart @@ -6,6 +6,7 @@ import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListMonth_entity.dart'; import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; +import 'package:star_lock/tools/dateTool.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -211,7 +212,7 @@ class _CheckingInListPageState extends State { await showDialog( context: Get.context!, builder: (BuildContext context) { - // if(state.isDay.value){ + if(state.isDay.value){ return ShowCalendar( datePickerMode: DatePickerMode.day, selectAction: (DateTime dateTime) { @@ -223,9 +224,18 @@ class _CheckingInListPageState extends State { Get.back(); }); }); - // }else{ - // return CheckingInListSeletMonthPage(); - // } + }else{ + final int timestamp = state.checkListDateTimestamp.value; + final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp); + return CheckingInListSeletMonthPage(selectYear: dateTime.year, selectMonth: int.parse(state.checkListDate.value), selectAction: (DateTime dateTime){ + setState(() { + state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch; + final String beginDate = formatDate(dateTime, state.isDay.value ? [mm, '-', dd] : [mm]); + state.checkListDate.value = beginDate; + logic.loadDataByType(); + }); + }); + } }); } else { // Get.toNamed(Routers.selectLockTypePage); diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index b86e5fad..2f206d13 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -227,7 +227,7 @@ class _PasswordKeyListPageState extends State Row( children: [ SizedBox( - width: passwordKeyListItem.keyboardPwdStatus == 2 + width: passwordKeyListItem.keyboardPwdStatus == 2 || passwordKeyListItem.keyboardPwdStatus == 3 ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w, child: Row(children: [ @@ -247,6 +247,11 @@ class _PasswordKeyListPageState extends State '已过期'.tr, style: TextStyle(color: Colors.red, fontSize: 20.sp), ) + else if (passwordKeyListItem.keyboardPwdStatus == 3) + Text( + '未生效'.tr, + style: TextStyle(color: Colors.red, fontSize: 20.sp), + ) else Container(), // SizedBox(width: 15.w) diff --git a/lib/tools/showTFView.dart b/lib/tools/showTFView.dart index fd40eb1e..56d332bc 100755 --- a/lib/tools/showTFView.dart +++ b/lib/tools/showTFView.dart @@ -60,12 +60,12 @@ class ShowTFView extends StatelessWidget { inputFormatters: inputFormatters, keyboardType: keyboardType, decoration: InputDecoration( - contentPadding: EdgeInsets.only(left: 5, top: isShowSuffixIcon! ? 0 : -8, bottom: 6), + contentPadding: EdgeInsets.only(left: 5, top: isShowSuffixIcon??false ? 0 : -8, bottom: 6), hintText: tipTitle??TranslationLoader.lanKeys!.pleaseEnter!.tr, hintStyle: TextStyle(fontSize: 22.sp, height: 1.0), //不需要输入框下划线 border: InputBorder.none, - suffixIcon: isShowSuffixIcon! ? IconButton( + suffixIcon: isShowSuffixIcon??false ? IconButton( onPressed: () => controller?.clear(), icon: const Icon(Icons.clear), ) : null,