From 339b343c4cc9f4a1b7f39aa97679e8cbb9211f59 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 11 May 2022 10:24:34 +0300 Subject: [PATCH] fix calendar --- assets/langs/ar-SA.json | 19 ++++++ assets/langs/en-US.json | 21 ++++++- lib/generated/codegen_loader.g.dart | 40 +++++++++++- lib/ui/attendance/monthly_attendance.dart | 77 ++++++++++++++++------- 4 files changed, 132 insertions(+), 25 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 9c9b933..614e233 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -50,6 +50,25 @@ "changePassword": "تغيير كلمة المرور", "itemsForSale": "سلع للبيع", "attendanceDetails": "تفاصيل الحضور", + "order": "الطلبات", + "earlyOut" : "الخروج مبكرا", + "shortage" : "ساعات التقصير", + "excess" : "Excess", + "lateIn" : "القدوم المتاخر", + "approvedCheckOut": "وقت الخروج", + "approvedCheckIn":"وقت الدخول", + "actualCheckOut": "وقت الخروج", + "actualCheckIn": "وقت الدخول", + "present": "حضور", + "shiftTime": "وقت التناوب", + "absent": "غياب", + "attendance": "الحضور", + "scheduleDays" :"ايام العمل", + "offDays":"ايام الراحه", + "nonAnalyzed" : "لايوجد تحليل", + "shortageHour": "ساعات التقصير", + "stats": "الحاله", + "completed": "تم اكمال", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 538c567..221da4a 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -49,7 +49,26 @@ "loginCodeWillSentToMobileNumber": "Please Enter your Employee ID, A login code will be sent to your mobile number", "changePassword": "Change Password", "itemsForSale": "Items for Sale", - "attendanceDetails": "Attendence Details", + "attendanceDetails": "Attendance Details", + "order": "order", + "earlyOut" : "Early Out", + "shortage" : "Shortage", + "excess" : "Excess", + "lateIn" : "Late In", + "approvedCheckOut": "Approved Check Out", + "approvedCheckIn":"Approved Check In", + "actualCheckOut": "Actual Check Out", + "actualCheckIn": "Actual Check In", + "present": "PRESENT 11", + "shiftTime": "Shift Time", + "absent": "ABSENT 10", + "attendance": "Attendance", + "scheduleDays" :"Schedule\nDays", + "offDays":"Off\nDays", + "nonAnalyzed" : "Non\nAnalyzed", + "shortageHour": "Shortage\nHour", + "stats": "Stats", + "completed": "Completed", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 23003fe..522166a 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -66,6 +66,25 @@ class CodegenLoader extends AssetLoader{ "changePassword": "تغيير كلمة المرور", "itemsForSale": "سلع للبيع", "attendanceDetails": "تفاصيل الحضور", + "order": "الطلبات", + "earlyOut": "الخروج مبكرا", + "shortage": "ساعات التقصير", + "excess": "Excess", + "lateIn": "القدوم المتاخر", + "approvedCheckOut": "وقت الخروج", + "approvedCheckIn": "وقت الدخول", + "actualCheckOut": "وقت الخروج", + "actualCheckIn": "وقت الدخول", + "present": "حضور", + "shiftTime": "وقت التناوب", + "absent": "غياب", + "attendance": "الحضور", + "scheduleDays": "ايام العمل", + "offDays": "ايام الراحه", + "nonAnalyzed": "لايوجد تحليل", + "shortageHour": "ساعات التقصير", + "stats": "الحاله", + "completed": "تم اكمال", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", @@ -155,7 +174,26 @@ static const Map en_US = { "loginCodeWillSentToMobileNumber": "Please Enter your Employee ID, A login code will be sent to your mobile number", "changePassword": "Change Password", "itemsForSale": "Items for Sale", - "attendanceDetails": "Attendence Details", + "attendanceDetails": "Attendance Details", + "order": "order", + "earlyOut": "Early Out", + "shortage": "Shortage", + "excess": "Excess", + "lateIn": "Late In", + "approvedCheckOut": "Approved Check Out", + "approvedCheckIn": "Approved Check In", + "actualCheckOut": "Actual Check Out", + "actualCheckIn": "Actual Check In", + "present": "PRESENT 11", + "shiftTime": "Shift Time", + "absent": "ABSENT 10", + "attendance": "Attendance", + "scheduleDays": "Schedule\nDays", + "offDays": "Off\nDays", + "nonAnalyzed": "Non\nAnalyzed", + "shortageHour": "Shortage\nHour", + "stats": "Stats", + "completed": "Completed", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index ff370a3..af7df52 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; @@ -26,8 +27,12 @@ class _MonthlyAttendanceState extends State { bool isMissingDays = true; bool isOffDays = true; + + DateTime date = DateTime.now(); + late var formattedDate; @override void initState() { + formattedDate = DateFormat('d-MMM-yy').format(date); super.initState(); } @@ -61,14 +66,16 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Attendance".toText24(isBold: true, color: MyColors.darkIconColor), + LocaleKeys.attendance + .tr().toText24(isBold: true, color: MyColors.darkIconColor), Row( children: [ - "June 13, 2021".toText16(color: MyColors.greyACColor), + Text(formattedDate), + // "June 13, 2021".toText16(color: MyColors.greyACColor), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), ], - ).onPress(() { - showDatePicker( + ).onPress(() async { + await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2021), @@ -87,7 +94,14 @@ class _MonthlyAttendanceState extends State { child: child!, ); }, - ); + ).then((selectedDate) { + if (selectedDate != null) { + setState(() { + date = selectedDate; + formattedDate = DateFormat('d-MMM-yy').format(selectedDate); + }); + } + }); }) ], ).paddingOnly(left: 21, right: 21), @@ -96,13 +110,16 @@ class _MonthlyAttendanceState extends State { Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - optionUI("Schedule\nDays", "16"), + optionUI(LocaleKeys.scheduleDays.tr(), "16"), 6.width, - optionUI("Off\nDays", "0"), + optionUI(LocaleKeys.offDays + .tr(), "0"), 6.width, - optionUI("Non\nAnalyzed", "0"), + optionUI(LocaleKeys.nonAnalyzed + .tr(), "0"), 6.width, - optionUI("Shortage\nHour", "6"), + optionUI(LocaleKeys.shortageHour + .tr(), "6"), ], ).paddingOnly(left: 21, right: 21), 35.height, @@ -127,8 +144,10 @@ class _MonthlyAttendanceState extends State { children: [ Column( children: [ - "Attendance".toText12(isBold: true, color: MyColors.grey3AColor), - "Stats".toText24(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.attendance + .tr().toText12(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.stats + .tr().toText24(isBold: true, color: MyColors.grey3AColor), ], ).paddingOnly(left: 21, top: 29, bottom: 36), Row( @@ -143,7 +162,8 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: "PRESENT 16".toText16(isBold: true, color: MyColors.lightGreenColor), + child: LocaleKeys.present + .tr().toText16(isBold: true, color: MyColors.lightGreenColor), ), ], ).paddingOnly(left: 21, right: 23), @@ -160,7 +180,8 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: "ABSENT 04".toText16( + child: LocaleKeys.absent + .tr().toText16( isBold: true, color: MyColors.backgroundBlackColor, ), @@ -432,9 +453,11 @@ class _MonthlyAttendanceState extends State { mainAxisSize: MainAxisSize.min, children: [ "99%".toText44(color: Colors.white, isBold: true), - "Completed".tr().toText11(color: MyColors.greyACColor), + LocaleKeys.completed + .tr().toText11(color: MyColors.greyACColor), 19.height, - "Shift Time".tr().toText11(color: MyColors.greyACColor), + LocaleKeys.shiftTime + .tr().toText11(color: MyColors.greyACColor), "08:00 - 17:00".toText22(color: Colors.white, isBold: true), ], ), @@ -464,7 +487,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Actual Check In ".tr().toText11( + LocaleKeys.actualCheckIn + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -476,7 +500,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Actual Check Out".tr().toText11( + LocaleKeys.actualCheckOut + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -499,7 +524,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Approved Check In".tr().toText11( + LocaleKeys.approvedCheckIn + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -511,7 +537,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Approved Check Out".tr().toText11( + LocaleKeys.approvedCheckOut + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -534,7 +561,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Late In".tr().toText11( + LocaleKeys.lateIn + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -546,7 +574,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Excess".tr().toText11( + LocaleKeys.excess + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -569,7 +598,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Shortage".tr().toText11( + LocaleKeys.shortage + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -581,7 +611,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Early Out".tr().toText11( + LocaleKeys.earlyOut + .tr().toText11( color: MyColors.grey67Color, ), 8.height,