添加考勤选择月份弹窗,修复修改密码名字报红问题,添加密码列表未生效状态
This commit is contained in:
parent
8f63629e4a
commit
37480a1a02
@ -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<CheckingInListSeletMonthPage> createState() => _CheckingInListSeletMonthPageState();
|
||||
}
|
||||
|
||||
class _CheckingInListSeletMonthPageState extends State<CheckingInListSeletMonthPage> {
|
||||
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<CheckingInListSeletMonthP
|
||||
children: <Widget>[
|
||||
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<CheckingInListSeletMonthP
|
||||
itemCount: 12,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
onTap: isFutureMonth(widget.selectYear, index + 1) ? null : (){
|
||||
setState(() {
|
||||
Get.back();
|
||||
_selectMonth = index + 1;
|
||||
widget.selectMonth = index + 1;
|
||||
final DateTime selectedDate = DateTime(widget.selectYear, widget.selectMonth, 1);
|
||||
widget.selectAction!(selectedDate);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
@ -78,13 +89,13 @@ class _CheckingInListSeletMonthPageState extends State<CheckingInListSeletMonthP
|
||||
height: 60.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: index+1 == _selectMonth ? Colors.blue : null,
|
||||
color: index+1 == widget.selectMonth ? Colors.blue : null,
|
||||
// color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(40.w),
|
||||
),
|
||||
child: Text('${index + 1}月', style: TextStyle(fontSize: 24.sp, color: index+1 == _selectMonth ? Colors.white : Colors.black)),
|
||||
child: Text('${index + 1}月', style: TextStyle(fontSize: 24.sp, color: isFutureMonth(widget.selectYear, index + 1) ? Colors.grey : (index+1 == widget.selectMonth ? Colors.white : Colors.black)),
|
||||
),
|
||||
);
|
||||
));
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -95,4 +106,11 @@ class _CheckingInListSeletMonthPageState extends State<CheckingInListSeletMonthP
|
||||
);
|
||||
}
|
||||
|
||||
bool isFutureMonth(int year, int month) {
|
||||
final DateTime now = DateTime.now();
|
||||
if (year > now.year || (year == now.year && month > now.month)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<CheckingInListPage> {
|
||||
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<CheckingInListPage> {
|
||||
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 ? <String>[mm, '-', dd] : <String>[mm]);
|
||||
state.checkListDate.value = beginDate;
|
||||
logic.loadDataByType();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Get.toNamed(Routers.selectLockTypePage);
|
||||
|
||||
@ -227,7 +227,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
Row(
|
||||
children: <Widget>[
|
||||
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: <Widget>[
|
||||
@ -247,6 +247,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
'已过期'.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)
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user