@ -95,64 +95,76 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
? Center ( child: CircularProgressIndicator ( ) )
: Column (
children: [
Container (
width: double . infinity ,
color: MyColors . backgroundBlackColor ,
padding: EdgeInsets . only ( top: 4 , left: 21 , right: 21 , bottom: 21 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
DateUtil . getWeekDayMonthDayYearDateFormatted ( DateTime . now ( ) , " en " ) . toText24 ( isBold: true , color: Colors . white ) ,
LocaleKeys . timeLeftToday . tr ( ) . toText16 ( color: Color ( 0xffACACAC ) ) ,
/ / 21. height ,
Center (
child: AspectRatio (
aspectRatio: 265 / 265 ,
child: CircularStepProgressBar (
totalSteps: 16 * 4 ,
currentStep: ( model . progress * 100 ) . toInt ( ) ,
/ / width: 216 ,
/ / height: 216 ,
selectedColor: MyColors . gradiantEndColor ,
unselectedColor: MyColors . grey70Color ,
child: Center (
child: Column (
mainAxisSize: MainAxisSize . min ,
children: [
CountdownTimer (
endTime: model . endTime ,
onEnd: null ,
endWidget: " 00:00:00 " . toText32 ( color: Colors . white , isBold: true ) ,
textStyle: TextStyle ( color: Colors . white , fontSize: 32 , letterSpacing: - 1.92 , fontWeight: FontWeight . bold , height: 1 ) ,
Expanded (
flex: 2 ,
child: Container (
width: double . infinity ,
color: MyColors . backgroundBlackColor ,
padding: EdgeInsets . only ( top: 4 , left: 21 , right: 21 , bottom: 21 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
DateUtil . getWeekDayMonthDayYearDateFormatted ( DateTime . now ( ) , " en " ) . toText24 ( isBold: true , color: Colors . white ) ,
LocaleKeys . timeLeftToday . tr ( ) . toText16 ( color: Color ( 0xffACACAC ) ) ,
Center (
child: AspectRatio (
aspectRatio: 265 / 265 ,
child: CircularStepProgressBar (
totalSteps: 16 * 4 ,
currentStep: ( model . progress * 100 ) . toInt ( ) ,
selectedColor: MyColors . gradiantEndColor ,
unselectedColor: MyColors . grey70Color ,
child: Center (
child: Padding (
padding: const EdgeInsets . all ( 21.0 ) ,
child: Column (
mainAxisSize: MainAxisSize . min ,
children: [
CountdownTimer (
endTime: model . endTime ,
widgetBuilder: ( context , v ) {
return AutoSizeText (
getValue ( v ? . hours ) + " : " + getValue ( v ? . min ) + " : " + getValue ( v ? . sec ) ,
maxLines: 1 ,
style: TextStyle ( color: Colors . white , fontSize: 42 , letterSpacing: - 1.92 , fontWeight: FontWeight . bold , height: 1 ) ,
) ;
} ,
onEnd: null ,
endWidget: " 00:00:00 " . toTextAuto ( color: Colors . white , isBold: true , fontSize: 30 , letterSpacing: - 1.92 ) ,
textStyle: TextStyle ( color: Colors . white , fontSize: 30 , letterSpacing: - 1.92 , fontWeight: FontWeight . bold , height: 1 ) ,
) . center . expanded ,
LocaleKeys . shiftTime . tr ( ) . tr ( ) . toTextAuto ( color: MyColors . greyACColor , fontSize: 18 , maxLine: 1 ) ,
( model . attendanceTracking ! . pShtName ? ? " 00:00:00 " ) . toString ( ) . toTextAuto ( color: Colors . white , isBold: true , fontSize: 26 , maxLine: 1 ) ,
] ,
) ,
19. height ,
LocaleKeys . shiftTime . tr ( ) . tr ( ) . toText12 ( color: MyColors . greyACColor ) ,
( model . attendanceTracking ! . pShtName ? ? " 00:00:00 " ) . toString ( ) . toText22 ( color: Colors . white , isBold: true ) ,
] ,
) ,
) ,
) ,
) ,
) . paddingAll ( 21 ) ,
) . expanded ,
] ,
) . paddingAll ( 12 ) ,
) . expanded ,
] ,
) ,
) ,
) .expanded ,
) ,
Center (
child: Container (
/ / color: MyColors . backgroundBlackColor ,
decoration: const BoxDecoration (
borderRadius: BorderRadius . only ( topLeft: Radius . circular ( 25 ) , topRight: Radius . circular ( 25 ) ) ,
gradient: LinearGradient ( transform: GradientRotation ( . 64 ) , begin: Alignment . topRight , end: Alignment . bottomLeft , colors: [
MyColors . gradiantEndColor ,
MyColors . gradiantStartColor ,
] ) ,
gradient: LinearGradient (
transform: GradientRotation ( . 64 ) ,
begin: Alignment . topRight ,
end: Alignment . bottomLeft ,
colors: [
MyColors . gradiantEndColor ,
MyColors . gradiantStartColor ,
] ,
) ,
) ,
child: Column (
children: [
Container (
/ / height: 187 ,
padding: const EdgeInsets . only ( left: 31, right: 31 , top: 3 1, bottom: 16 ) ,
padding: const EdgeInsets . only ( left: 21, right: 21 , top: 2 1, bottom: 16 ) ,
decoration: const BoxDecoration (
borderRadius: BorderRadius . only ( topLeft: Radius . circular ( 25 ) , topRight: Radius . circular ( 25 ) ) ,
gradient: LinearGradient ( transform: GradientRotation ( . 64 ) , begin: Alignment . topRight , end: Alignment . bottomLeft , colors: [
@ -179,80 +191,7 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
) ,
) , / / . expanded ,
MarkAttendanceWidget ( model , topPadding: 24 ) ,
/ / Container (
/ / width: double . infinity ,
/ / decoration: BoxDecoration ( borderRadius: BorderRadius . only ( topLeft: Radius . circular ( 25 ) , topRight: Radius . circular ( 25 ) ) , color: Colors . white ) ,
/ / / / margin: EdgeInsets . only ( top: 187 - 31 ) ,
/ / padding: EdgeInsets . only ( left: 21 , right: 21 , top: 24 , bottom: 24 ) ,
/ / child: Column (
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / mainAxisSize: MainAxisSize . min ,
/ / children: [
/ / LocaleKeys . markAttendance . tr ( ) . toSectionHeading ( ) ,
/ / LocaleKeys . selectMethodOfAttendance . tr ( ) . tr ( ) . toText11 ( color: Color ( 0xff535353 ) ) ,
/ / 24. height ,
/ / GridView (
/ / physics: const NeverScrollableScrollPhysics ( ) ,
/ / shrinkWrap: true ,
/ / padding: EdgeInsets . zero ,
/ / gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 1 / 1 , crossAxisSpacing: 8 , mainAxisSpacing: 8 ) ,
/ / children: < Widget > [
/ / if ( isNfcEnabled )
/ / attendanceMethod ( " NFC " , " assets/images/nfc.svg " , isNfcEnabled , ( ) {
/ / if ( isNfcLocationEnabled ) {
/ / Location . getCurrentLocation ( ( LatLng ? latlng ) {
/ / performNfcAttendance ( model , lat: latlng ? . latitude . toString ( ) ? ? " " , lng: latlng ? . longitude . toString ( ) ? ? " " ) ;
/ / } ) ;
/ / } else {
/ / performNfcAttendance ( model ) ;
/ / }
/ / } ) ,
/ / if ( isWifiEnabled )
/ / attendanceMethod ( " Wifi " , " assets/images/wufu.svg " , isWifiEnabled , ( ) {
/ / if ( isWifiLocationEnabled ) {
/ / Location . getCurrentLocation ( ( LatLng ? latlng ) {
/ / performWifiAttendance ( model , lat: latlng ? . latitude . toString ( ) ? ? " " , lng: latlng ? . longitude . toString ( ) ? ? " " ) ;
/ / } ) ;
/ / } else {
/ / performWifiAttendance ( model ) ;
/ / }
/ / / / connectWifi ( ) ;
/ / } ) ,
/ / if ( isQrEnabled )
/ / attendanceMethod ( " QR " , " assets/images/ic_qr.svg " , isQrEnabled , ( ) async {
/ / if ( isQrLocationEnabled ) {
/ / Location . getCurrentLocation ( ( LatLng ? latlng ) {
/ / performQrCodeAttendance ( model , lat: latlng ? . latitude . toString ( ) ? ? " " , lng: latlng ? . longitude . toString ( ) ? ? " " ) ;
/ / } ) ;
/ / } else {
/ / performQrCodeAttendance ( model ) ;
/ / }
/ / / / performQrCodeAttendance ( model ) ;
/ / } ) ,
/ / ] ,
/ / )
/ / ] ,
/ / ) ,
/ / ) ,
/ / Positioned (
/ / top: 187 - 21 ,
/ / child: Container (
/ / padding: EdgeInsets . only ( left: 31 , right: 31 , top: 31 , bottom: 16 ) ,
/ / decoration: BoxDecoration ( borderRadius: BorderRadius . only ( topLeft: Radius . circular ( 25 ) , topRight: Radius . circular ( 25 ) ) , color: Colors . white ) ,
/ / child: Column (
/ / children: [
/ / Row (
/ / children: [ commonStatusView ( " Check In " , " 09:27 " ) , commonStatusView ( " Check Out " , " - - : - - " ) ] ,
/ / ) ,
/ / 21. height ,
/ / Row (
/ / children: [ commonStatusView ( " Late In " , " 00:27 " ) , commonStatusView ( " Regular " , " 08:00 " ) ] ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ,
/ / ) ,
MarkAttendanceWidget ( model , topPadding: 21 ) ,
] ,
) ,
) ,
@ -265,60 +204,6 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
) ;
}
/ / Future < void > performNfcAttendance ( DashboardProviderModel model , { String lat = " 0 " , String lng = " 0 " } ) async {
/ / if ( isNfcLocationEnabled ) {
/ / print ( " nfc location enabled " ) ;
/ / } else {
/ / print ( " nfc not location enabled " ) ;
/ / }
/ /
/ / showNfcReader ( context , onNcfScan: ( String ? nfcId ) async {
/ / print ( nfcId ) ;
/ / Utils . showLoading ( context ) ;
/ / try {
/ / GenericResponseModel ? g = await DashboardApiClient ( ) . markAttendance ( pointType: 2 , nfcValue: nfcId ? ? " " , isGpsRequired: isNfcLocationEnabled , lat: lat , long: lng ) ;
/ / bool status = await model . fetchAttendanceTracking ( context ) ;
/ / Utils . hideLoading ( context ) ;
/ / } catch ( ex ) {
/ / print ( ex ) ;
/ / Utils . hideLoading ( context ) ;
/ / Utils . handleException ( ex , context , ( msg ) {
/ / Utils . confirmDialog ( context , msg ) ;
/ / } ) ;
/ / }
/ / } ) ;
/ / }
/ /
/ / Future < void > performWifiAttendance ( DashboardProviderModel model , { String lat = " 0 " , String lng = " 0 " } ) async {
/ / if ( isWifiLocationEnabled ) {
/ / print ( " wifi location enabled " ) ;
/ / } else {
/ / print ( " wifi not location enabled " ) ;
/ / }
/ /
/ / bool v = await WiFiForIoTPlugin . connect ( AppState ( ) . mohemmWifiSSID ? ? " " , password: AppState ( ) . mohemmWifiPassword ? ? " " , joinOnce: true , security: NetworkSecurity . WPA , withInternet: false ) ;
/ / if ( v ) {
/ / await WiFiForIoTPlugin . forceWifiUsage ( true ) ;
/ / print ( " connected " ) ;
/ / Utils . showLoading ( context ) ;
/ / try {
/ / GenericResponseModel ? g = await DashboardApiClient ( ) . markAttendance ( pointType: 3 , nfcValue: " " , isGpsRequired: isWifiLocationEnabled , lat: lat , long: lng ) ;
/ / bool status = await model . fetchAttendanceTracking ( context ) ;
/ / Utils . hideLoading ( context ) ;
/ / await closeWifiRequest ( ) ;
/ / } catch ( ex ) {
/ / print ( ex ) ;
/ / await closeWifiRequest ( ) ;
/ / Utils . hideLoading ( context ) ;
/ / Utils . handleException ( ex , context , ( msg ) {
/ / Utils . confirmDialog ( context , msg ) ;
/ / } ) ;
/ / }
/ / } else {
/ / Utils . confirmDialog ( context , LocaleKeys . comeNearHMGWifi . tr ( ) ) ;
/ / }
/ / }
String getValue ( int ? v ) {
if ( v = = null ) {
return " 00 " ;
@ -335,63 +220,6 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
return v ;
}
/ / Future < void > performQrCodeAttendance ( DashboardProviderModel model , { String lat = " 0 " , String lng = " 0 " } ) async {
/ / var qrCodeValue = await Navigator . of ( context ) . push (
/ / MaterialPageRoute (
/ / builder: ( context ) = > QrScannerDialog ( ) ,
/ / ) ,
/ / ) ;
/ / if ( qrCodeValue ! = null ) {
/ / print ( " qrCode: " + qrCodeValue ) ;
/ / Utils . showLoading ( context ) ;
/ / try {
/ / GenericResponseModel ? g = await DashboardApiClient ( ) . markAttendance ( pointType: 1 , isGpsRequired: isQrLocationEnabled , lat: lat , long: lng , QRValue: qrCodeValue ) ;
/ / bool status = await model . fetchAttendanceTracking ( context ) ;
/ / Utils . hideLoading ( context ) ;
/ / } catch ( ex ) {
/ / print ( ex ) ;
/ / Utils . hideLoading ( context ) ;
/ / Utils . handleException ( ex , context , ( msg ) {
/ / Utils . confirmDialog ( context , msg ) ;
/ / } ) ;
/ / }
/ / }
/ / }
/ /
/ / Widget attendanceMethod ( String title , String image , bool isEnabled , VoidCallback onPress ) = > Container (
/ / decoration: BoxDecoration (
/ / borderRadius: BorderRadius . circular ( 15 ) ,
/ / gradient: const LinearGradient ( transform: GradientRotation ( . 64 ) , begin: Alignment . topRight , end: Alignment . bottomLeft , colors: [
/ / MyColors . gradiantEndColor ,
/ / MyColors . gradiantStartColor ,
/ / ] ) ,
/ / ) ,
/ / clipBehavior: Clip . antiAlias ,
/ / child: Stack (
/ / children: [
/ / Container (
/ / padding: const EdgeInsets . only ( left: 10 , right: 10 , top: 14 , bottom: 14 ) ,
/ / child: Column (
/ / crossAxisAlignment: CrossAxisAlignment . start ,
/ / children: [
/ / SvgPicture . asset (
/ / image ,
/ / color: Colors . white ,
/ / ) . expanded ,
/ / title . toText17 ( isBold: true , color: Colors . white ) ,
/ / ] ,
/ / ) ,
/ / ) ,
/ / if ( ! isEnabled )
/ / Container (
/ / width: double . infinity ,
/ / height: double . infinity ,
/ / color: Colors . grey . withOpacity ( 0.7 ) ,
/ / )
/ / ] ,
/ / ) ,
/ / ) . onPress ( onPress ) ;
Widget commonStatusView ( String title , String time ) = > Expanded (
child: Column ( mainAxisSize: MainAxisSize . min , crossAxisAlignment: CrossAxisAlignment . start , children: [
title . toText12 ( color: Colors . white . withOpacity ( . 69 ) ) ,