diff --git a/star_lock/images/icon_grayPullDown.png b/star_lock/images/icon_grayPullDown.png new file mode 100644 index 00000000..561f1dfb Binary files /dev/null and b/star_lock/images/icon_grayPullDown.png differ diff --git a/star_lock/images/icon_left_black.png b/star_lock/images/icon_left_black.png new file mode 100644 index 00000000..e446f06b Binary files /dev/null and b/star_lock/images/icon_left_black.png differ diff --git a/star_lock/images/icon_right_black.png b/star_lock/images/icon_right_black.png new file mode 100644 index 00000000..3c1f6f05 Binary files /dev/null and b/star_lock/images/icon_right_black.png differ diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index b1e773e2..e0d24590 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -26,13 +26,20 @@ "failureTime":"Failure Time", "effectiveDate":"Effective Date", "failureDate":"Failure Date", - "Monday":"M", - "Tuesday":"T", - "Wednesday":"W", - "Thursday":"T", - "Friday":"F", - "Saturday":"S", - "Sunday":"S", + "monday":"Monday", + "tuesday":"Tuesday", + "wednesday":"Wednesday", + "thursday":"Thursday", + "friday":"Friday", + "saturday":"Saturday", + "sunday":"Sunday", + "mondayShort":"M", + "tuesdayShort":"T", + "wednesdayShort":"W", + "thursdayShort":"T", + "fridayShort":"F", + "saturdayShort":"S", + "sundayShort":"S", "realNameAuthentication":"RealNameAuthentication", "sendKeyBottomTip":"The recipient can use it unlimited times during the validity period", @@ -82,6 +89,32 @@ "work":"Work", "workday":"Workday", "holidays":"Holidays", + "punchingMode":"Punching Mode", + "whetherTheEmployeeHasAKey":"If The Employee Has A Key", + "selectKey":"Select Key", + "officeHours":"Office Hours", + "closingTime":"Closing Time", + "thisWeek":"This Week", + "singleDayWeekend":"Single Day Weekend", + "twoDaysOff":"Two Days Off", + "oddOrEvenDaysOff":"Odd Or Even Days Off", + "year":"Year", + "month":"Month", + "libertyDay":"Liberty Day", + "coverDate":"Cover Date", + "addedHoliday":"Added Holiday", + "startDate":"Start Date", + "accessDate":"Access Date", + "mustFillIn":"Must Fill In", + "endDate":"End Date", + "dailyCharts":"Daily Charts", + "monthlyLeaderboard":"Monthly Leader board", + "noAttendanceRecord":"No Attendance Record", + "everyoneIsVeryMotivated":"Everyone Is Very Motivated", + "workingHoursWereNotReleased":"Working Hours Were Not Released", + "beLate":"Be Late", + "leaveEarly":"Leave Early", + "noCardPunched":"No Card Punched", "basicInformation":"Basic Information", "wirelessKeyboard":"Wireless Keyboard", diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 92a56b4c..5fbcd5ce 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -26,13 +26,20 @@ "failureTime":"failureTime", "effectiveDate":"effectiveDate", "failureDate":"failureDate", - "Monday":"Monday", - "Tuesday":"Tuesday", - "Wednesday":"Wednesday", - "Thursday":"Thursday", - "Friday":"Friday", - "Saturday":"Saturday", - "Sunday":"Sunday", + "monday":"monday", + "tuesday":"tuesday", + "wednesday":"wednesday", + "thursday":"thursday", + "friday":"friday", + "saturday":"saturday", + "sunday":"sunday", + "mondayShort":"mondayShort", + "tuesdayShort":"tuesdayShort", + "wednesdayShort":"wednesdayShort", + "thursdayShort":"thursdayShort", + "fridayShort":"fridayShort", + "saturdayShort":"saturdayShort", + "sundayShort":"sundayShort", "realNameAuthentication":"realNameAuthentication", "sendKeyBottomTip":"sendKeyBottomTip", @@ -82,6 +89,32 @@ "work":"work", "workday":"workday", "holidays":"holidays", + "punchingMode":"punchingMode", + "whetherTheEmployeeHasAKey":"whetherTheEmployeeHasAKey", + "selectKey":"selectKey", + "officeHours":"officeHours", + "closingTime":"closingTime", + "thisWeek":"thisWeek", + "singleDayWeekend":"singleDayWeekend", + "twoDaysOff":"twoDaysOff", + "oddOrEvenDaysOff":"oddOrEvenDaysOff", + "year":"year", + "month":"month", + "libertyDay":"libertyDay", + "coverDate":"coverDate", + "addedHoliday":"addedHoliday", + "startDate":"startDate", + "accessDate":"accessDate", + "mustFillIn":"mustFillIn", + "endDate":"endDate", + "dailyCharts":"dailyCharts", + "monthlyLeaderboard":"monthlyLeaderboard", + "noAttendanceRecord":"noAttendanceRecord", + "everyoneIsVeryMotivated":"everyoneIsVeryMotivated", + "workingHoursWereNotReleased":"workingHoursWereNotReleased", + "beLate":"beLate", + "leaveEarly":"leaveEarly", + "noCardPunched":"noCardPunched", "basicInformation":"basicInformation", "wirelessKeyboard":"wirelessKeyboard", diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 3f91ecc8..4a36f461 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -26,13 +26,20 @@ "failureTime":"失效时间", "effectiveDate":"生效日期", "failureDate":"失效日期", - "Monday":"一", - "Tuesday":"二", - "Wednesday":"三", - "Thursday":"四", - "Friday":"五", - "Saturday":"六", - "Sunday":"日", + "monday":"星期一", + "tuesday":"星期二", + "wednesday":"星期三", + "thursday":"星期四", + "friday":"星期五", + "saturday":"星期六", + "sunday":"星期日", + "mondayShort":"一", + "tuesdayShort":"二", + "wednesdayShort":"三", + "thursdayShort":"四", + "fridayShort":"五", + "saturdayShort":"六", + "sundayShort":"日", "realNameAuthentication":"实名认证", "sendKeyBottomTip":"接收者在有效期内可以不限次数使用", @@ -82,6 +89,32 @@ "work":"工作", "workday":"工作日", "holidays":"节假日", + "punchingMode":"打卡方式", + "whetherTheEmployeeHasAKey":"员工是否有钥匙", + "selectKey":"选择钥匙", + "officeHours":"上班时间", + "closingTime":"下班时间", + "thisWeek":"本周", + "singleDayWeekend":"单休", + "twoDaysOff":"双休", + "oddOrEvenDaysOff":"单双休", + "year":"年", + "month":"月", + "libertyDay":"放假日期", + "coverDate":"补班日期", + "addedHoliday":"添加假日", + "startDate":"开始日期", + "accessDate":"接入日期", + "mustFillIn":"必填", + "endDate":"结束日期", + "dailyCharts":"日榜", + "monthlyLeaderboard":"月榜", + "noAttendanceRecord":"无考勤记录", + "everyoneIsVeryMotivated":"大家干劲十足", + "workingHoursWereNotReleased":"工作时长未出炉", + "beLate":"迟到", + "leaveEarly":"早退", + "noCardPunched":"未打卡", "basicInformation":"基本信息", "wirelessKeyboard":"无线键盘", diff --git a/star_lock/images/main/icon_checkInRankingListTop.png b/star_lock/images/main/icon_checkInRankingListTop.png new file mode 100644 index 00000000..0a6070e0 Binary files /dev/null and b/star_lock/images/main/icon_checkInRankingListTop.png differ diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 2c83e4be..f8bb22c6 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -6,9 +6,12 @@ import 'login/forgetPassword/starLock_forgetPassword_page.dart'; import 'login/login/starLock_login_page.dart'; import 'login/register/starLock_register_page.dart'; import 'login/seletCountryRegion/seletCountryRegion_page.dart'; +import 'main/lockDetail/checkingIn/checkingInAddHolidays/checkingInAddHolidays_page.dart'; +import 'main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart'; import 'main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart'; import 'main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart'; +import 'main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetStaffManage/checkingInStaffManage_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart'; @@ -127,6 +130,9 @@ abstract class Routers { static const checkingInAddStaffPage = '/CheckingInAddStaffPage';// 添加员工 static const checkingInSetWorkTimePage = '/CheckingInSetWorkTimePage';// 工作时间设置 static const checkingInSetWorkdaySet = '/CheckingInSetWorkdaySet';// 工作日设置 + static const checkingInSetHolidaysPage = '/CheckingInSetHolidaysPage';// 节假日设置 + static const checkingInAddHolidaysPage = '/CheckingInAddHolidaysPage';// 添加假日 + static const checkingInDetailPage = '/CheckingInDetailPage';// 考勤详情 static const mineSetPage = '/MineSetPage';// 我的设置 static const mineMultiLanguagePage = '/MineMultiLanguagePage';// 我的设置 @@ -399,5 +405,17 @@ abstract class AppRouters { name: Routers.checkingInSetWorkdaySet, page: () => const CheckingInSetWorkdaySet(), ), + GetPage( + name: Routers.checkingInSetHolidaysPage, + page: () => const CheckingInSetHolidaysPage(), + ), + GetPage( + name: Routers.checkingInAddHolidaysPage, + page: () => const CheckingInAddHolidaysPage(), + ), + GetPage( + name: Routers.checkingInDetailPage, + page: () => CheckingInDetailPage(), + ), ]; } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInAddHolidays/checkingInAddHolidays_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInAddHolidays/checkingInAddHolidays_page.dart new file mode 100644 index 00000000..9bd9b126 --- /dev/null +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInAddHolidays/checkingInAddHolidays_page.dart @@ -0,0 +1,109 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/commonItem.dart'; +import '../../../../tools/showCalendar.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class CheckingInAddHolidaysPage extends StatefulWidget { + const CheckingInAddHolidaysPage({Key key}) : super(key: key); + + @override + State createState() => _CheckingInAddHolidaysPageState(); +} + +class _CheckingInAddHolidaysPageState extends State { + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar(barTitle:TranslationLoader.lanKeys.addedHoliday.tr, haveBack:true, backgroundColor: AppColors.mainColor), + body: Column( + children: [ + CommonItem(leftTitel:TranslationLoader.lanKeys.name.tr, rightTitle:"", isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget("(${TranslationLoader.lanKeys.mustFillIn.tr})")), + CommonItem(leftTitel:TranslationLoader.lanKeys.startDate.tr, rightTitle:"(${TranslationLoader.lanKeys.mustFillIn.tr})", isHaveLine: true, isHaveDirection: false, action: () async { + await showDialog(context: context, + builder: (context) { + return ShowCalendar(datePickerMode: DatePickerMode.day, seletAction: (dateTime){ + print("111111$dateTime"); + Navigator.of(context).pop(true); + }); + }); + }), + CommonItem(leftTitel:TranslationLoader.lanKeys.endDate.tr, rightTitle:"(${TranslationLoader.lanKeys.mustFillIn.tr})", isHaveLine: true, isHaveDirection: false, action: () async { + await showDialog(context: context, + builder: (context) { + return ShowCalendar(datePickerMode: DatePickerMode.day, seletAction: (dateTime){ + Navigator.of(context).pop(true); + }); + }); + }), + CommonItem(leftTitel:TranslationLoader.lanKeys.coverDate.tr, rightTitle:"", isHaveLine: false, isHaveDirection: false, action: () async { + await showDialog(context: context, + builder: (context) { + return ShowCalendar(datePickerMode: DatePickerMode.day, seletAction: (dateTime){ + Navigator.of(context).pop(true); + }); + }); + }), + SizedBox(height: 50.w,), + SubmitBtn(btnName: TranslationLoader.lanKeys.sure.tr, borderRadius: 20.w, margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + onClick: (){ + + } + ), + ], + ), + ); + } + + Widget getTFWidget(String tfStr){ + return Container( + height: 50.h, + width: 300.w, + // color: Colors.red, + child: Row( + children: [ + Expanded( + child: TextField( + //输入框一行 + maxLines: 1, + // controller: _controller, + autofocus: false, + textAlign:TextAlign.end, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), + hintText: tfStr, + //不需要输入框下划线 + border: InputBorder.none, + ), + ), + ), + SizedBox(width: 10.w,), + ], + ), + ); + } + + Widget whetherTheEmployeeHasAKeyWidget(String title, Function action){ + return GestureDetector( + onTap: (){ + + }, + child: Row( + children: [ + Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,), + SizedBox(width: 5.w,), + Text(title), + ], + ), + ); + } + +} diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart new file mode 100644 index 00000000..0c427c2b --- /dev/null +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart @@ -0,0 +1,500 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class CheckingInDetailPage extends StatefulWidget { + const CheckingInDetailPage({Key key}) : super(key: key); + + @override + _CheckingInDetailPageState createState() => _CheckingInDetailPageState(); +} + +class _CheckingInDetailPageState extends State { + int _year = DateTime.now().year; + int _month = DateTime.now().month; + int _day = DateTime.now().day; + final List _datas = []; + final List _listDatas = []; + + @override + void initState() { + // TODO: implement initState + //设置默认当前月日期 + _setDatas(year: _year, month: _month); + + //设置模拟数据,日历月事件,可根据接口返回的结果 + _loadAttendanceMonthRecord( "$_year-$_month"); + //日历日事件 + _loadAttendanceDayRecord("$_year-$_month-$_day"); + + super.initState(); + } + + //加载月历事件,请求接口 + _loadAttendanceMonthRecord(String dateTime) async { + CalendarModel bean1 = CalendarModel(year: _year,month: _month,day: 1,workType: "2"); + CalendarModel bean2 = CalendarModel(year: _year,month: _month,day: 2,workType: "1"); + CalendarModel bean3 = CalendarModel(year: _year,month: _month,day: 3,workType: "2"); + CalendarModel bean4 = CalendarModel(year: _year,month: _month,day: 4,workType: "0"); + CalendarModel bean5 = CalendarModel(year: _year,month: _month,day: 5,workType: "0"); + CalendarModel bean6 = CalendarModel(year: _year,month: _month,day: 6,workType: "1"); + _listDatas.add(bean1); + _listDatas.add(bean2); + _listDatas.add(bean3); + _listDatas.add(bean4); + _listDatas.add(bean5); + _listDatas.add(bean6); + + setState(() { + for (int i = 0; i < _datas.length; i++) { + for (int j = 0; j < _listDatas.length; j++) { + if (_datas[i].year== _listDatas[j].year && + _datas[i].month == _listDatas[j].month && + _datas[i].day == _listDatas[j].day) { + _datas[i].workType = _listDatas[j].workType; + } + } + } + }); + } + + //加载日事件,请求接口 + _loadAttendanceDayRecord(String dateTime) async{ + //可根据接口返回的内容在日历下面打卡信息或者其余内容 + print("点击的是$dateTime"); + } + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: TitleAppBar(barTitle:"张三", haveBack:true, backgroundColor: AppColors.mainColor), + body: SingleChildScrollView( + child: Column( + children: [ + Container( + // margin: EdgeInsets.all(20.sp), + decoration: BoxDecoration( + //设置颜色 + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(12.r)), + //设置四周边框 + ), + child: Column( + children: [ + _yearHeader(), + SizedBox(height: 10.h), + _weekHeader(), + _everyDay(), + _bottomStatisticsWidget() + ], + ), + ), + + //下面可以添加日事件中的信息,例如打卡信息 + Container(), + ], + ))); + } + + //头部年 + Widget _yearHeader() { + return Container( + height: 30, + margin: const EdgeInsets.only(top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + _lastMonth(); + }, + child: Container( + // margin: EdgeInsets.only(left: 20.w), + child: Image( + width: 30.w, + height: 30.w, + image: const AssetImage("images/icon_left_black.png"), + ), + ), + ), + SizedBox(width: 60.w,), + Text("$_year-$_month", style: TextStyle(fontSize: 34.sp, color: Colors.black, fontWeight: FontWeight.w500)), + SizedBox(width: 60.w,), + GestureDetector( + onTap: () { + _nextMonth(); + }, + child: Container( + // margin: EdgeInsets.only(right: 20.sp), + child: Image( + width: 30.w, + height: 30.h, + image: const AssetImage("images/icon_right_black.png"), + ), + ), + ), + ], + ), + ); + } + + //中部周 + Widget _weekHeader() { + var array = ["一", "二", "三", "四", "五", "六", "日"]; + return Container( + height: 50.h, + child: GridView.builder( + padding: const EdgeInsets.only(left: 10, right: 10), + itemCount: array.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + //横轴元素个数 + crossAxisCount: 7, + //纵轴间距 + // mainAxisSpacing: ScreenUtil().setHeight(10), + // 横轴间距 + // crossAxisSpacing: ScreenUtil().setWidth(15), + //子组件宽高长度比例 + childAspectRatio: 2), + itemBuilder: (context, index) { + return Container( + alignment: Alignment.center, + child: Text( + array[index], + style: TextStyle( + color: index == 5 || index == 6 + ? const Color(0xFFC4C8D0) + : const Color(0xFF3C3E43), + fontSize: 30.sp), + )); + }, + ), + ); + } + + //底部日 + Widget _everyDay() { + return Container( + child: GridView.builder( + padding: EdgeInsets.only(left: 10.sp, top: 10.sp, right: 10.sp), + itemCount: _getRowsForMonthYear(year: _year, month: _month) * 7, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + //横轴元素个数 + crossAxisCount: 7, + // //纵轴间距 + // mainAxisSpacing: ScreenUtil().setHeight(10), + // // 横轴间距 + // crossAxisSpacing: ScreenUtil().setWidth(10), + //子组件宽高长度比例 + childAspectRatio: 1), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + setState(() { + if (_datas[index].month == _month) { + //判断点击的是否是当月日期,只对当前月点击的日期做处理 + for (int i = 0; i < _datas.length; i++) { + if (i == index) { + //切换至选中的日期 + _day = _datas[i].day; + _datas[i].isSelect = true; + + //加载选中的日期事件 + _loadAttendanceDayRecord( "${_datas[i].year}-${_datas[i].month}-${_datas[i].day}"); + } else { + _datas[i].isSelect = false; + } + } + } else { + //不是当月的不做处理 + // _datas[index].is_select=false; + } + }); + }, + child: Container( + child: Column( + children: [ + Container( + width: 40.w, + height: 40.w, + //设置底部背景 + decoration: _datas[index].isSelect + ? const BoxDecoration( + color: Color(0xFF2C91F6), + shape: BoxShape.circle, + ) + : const BoxDecoration(), + child: Center( + child: Text( + //不是当前月不显示值 + _datas[index].month == _month + ? _datas[index].day.toString() + : "", + textAlign: TextAlign.center, + //设置选中字体颜色,以及周末和工作日颜色 + style: _datas[index].isSelect + ? TextStyle( + fontSize: 32.sp, color: const Color(0xFFFFFFFF)) + : (index % 7 == 5 || index % 7 == 6 + ? TextStyle( + fontSize: 32.sp, color: const Color(0xFFC4C8D0)) + : TextStyle( + fontSize: 32.sp, color: const Color(0xFF3C3E43))), + ), + ), + ), + const SizedBox(height: 5), + //设置底部小圆点,非当前月的不显示,设置为透明,其余的根据状态判断显示 + _datas[index].month == _month && + _datas[index].workType != "" && + _datas[index].workType != "0" + ? Container( + height: 6.0, + width: 6.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _datas[index].workType == "1" + ? const Color(0xFFF48835) + : const Color(0xFF2C91F6)), + ) + : Container(), + ], + ), + ), + ); + }, + ), + ); + } + + Widget _bottomStatisticsWidget(){ + return Column( + children: [ + Row( + children: [ + Container( + width: 1.sw, + // height: 40.h, + padding: EdgeInsets.only(left: 50.w,top: 5.h, bottom: 5.h), + color: Colors.grey, + child: Text("月统计", style: TextStyle(color: Colors.white, fontSize: 32.sp, fontWeight: FontWeight.w500),), + ), + ], + ), + _bottomStatisticsItemWidget(Colors.red ,"迟到", "0"), + _bottomStatisticsItemWidget(Colors.orange ,"早退", "0"), + _bottomStatisticsItemWidget(Colors.grey ,"未打卡", "0"), + ], + ); + } + + Widget _bottomStatisticsItemWidget(Color color,String leftTitel, String rightTitle,){ + return Column( + children: [ + Container( + height: 70.h, + padding: EdgeInsets.only(left:20.w, right: 10.w, top: 20.w, bottom: 20.w), + child: Row( + children: [ + SizedBox(width:20.w), + Container( + width: 35.w, + height: 35.w, + decoration: BoxDecoration( + color: color, + borderRadius:BorderRadius.all(Radius.circular(35.h)) + ), + ), + SizedBox(width:20.w), + Expanded(child: Text(leftTitel, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500))), + SizedBox(width:20.w), + Text(rightTitle, textAlign: TextAlign.end, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500)), + SizedBox(width:10.w), + ], + ), + ), + Container(height: 0.5.h, color: Colors.grey,) + ], + ); + } + + // 获取行数 + int _getRowsForMonthYear({int year, int month}) { + //当前月天数 + var currentMonthDays = _getCurrentMonthDays(year: year, month: month); + // + var placeholderDays = _getPlaceholderDays(year: year, month: month); + + int rows = (currentMonthDays + placeholderDays) ~/ 7; + + int remainder = (currentMonthDays + placeholderDays) % 7; + if (remainder > 0) { + rows = rows + 1; + } + return rows; + } + + // 得到这个月的第一天是星期几 + int _getPlaceholderDays({int year, int month}) { + return DateTime(year, month).weekday - 1 % 7; + } + + // 获取当前月份天数 + int _getCurrentMonthDays({int year, int month}) { + if (month == 2) { + //判断2月份是闰年月还是平年 + if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { + return 29; + } else { + return 28; + } + } else if (month == 1 || + month == 3 || + month == 5 || + month == 7 || + month == 8 || + month == 10 || + month == 12) { + return 31; + } else { + return 30; + } + } + + /// 获取展示信息 + _setDatas({int year, int month}) { + /// 上个月占位 + var lastYear = year; + var lastMonth = month - 1; + if (month == 1) { + lastYear = year - 1; + lastMonth = 12; + } + + var placeholderDays = _getPlaceholderDays(year: year, month: month); + var lastMonthDays = _getCurrentMonthDays(year: lastYear, month: lastMonth); + var firstDay = lastMonthDays - placeholderDays; + for (var i = 0; i < placeholderDays; i++) { + _datas.add(CalendarModel( + year: lastYear, + month: lastMonth, + day: firstDay + i + 1, + isSelect: false, + workType: "")); + } + + /// 本月显示 + var currentMonthDays = _getCurrentMonthDays(year: year, month: month); + for (var i = 0; i < currentMonthDays; i++) { + if (i == _day - 1) { + _datas.add(CalendarModel( + year: year, + month: month, + day: i + 1, + isSelect: true, + workType: "")); + } else { + _datas.add(CalendarModel( + year: year, + month: month, + day: i + 1, + isSelect: false, + workType: "")); + } + } + + /// 下个月占位 + var nextYear = year; + var nextMonth = month + 1; + if (month == 12) { + nextYear = year + 1; + nextMonth = 1; + } + var nextPlaceholderDays = + _getPlaceholderDays(year: nextYear, month: nextMonth); + for (var i = 0; i < 7 - nextPlaceholderDays; i++) { + _datas.add(CalendarModel( + year: nextYear, + month: nextMonth, + day: i + 1, + isSelect: false, + workType: "")); + } + } + + // 上月 + _lastMonth() { + setState(() { + if (_month == 1) { + _year = _year - 1; + _month = 12; + } else { + _month = _month - 1; + } + _day = 1; //查看上一个月时,默认选中的为第一天 + _datas.clear(); + _setDatas(year: _year, month: _month); + //更新月历事件 + _loadAttendanceMonthRecord( "$_year-$_month"); + //更新日事件 + _loadAttendanceDayRecord("$_year-$_month-$_day"); + }); + } + + // 下月 + _nextMonth() { + if(_month==12){//当前月是12月,下一个月就是下一年 + if(DateTime.now().year>=_year+1){//判断下一年是否大于当前年 + _setNextMonthData(); + } + }else{//当前月不是12月,还处于当前年 + if(DateTime.now().month>=_month+1){ + //判断下一个月是否超过当前月,超过当前月不做操作 + _setNextMonthData(); + } + } + } + + //设置下个月的数据 + _setNextMonthData(){ + setState(() { + if (_month == 12) { + _year = _year + 1; + _month = 1; + } else { + _month = _month + 1; + } + if (_month == DateTime.now().month) { + //如果下个月时当前月,默认选中当天 + _day = DateTime.now().day; + } else { + //如果不是当前月,默认选中第一天 + _day = 1; + } + _datas.clear(); + _setDatas(year: _year, month: _month); + //更新月历事件 + _loadAttendanceMonthRecord( "$_year-$_month"); + //更新日事件 + _loadAttendanceDayRecord("$_year-$_month-$_day"); + }); + } +} + +//日历bean +class CalendarModel { + int year; + int month; + int day; + String workType = "";//日期事件,0,休息,1,异常,2,正常 + bool isSelect = false; + + CalendarModel( + {this.year, this.month, this.day, this.isSelect, this.workType}); +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart index 7739a719..964bda7e 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart @@ -6,6 +6,7 @@ import 'package:get/get.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/showBottomSheetTool.dart'; +import '../../../../tools/showCalendar.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; @@ -31,14 +32,157 @@ class _CheckingInListPageState extends State { SizedBox(width: 30.w,), ], ), - body: ListView.builder( - itemCount:10, - itemBuilder: (c, index){ - return _checkingInListItem('images/icon_lock.png', "张三", "2023.6.21 11.15", "2023.6.21 11.15",(){ - // Navigator.pushNamed(context, Routers.electronicKeyDetailPage); - }); - } - ) + body: Column( + children: [ + topInfo(), + SizedBox(height: 10.h,), + middleDayInfo(), + Expanded(child: bottomList()) + ], + ), + ); + } + + Widget topInfo(){ + return Container( + width: 1.sw, + // height: 370.h, + color: Colors.white, + child: Column( + children: [ + SizedBox(height: 30.h,), + Image.asset('images/main/icon_checkInRankingListTop.png', width: 145.w, height: 145.w), + SizedBox(height: 10.h,), + Text(TranslationLoader.lanKeys.noAttendanceRecord.tr, style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500)), + SizedBox(height: 30.h,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // SizedBox(width: 30.w,), + Row( + children: [ + SizedBox(width: 40.w,), + Container( + // width: 150.w, + height: 70.h, + // color: Colors.red, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text(TranslationLoader.lanKeys.dailyCharts.tr, style: TextStyle(color: AppColors.mainColor)), + Container(width: 20.w, height: 2.h, color: AppColors.mainColor) + ], + ), + ), + SizedBox(width: 40.w,), + Container( + // width: 100.w, + height: 70.h, + // color: Colors.red, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text(TranslationLoader.lanKeys.monthlyLeaderboard.tr, style: TextStyle(color: Colors.black)), + Container(width: 20.w, height: 2.h, color: Colors.black) + ], + ), + ), + ], + ), + GestureDetector( + onTap: () async { + await showDialog(context: context, + builder: (context) { + return ShowCalendar(datePickerMode: DatePickerMode.day, seletAction: (dateTime){ + Navigator.of(context).pop(true); + }); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("07-12", style: const TextStyle(color: Colors.black),), + Image.asset('images/icon_grayPullDown.png', width: 50.w, height: 30.w,), + SizedBox(width: 10.w,), + ], + ), + ) + ], + ), + // Container(height: 10.h, color: AppColors.mainBackgroundColor,), + ], + ), + ); + } + + Widget middleDayInfo(){ + return Visibility( + visible: true, + child: Container( + height: 80.h, + color: Colors.white, + margin: EdgeInsets.only(left:15.h, right: 15.h, bottom: 10.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + // width: 100.w, + // height: 80.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox(height: 5.h,), + Text("0", style: TextStyle(color: Colors.black)), + Text(TranslationLoader.lanKeys.beLate.tr, style: TextStyle(color: Colors.black)), + SizedBox(height: 5.h,), + ], + ), + ), + Container( + // width: 100.w, + // height: 80.h, + // color: Colors.red, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox(height: 5.h,), + Text("0", style: TextStyle(color: Colors.black)), + Text(TranslationLoader.lanKeys.leaveEarly.tr, style: TextStyle(color: Colors.black)), + SizedBox(height: 5.h,), + ], + ), + ), + Container( + // width: 100.w, + // height: 80.h, + // color: Colors.red, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox(height: 5.h,), + Text("0", style: TextStyle(color: Colors.black)), + Text(TranslationLoader.lanKeys.noCardPunched.tr, style: TextStyle(color: Colors.black)), + SizedBox(height: 5.h,), + ], + ), + ), + ], + ), + ), + ); + } + + Widget bottomList(){ + return ListView.separated( + itemCount:10, + itemBuilder: (c, index){ + return _checkingInListItem('images/icon_lock.png', "张三", "2023.6.21 11.15", "2023.6.21 11.15",(){ + Navigator.pushNamed(context, Routers.checkingInDetailPage); + }); + }, + separatorBuilder: (context, index) { + return const Divider(height:1, color: Colors.grey); + }, ); } @@ -46,8 +190,8 @@ class _CheckingInListPageState extends State { return GestureDetector( onTap: action, child: Container( - height: 100.h, - margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + height: 80.h, + // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10.w), @@ -55,36 +199,24 @@ class _CheckingInListPageState extends State { child: Row( children: [ SizedBox(width: 30.w,), - Image.asset(lockTypeIcon, width: 50.w, height: 50.w,), - SizedBox(width: 30.w,), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(lockTypeTitle, style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500), ), - SizedBox(width:20.w), - Text("待接收", style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500), ), - ], - ), - ), - SizedBox(width:20.w), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text("2023.6.21 11.15-2023.6.21 11.15", style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500), ), - ], - ), - ), - SizedBox(width:20.h), - ], - ), + Text("1", style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500), ), + SizedBox(width: 20.w,), + Container( + width: 60.h, height: 60.h, + decoration: BoxDecoration( + color: AppColors.mainColor, + border: Border.all(width: 1, color: AppColors.mainColor), + borderRadius: BorderRadius.circular(30.h), + ), + padding: EdgeInsets.all(10.w), + child: Image.asset('images/mine/icon_mine_main_defaultAvatar.png', width: 40.w, height: 40.w, color: Colors.white,) ), + SizedBox(width: 20.w,), + Expanded( + child: Text(lockTypeTitle, style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500), ), + ), + SizedBox(width:20.h), + Image.asset("images/icon_right.png", width: 50.w, height: 50.w,), SizedBox(width:20.h), ], ), diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart index 7c84039a..1da92b2b 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart @@ -41,7 +41,7 @@ class _CheckingInSetPageState extends State { Navigator.pushNamed(context, Routers.checkingInSetWorkdaySet); }), CommonItem(leftTitel:TranslationLoader.lanKeys.holidays.tr, rightTitle:"", isHaveLine: false, isHaveDirection: true, action: (){ - // Navigator.pushNamed(context, Routers.lockEscalationPage); + Navigator.pushNamed(context, Routers.checkingInSetHolidaysPage); }), SizedBox(height: 30.h,), SubmitBtn(btnName: "${TranslationLoader.lanKeys.delete.tr} ${TranslationLoader.lanKeys.company.tr}", diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart index 820f2811..be93a7a7 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart @@ -26,11 +26,11 @@ class _CheckingInAddStaffPageState extends State { body: Column( children: [ CommonItem(leftTitel:TranslationLoader.lanKeys.name.tr, rightTitle:"", isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget(TranslationLoader.lanKeys.pleaseEnter.tr)), - CommonItem(leftTitel:"打卡方式", rightTitle:"APP", isHaveLine: false, isHaveDirection: true, action: (){ + CommonItem(leftTitel:TranslationLoader.lanKeys.punchingMode.tr, rightTitle:"APP", isHaveLine: false, isHaveDirection: true, action: (){ _showSeletClockInType(); }), SizedBox(height: 10.h,), - CommonItem(leftTitel:"员工是否有钥匙", rightTitle:"", isHaveLine: true, isHaveRightWidget: true, rightWidget: Row( + CommonItem(leftTitel:TranslationLoader.lanKeys.whetherTheEmployeeHasAKey.tr, rightTitle:"", isHaveLine: true, isHaveRightWidget: true, rightWidget: Row( children: [ whetherTheEmployeeHasAKeyWidget("有", (){ @@ -43,11 +43,11 @@ class _CheckingInAddStaffPageState extends State { )), Visibility( visible:true, - child: CommonItem(leftTitel:"账号", rightTitle:"", isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget("请输入员工账号")), + child: CommonItem(leftTitel:TranslationLoader.lanKeys.accountNumber.tr, rightTitle:"", isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget(TranslationLoader.lanKeys.pleaseEnter.tr)), ), Visibility( visible:true, - child: CommonItem(leftTitel:"选择钥匙", rightTitle:"", isHaveLine: false, isHaveDirection: true, action: (){ + child: CommonItem(leftTitel:TranslationLoader.lanKeys.selectKey.tr, rightTitle:"", isHaveLine: false, isHaveDirection: true, action: (){ _showSeletClockInType(); }), ), @@ -65,7 +65,8 @@ class _CheckingInAddStaffPageState extends State { Widget getTFWidget(String tfStr){ return Container( height: 50.h, - width: 500.w, + width: 300.w, + // color: Colors.red, child: Row( children: [ Expanded( diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_page.dart new file mode 100644 index 00000000..e716a219 --- /dev/null +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_page.dart @@ -0,0 +1,187 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_pickers/pickers.dart'; +import 'package:flutter_pickers/style/default_style.dart'; +import 'package:flutter_pickers/style/picker_style.dart'; +import 'package:flutter_pickers/time_picker/model/date_mode.dart'; +import 'package:flutter_pickers/time_picker/model/pduration.dart'; +import 'package:flutter_pickers/time_picker/model/suffix.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../../../../appRouters.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/showBottomSheetTool.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class CheckingInSetHolidaysPage extends StatefulWidget { + const CheckingInSetHolidaysPage({Key key}) : super(key: key); + + @override + State createState() => _CheckingInSetHolidaysPageState(); +} + +class _CheckingInSetHolidaysPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar(haveTitleWidget: true, titleWidget:titleWidget(), haveBack:true, backgroundColor: AppColors.mainColor, actionsList: [ + GestureDetector( + onTap: (){ + Navigator.pushNamed(context, Routers.checkingInAddHolidaysPage); + }, + child: Image.asset('images/icon_add_white.png', width: 50.w, height: 50.w,) + ), + SizedBox(width: 30.w,), + ], + ), + body: ListView.builder( + itemCount:10, + itemBuilder: (c, index){ + return _checkingInListItem('images/icon_lock.png', "张三", "2023.6.21 11.15", "2023.6.21 11.15",(){ + // Navigator.pushNamed(context, Routers.electronicKeyDetailPage); + }); + } + ) + ); + } + + Widget _checkingInListItem(String lockTypeIcon, String lockTypeTitle, String beginTime, String endTime, Function action){ + return GestureDetector( + onTap: action, + child: Container( + height: 140.h, + margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.w), + ), + child: Row( + children: [ + Container( + color: const Color(0xFFAFB5D7), + width: 100.w, + height: 140.h, + child: Center(child: Text("7\n${TranslationLoader.lanKeys.month.tr}", textAlign: TextAlign.center, style: TextStyle(fontSize: 32.sp, color: Colors.white),)) + ), + SizedBox(width: 30.w,), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + // color: Colors.red, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(lockTypeTitle, style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w600), ), + ], + ), + ), + SizedBox(height:10.h), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text("${TranslationLoader.lanKeys.libertyDay.tr}:2023.6.21 11.15-2023.6.21 11.15", style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500), ), + ], + ), + ), + SizedBox(height:5.h), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text("${TranslationLoader.lanKeys.coverDate.tr}:2023.6.21 11.15", style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500), ), + ], + ), + ), + ], + ), + ), + SizedBox(width:20.h), + ], + ), + ), + ); + } + + Widget titleWidget(){ + return GestureDetector( + onTap: (){ + showListType(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("${DateTime.now().year}${TranslationLoader.lanKeys.year.tr}", style: const TextStyle(color: Colors.white),), + SizedBox(width: 5.w,), + Image.asset('images/main/icon_lockDetail_checkIn_topTitle.png', width: 30.w, height: 16.w,) + ], + ), + ); + } + + Widget showListType(){ + Pickers.showDatePicker( + context, + // 模式,详见下方 + mode: DateMode.Y, + // 后缀 默认Suffix.normal(),为空的话Suffix() + suffix: Suffix(years: ' 年'), + // 样式 详见下方样式 + pickerStyle: PickerStyle( + cancelButton:GestureDetector( + onTap: (){ + + }, + child: Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 22, right: 12), + child: Text(TranslationLoader.lanKeys.cancel.tr, style: const TextStyle(color: Colors.black, fontSize: 16.0)), + ), + ), + commitButton: GestureDetector( + onTap: (){ + + }, + child: Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 22, right: 12), + child: Text(TranslationLoader.lanKeys.sure.tr, + style: const TextStyle(color: Colors.black, fontSize: 16.0)), + ), + ), + ), + // 默认选中 + selectDate: PDuration(year: 2023), + minDate: PDuration(year: 1900), + maxDate: PDuration(year: 2100), + onConfirm: (p) { + print('longer >>> 返回数据:$p'); + }, + // onChanged: (p) => print(p), + ); + // var list = [TranslationLoader.lanKeys.earlyArrivalList.tr, TranslationLoader.lanKeys.lateList.tr, TranslationLoader.lanKeys.hardWorkingList.tr]; + // ShowBottomSheetTool().showSingleRowPicker( + // //上下文 + // context, + // //默认的索引 + // normalIndex: 0, + // title: "", + // cancelTitle: TranslationLoader.lanKeys.cancel.tr, + // sureTitle: TranslationLoader.lanKeys.sure.tr, + // //要显示的列表 + // //可自定义数据适配器 + // //adapter: PickerAdapter(), + // data: list, + // //选择事件的回调 + // clickCallBack: (int index, var str) { + // + // } + // ); + } + +} diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart index 0b9bd7b5..4a2b1e3e 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart @@ -29,12 +29,12 @@ class _CheckingInSetWorkTimePageState extends State { Widget buildMainUI(){ return Column( children: [ - CommonItem(leftTitel:"上班时间", rightTitle:"11:49", isHaveDirection: true, isHaveLine: true, action:(){ + CommonItem(leftTitel:TranslationLoader.lanKeys.officeHours.tr, rightTitle:"11:49", isHaveDirection: true, isHaveLine: true, action:(){ // ShowSeletDateTime().showDatePicker(context, '2100-01-01 00:00', '1900-01-01 00:00', getNowDate(),'yyyy-MMMM-dd HH:mm', (dateTime, List index) { // // }); }), - CommonItem(leftTitel:"下班时间", rightTitle:"11:49", isHaveDirection: true, action:(){ + CommonItem(leftTitel:TranslationLoader.lanKeys.closingTime.tr, rightTitle:"11:49", isHaveDirection: true, action:(){ // ShowSeletDateTime().showDatePicker(context, '00:00', '00:00', getNowDate(),'HH:mm', (dateTime, List index) { // // }); diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart index 8d9db141..3181fad0 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart @@ -63,7 +63,7 @@ class _CheckingInSetWorkdaySetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Center(child: Text("自定义", style: TextStyle(fontSize: 32.sp, color: Colors.white))), + Center(child: Text(TranslationLoader.lanKeys.custom.tr, style: TextStyle(fontSize: 32.sp, color: Colors.white))), ], ), ), @@ -72,10 +72,11 @@ class _CheckingInSetWorkdaySetState extends State { width: (1.sw - 10*3)/2, height: 120.h, color: Colors.grey, + padding: EdgeInsets.all(10.w), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Center(child: Text("单双休", style: TextStyle(fontSize: 32.sp, color: Colors.white))), + Expanded(child: Center(child: Text(TranslationLoader.lanKeys.oddOrEvenDaysOff.tr, style: TextStyle(fontSize: 32.sp, color: Colors.white), textAlign: TextAlign.center,))), ], ), ), @@ -89,15 +90,15 @@ class _CheckingInSetWorkdaySetState extends State { padding: EdgeInsets.only(left:10.w, right: 10.w), child: Column( children: [ - CommonItem(leftTitel:"本周", rightTitle:"", allHeight:70.h, isHaveLine: true), - CommonItem(leftTitel:"单休", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.thisWeek.tr, rightTitle:"", allHeight:70.h, isHaveLine: true), + CommonItem(leftTitel:TranslationLoader.lanKeys.singleDayWeekend.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"双休", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.twoDaysOff.tr, rightTitle:"", allHeight:70.h, isHaveLine: false, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ @@ -115,49 +116,49 @@ class _CheckingInSetWorkdaySetState extends State { padding: EdgeInsets.only(left:10.w, right: 10.w), child: Column( children: [ - CommonItem(leftTitel:"星期一", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.monday.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"星期二", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.tuesday.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"星期三", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.wednesday.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"星期四", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.thursday.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"星期五", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.friday.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"星期六", rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.saturday.tr, rightTitle:"", allHeight:70.h, isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ }, child: Row(children: [Image.asset('images/icon_round_unSelet.png', width: 40.w, height: 40.w,),],),) ), - CommonItem(leftTitel:"星期日", rightTitle:"", allHeight:70.h, isHaveLine: false, isHaveRightWidget: true, + CommonItem(leftTitel:TranslationLoader.lanKeys.sunday.tr, rightTitle:"", allHeight:70.h, isHaveLine: false, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: (){ diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart index 2b37b35d..729b209f 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart @@ -67,25 +67,25 @@ class _ElectronicKeyPeriodValidityPageState extends State { String dateStr; switch (index) { case 0: - dateStr = TranslationLoader.lanKeys.Sunday.tr; + dateStr = TranslationLoader.lanKeys.sundayShort.tr; break; case 1: - dateStr = TranslationLoader.lanKeys.Monday.tr; + dateStr = TranslationLoader.lanKeys.mondayShort.tr; break; case 2: - dateStr = TranslationLoader.lanKeys.Tuesday.tr; + dateStr = TranslationLoader.lanKeys.tuesdayShort.tr; break; case 3: - dateStr = TranslationLoader.lanKeys.Wednesday.tr; + dateStr = TranslationLoader.lanKeys.wednesdayShort.tr; break; case 4: - dateStr = TranslationLoader.lanKeys.Thursday.tr; + dateStr = TranslationLoader.lanKeys.thursdayShort.tr; break; case 5: - dateStr = TranslationLoader.lanKeys.Friday.tr; + dateStr = TranslationLoader.lanKeys.fridayShort.tr; break; case 6: - dateStr = TranslationLoader.lanKeys.Saturday.tr; + dateStr = TranslationLoader.lanKeys.saturdayShort.tr; break; default: break; diff --git a/star_lock/lib/tools/showCalendar.dart b/star_lock/lib/tools/showCalendar.dart new file mode 100644 index 00000000..75f776ad --- /dev/null +++ b/star_lock/lib/tools/showCalendar.dart @@ -0,0 +1,54 @@ + + +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +typedef SeletDateCallback(DateTime dateTime); + +class ShowCalendar extends StatelessWidget { + SeletDateCallback seletAction; + DatePickerMode datePickerMode; + + ShowCalendar({Key key, this.seletAction, this.datePickerMode}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Dialog( + // insetPadding: EdgeInsets.all(10), //距离 + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(20))), //形状 + backgroundColor: Colors.white, + clipBehavior: Clip.antiAlias, //强制裁剪 + elevation: 10, + child: SizedBox( + //需要在内部限制下高度和宽度才能更好的显示 + height: 350, + width: 1.sw - 40.w, + child: _calendarDatePicker(datePickerMode), + ), + ); + } + + CalendarDatePicker _calendarDatePicker(DatePickerMode mode){ + return CalendarDatePicker( + initialDate: DateTime.now(), // 初始化选中日期 + // currentDate: DateTime(2020, 10, 18), + firstDate: DateTime(2000, 1, 1), // 开始日期 + lastDate: DateTime(2100, 1, 1), // 结束日期 + initialCalendarMode: mode, // 日期选择样式 + // 选中日期改变回调函数 + onDateChanged:seletAction, + // 月份改变回调函数 + onDisplayedMonthChanged: (dateTime){ + print("onDisplayedMonthChanged $dateTime"); + }, + // 筛选日期可不可点回调函数 + selectableDayPredicate: (dayTime){ + if(dayTime == DateTime(2020, 10, 15) || dayTime == DateTime(2020, 10, 16) || dayTime == DateTime(2020, 10, 17)) { + return false; + } + return true; + } + ); + } +} diff --git a/star_lock/lib/translations/lanKeyEntity.dart b/star_lock/lib/translations/lanKeyEntity.dart index f5189989..959e3b31 100644 --- a/star_lock/lib/translations/lanKeyEntity.dart +++ b/star_lock/lib/translations/lanKeyEntity.dart @@ -27,13 +27,20 @@ class LanKeyEntity { this.failureTime, this.effectiveDate, this.failureDate, - this.Monday, - this.Tuesday, - this.Wednesday, - this.Thursday, - this.Friday, - this.Saturday, - this.Sunday, + this.monday, + this.tuesday, + this.wednesday, + this.thursday, + this.friday, + this.saturday, + this.sunday, + this.mondayShort, + this.tuesdayShort, + this.wednesdayShort, + this.thursdayShort, + this.fridayShort, + this.saturdayShort, + this.sundayShort, this.realNameAuthentication, this.sendKeyBottomTip, @@ -151,6 +158,32 @@ class LanKeyEntity { this.work, this.workday, this.holidays, + this.punchingMode, + this.whetherTheEmployeeHasAKey, + this.selectKey, + this.officeHours, + this.closingTime, + this.thisWeek, + this.singleDayWeekend, + this.twoDaysOff, + this.oddOrEvenDaysOff, + this.year, + this.month, + this.libertyDay, + this.coverDate, + this.addedHoliday, + this.startDate, + this.accessDate, + this.mustFillIn, + this.endDate, + this.dailyCharts, + this.monthlyLeaderboard, + this.noAttendanceRecord, + this.everyoneIsVeryMotivated, + this.workingHoursWereNotReleased, + this.beLate, + this.leaveEarly, + this.noCardPunched, this.lanEnglish, this.lanChinese, @@ -244,13 +277,20 @@ class LanKeyEntity { failureTime = json['failureTime']; effectiveDate = json['effectiveDate']; failureDate = json['failureDate']; - Monday = json['Monday']; - Tuesday = json['Tuesday']; - Wednesday = json['Wednesday']; - Thursday = json['Thursday']; - Friday = json['Friday']; - Saturday = json['Saturday']; - Sunday = json['Sunday']; + monday = json['monday']; + tuesday = json['tuesday']; + wednesday = json['wednesday']; + thursday = json['thursday']; + friday = json['friday']; + saturday = json['saturday']; + sunday = json['sunday']; + mondayShort = json['mondayShort']; + tuesdayShort = json['tuesdayShort']; + wednesdayShort = json['wednesdayShort']; + thursdayShort = json['thursdayShort']; + fridayShort = json['fridayShort']; + saturdayShort = json['saturdayShort']; + sundayShort = json['sundayShort']; realNameAuthentication = json['realNameAuthentication']; sendKeyBottomTip = json['sendKeyBottomTip']; @@ -368,6 +408,32 @@ class LanKeyEntity { work = json['work']; workday = json['workday']; holidays = json['holidays']; + punchingMode = json['punchingMode']; + whetherTheEmployeeHasAKey = json['whetherTheEmployeeHasAKey']; + selectKey = json['selectKey']; + officeHours = json['officeHours']; + closingTime = json['closingTime']; + thisWeek = json['thisWeek']; + singleDayWeekend = json['singleDayWeekend']; + twoDaysOff = json['twoDaysOff']; + oddOrEvenDaysOff = json['oddOrEvenDaysOff']; + year = json['year']; + month = json['month']; + libertyDay = json['libertyDay']; + coverDate = json['coverDate']; + addedHoliday = json['addedHoliday']; + startDate = json['startDate']; + accessDate = json['accessDate']; + mustFillIn = json['mustFillIn']; + endDate = json['endDate']; + dailyCharts = json['dailyCharts']; + monthlyLeaderboard = json['monthlyLeaderboard']; + noAttendanceRecord = json['noAttendanceRecord']; + everyoneIsVeryMotivated = json['everyoneIsVeryMotivated']; + workingHoursWereNotReleased = json['workingHoursWereNotReleased']; + beLate = json['beLate']; + leaveEarly = json['leaveEarly']; + noCardPunched = json['noCardPunched']; lanEnglish = json['lanEnglish']; lanChinese = json['lanChinese']; @@ -459,13 +525,20 @@ class LanKeyEntity { String failureTime; String effectiveDate; String failureDate; - String Monday; - String Tuesday; - String Wednesday; - String Thursday; - String Friday; - String Saturday; - String Sunday; + String monday; + String tuesday; + String wednesday; + String thursday; + String friday; + String saturday; + String sunday; + String mondayShort; + String tuesdayShort; + String wednesdayShort; + String thursdayShort; + String fridayShort; + String saturdayShort; + String sundayShort; String realNameAuthentication; String sendKeyBottomTip; @@ -548,6 +621,33 @@ class LanKeyEntity { String work; String workday; String holidays; + String punchingMode; + String whetherTheEmployeeHasAKey; + String selectKey; + String officeHours; + String closingTime; + String thisWeek; + String singleDayWeekend; + String twoDaysOff; + String oddOrEvenDaysOff; + String year; + String month; + String libertyDay; + String coverDate; + String addedHoliday; + String startDate; + String accessDate; + String mustFillIn; + String endDate; + String dailyCharts; + String monthlyLeaderboard; + String noAttendanceRecord; + String everyoneIsVeryMotivated; + String workingHoursWereNotReleased; + String beLate; + String leaveEarly; + String noCardPunched; + String basicInformation; String wirelessKeyboard; @@ -676,13 +776,20 @@ class LanKeyEntity { map['failureTime'] = failureTime; map['effectiveDate'] = effectiveDate; map['failureDate'] = failureDate; - map['Monday'] = Monday; - map['Tuesday'] = Tuesday; - map['Wednesday'] = Wednesday; - map['Thursday'] = Thursday; - map['Friday'] = Friday; - map['Saturday'] = Saturday; - map['Sunday'] = Sunday; + map['monday'] = monday; + map['tuesday'] = tuesday; + map['wednesday'] = wednesday; + map['thursday'] = thursday; + map['friday'] = friday; + map['saturday'] = saturday; + map['sunday'] = sunday; + map['mondayShort'] = mondayShort; + map['tuesdayShort'] = tuesdayShort; + map['wednesdayShort'] = wednesdayShort; + map['thursdayShort'] = thursdayShort; + map['fridayShort'] = fridayShort; + map['saturdayShort'] = saturdayShort; + map['sundayShort'] = sundayShort; map['realNameAuthentication'] = realNameAuthentication; map['sendKeyBottomTip'] = sendKeyBottomTip; @@ -801,7 +908,33 @@ class LanKeyEntity { map['work'] = work; map['workday'] = workday; map['holidays'] = holidays; - + map['punchingMode'] = punchingMode; + map['whetherTheEmployeeHasAKey'] = whetherTheEmployeeHasAKey; + map['selectKey'] = selectKey; + map['officeHours'] = officeHours; + map['closingTime'] = closingTime; + map['thisWeek'] = thisWeek; + map['singleDayWeekend'] = singleDayWeekend; + map['twoDaysOff'] = twoDaysOff; + map['oddOrEvenDaysOff'] = oddOrEvenDaysOff; + map['year'] = year; + map['month'] = month; + map['libertyDay'] = libertyDay; + map['coverDate'] = coverDate; + map['addedHoliday'] = addedHoliday; + map['startDate'] = startDate; + map['accessDate'] = accessDate; + map['mustFillIn'] = mustFillIn; + map['endDate'] = endDate; + map['dailyCharts'] = dailyCharts; + map['monthlyLeaderboard'] = monthlyLeaderboard; + map['noAttendanceRecord'] = noAttendanceRecord; + map['everyoneIsVeryMotivated'] = everyoneIsVeryMotivated; + map['workingHoursWereNotReleased'] = workingHoursWereNotReleased; + map['beLate'] = beLate; + map['leaveEarly'] = leaveEarly; + map['noCardPunched'] = noCardPunched; + map['lanEnglish'] = lanEnglish; map['lanChinese'] = lanChinese; map['multilingual'] = multilingual; diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 202cb874..ac72deda 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -58,7 +58,10 @@ dependencies: flutter_picker: ^2.1.0 #生成二维码 qr_flutter: ^4.0.0 - + #底部选择 + flutter_pickers: ^2.1.9 + #万年历 + syncfusion_flutter_datepicker: ^18.4.48 dev_dependencies: flutter_test: sdk: flutter