|  |  |  | @ -3,7 +3,11 @@ import 'dart:io'; | 
		
	
		
			
				|  |  |  |  | import 'package:easy_localization/easy_localization.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter/material.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_svg/flutter_svg.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:google_maps_flutter/google_maps_flutter.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:geolocator/geolocator.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:huawei_location/location/fused_location_provider_client.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:huawei_location/location/location_request.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:huawei_location/location/location_settings_request.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:huawei_location/permission/permission_handler.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/app_state/app_state.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/colors.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -21,6 +25,7 @@ import 'package:mohem_flutter_app/widgets/location/Location.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:nfc_manager/nfc_manager.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:permission_handler/permission_handler.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:wifi_iot/wifi_iot.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class MarkAttendanceWidget extends StatefulWidget { | 
		
	
	
		
			
				
					|  |  |  | @ -39,6 +44,8 @@ class MarkAttendanceWidget extends StatefulWidget { | 
		
	
		
			
				|  |  |  |  | class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |   bool isNfcEnabled = false, isNfcLocationEnabled = false, isQrEnabled = false, isQrLocationEnabled = false, isWifiEnabled = false, isWifiLocationEnabled = false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   int _locationUpdateCbId = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void initState() { | 
		
	
		
			
				|  |  |  |  |     super.initState(); | 
		
	
	
		
			
				
					|  |  |  | @ -66,6 +73,36 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void checkHuaweiLocationPermission(String attendanceType) async { | 
		
	
		
			
				|  |  |  |  |     PermissionHandler permissionHandler = PermissionHandler(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (await permissionHandler.hasLocationPermission()) { | 
		
	
		
			
				|  |  |  |  |       getHuaweiCurrentLocation(attendanceType); | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
		
			
				|  |  |  |  |       bool has = await requestPermissions(); | 
		
	
		
			
				|  |  |  |  |       if (has) { | 
		
	
		
			
				|  |  |  |  |         getHuaweiCurrentLocation(attendanceType); | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         showDialog( | 
		
	
		
			
				|  |  |  |  |           context: context, | 
		
	
		
			
				|  |  |  |  |           builder: (BuildContext cxt) => ConfirmDialog( | 
		
	
		
			
				|  |  |  |  |             message: "You need to give location permission to mark attendance", | 
		
	
		
			
				|  |  |  |  |             onTap: () { | 
		
	
		
			
				|  |  |  |  |               Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |           ), | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<bool> requestPermissions() async { | 
		
	
		
			
				|  |  |  |  |     var result = await [ | 
		
	
		
			
				|  |  |  |  |       Permission.location, | 
		
	
		
			
				|  |  |  |  |     ].request(); | 
		
	
		
			
				|  |  |  |  |     return (result[Permission.location] == PermissionStatus.granted || result[Permission.locationAlways] == PermissionStatus.granted); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void dispose() { | 
		
	
		
			
				|  |  |  |  |     super.dispose(); | 
		
	
	
		
			
				
					|  |  |  | @ -75,7 +112,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Widget build(BuildContext context) { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     return Container( | 
		
	
		
			
				|  |  |  |  |       padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), | 
		
	
		
			
				|  |  |  |  |       decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), | 
		
	
	
		
			
				
					|  |  |  | @ -96,13 +132,17 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |               // if (isNfcEnabled) | 
		
	
		
			
				|  |  |  |  |               attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { | 
		
	
		
			
				|  |  |  |  |                 if (isNfcLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                   Location.getCurrentLocation((LatLng? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                     if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                       markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                     } else { | 
		
	
		
			
				|  |  |  |  |                       performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                     } | 
		
	
		
			
				|  |  |  |  |                   }, context); | 
		
	
		
			
				|  |  |  |  |                   if (AppState().getIsHuawei) { | 
		
	
		
			
				|  |  |  |  |                     checkHuaweiLocationPermission("NFC"); | 
		
	
		
			
				|  |  |  |  |                   } else { | 
		
	
		
			
				|  |  |  |  |                     Location.getCurrentLocation((Position position, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                       if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                         markFakeAttendance("NFC", position.latitude.toString() ?? "", position.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                       } else { | 
		
	
		
			
				|  |  |  |  |                         performNfcAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                       } | 
		
	
		
			
				|  |  |  |  |                     }, context); | 
		
	
		
			
				|  |  |  |  |                   } | 
		
	
		
			
				|  |  |  |  |                 } else { | 
		
	
		
			
				|  |  |  |  |                   performNfcAttendance(widget.model); | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
	
		
			
				
					|  |  |  | @ -110,28 +150,35 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |               if (isWifiEnabled) | 
		
	
		
			
				|  |  |  |  |                 attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { | 
		
	
		
			
				|  |  |  |  |                   if (isWifiLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                     Location.getCurrentLocation((LatLng? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                       if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                         markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                       } else { | 
		
	
		
			
				|  |  |  |  |                         performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                       } | 
		
	
		
			
				|  |  |  |  |                     }, context); | 
		
	
		
			
				|  |  |  |  |                     if (AppState().getIsHuawei) { | 
		
	
		
			
				|  |  |  |  |                       checkHuaweiLocationPermission("WIFI"); | 
		
	
		
			
				|  |  |  |  |                     } else { | 
		
	
		
			
				|  |  |  |  |                       Location.getCurrentLocation((Position position, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                         if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                           markFakeAttendance("WIFI", position.latitude.toString() ?? "", position.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                         } else { | 
		
	
		
			
				|  |  |  |  |                           performWifiAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                         } | 
		
	
		
			
				|  |  |  |  |                       }, context); | 
		
	
		
			
				|  |  |  |  |                     } | 
		
	
		
			
				|  |  |  |  |                   } else { | 
		
	
		
			
				|  |  |  |  |                     performWifiAttendance(widget.model); | 
		
	
		
			
				|  |  |  |  |                   } | 
		
	
		
			
				|  |  |  |  |                   // connectWifi(); | 
		
	
		
			
				|  |  |  |  |                 }), | 
		
	
		
			
				|  |  |  |  |               if (isQrEnabled) | 
		
	
		
			
				|  |  |  |  |                 attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { | 
		
	
		
			
				|  |  |  |  |                   if (isQrLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                     Location.getCurrentLocation((LatLng? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                       if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                         markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                       } else { | 
		
	
		
			
				|  |  |  |  |                         performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                       } | 
		
	
		
			
				|  |  |  |  |                     }, context); | 
		
	
		
			
				|  |  |  |  |                     if (AppState().getIsHuawei) { | 
		
	
		
			
				|  |  |  |  |                       checkHuaweiLocationPermission("QR"); | 
		
	
		
			
				|  |  |  |  |                     } else { | 
		
	
		
			
				|  |  |  |  |                       Location.getCurrentLocation((Position position, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                         if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                           markFakeAttendance("QR", position.latitude.toString() ?? "", position.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                         } else { | 
		
	
		
			
				|  |  |  |  |                           performQrCodeAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                         } | 
		
	
		
			
				|  |  |  |  |                       }, context); | 
		
	
		
			
				|  |  |  |  |                     } | 
		
	
		
			
				|  |  |  |  |                   } else { | 
		
	
		
			
				|  |  |  |  |                     performQrCodeAttendance(widget.model); | 
		
	
		
			
				|  |  |  |  |                   } | 
		
	
	
		
			
				
					|  |  |  | @ -144,9 +191,58 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getHuaweiCurrentLocation(String attendanceType) { | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       FusedLocationProviderClient locationService = FusedLocationProviderClient(); | 
		
	
		
			
				|  |  |  |  |       LocationRequest locationRequest = LocationRequest(); | 
		
	
		
			
				|  |  |  |  |       locationRequest.priority = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY; | 
		
	
		
			
				|  |  |  |  |       locationRequest.interval = 1000; | 
		
	
		
			
				|  |  |  |  |       List<LocationRequest> locationRequestList = <LocationRequest>[locationRequest]; | 
		
	
		
			
				|  |  |  |  |       LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       locationService.checkLocationSettings(locationSettingsRequest).then((settings) async { | 
		
	
		
			
				|  |  |  |  |         await locationService.getLastLocation().then((value) { | 
		
	
		
			
				|  |  |  |  |           if (value.latitude == null || value.longitude == null) { | 
		
	
		
			
				|  |  |  |  |             showDialog( | 
		
	
		
			
				|  |  |  |  |               context: context, | 
		
	
		
			
				|  |  |  |  |               builder: (BuildContext cxt) => ConfirmDialog( | 
		
	
		
			
				|  |  |  |  |                 message: "Unable to get your location, Please check your location settings & try again.", | 
		
	
		
			
				|  |  |  |  |                 onTap: () { | 
		
	
		
			
				|  |  |  |  |                   Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                 }, | 
		
	
		
			
				|  |  |  |  |               ), | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |           } else { | 
		
	
		
			
				|  |  |  |  |             if (attendanceType == "QR") { | 
		
	
		
			
				|  |  |  |  |               performQrCodeAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             if (attendanceType == "WIFI") { | 
		
	
		
			
				|  |  |  |  |               performWifiAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             if (attendanceType == "NFC") { | 
		
	
		
			
				|  |  |  |  |               performNfcAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         }).catchError((error) { | 
		
	
		
			
				|  |  |  |  |           print("HUAWEI LOCATION getLastLocation ERROR!!!!!"); | 
		
	
		
			
				|  |  |  |  |           print(error); | 
		
	
		
			
				|  |  |  |  |         }); | 
		
	
		
			
				|  |  |  |  |       }).catchError((error) { | 
		
	
		
			
				|  |  |  |  |         print("HUAWEI LOCATION checkLocationSettings ERROR!!!!!"); | 
		
	
		
			
				|  |  |  |  |         print(error); | 
		
	
		
			
				|  |  |  |  |         if (error.code == "LOCATION_SETTINGS_NOT_AVAILABLE") { | 
		
	
		
			
				|  |  |  |  |           // Location service not enabled. | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       }); | 
		
	
		
			
				|  |  |  |  |     } catch(error) { | 
		
	
		
			
				|  |  |  |  |       print("HUAWEI LOCATION ERROR!!!!!"); | 
		
	
		
			
				|  |  |  |  |       print(error); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { | 
		
	
		
			
				|  |  |  |  |     if (Platform.isIOS) { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       Utils.readNFc(onRead: (String nfcId) async { | 
		
	
		
			
				|  |  |  |  |         Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
	
		
			
				
					|  |  |  | @ -215,7 +311,25 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<bool> checkSession() async { | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       await DashboardApiClient().getOpenMissingSwipes(); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       return true; | 
		
	
		
			
				|  |  |  |  |     } catch (ex) { | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |       return false; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { | 
		
	
		
			
				|  |  |  |  |     if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |       if (!(await checkSession())) { | 
		
	
		
			
				|  |  |  |  |         return; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |     bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", | 
		
	
		
			
				|  |  |  |  |         password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); | 
		
	
	
		
			
				
					|  |  |  | @ -228,7 +342,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (isConnected) { | 
		
	
		
			
				|  |  |  |  |     if (isConnected && AppState().isAuthenticated) { | 
		
	
		
			
				|  |  |  |  |       await WiFiForIoTPlugin.forceWifiUsage(true); | 
		
	
		
			
				|  |  |  |  |       await Future.delayed(const Duration(seconds: 6)); | 
		
	
		
			
				|  |  |  |  |       try { | 
		
	
	
		
			
				
					|  |  |  | @ -236,20 +350,38 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |         bool status = await model.fetchAttendanceTracking(context); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |         showMDialog( | 
		
	
		
			
				|  |  |  |  |           context, | 
		
	
		
			
				|  |  |  |  |           backgroundColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |           isDismissable: false, | 
		
	
		
			
				|  |  |  |  |           child: SuccessDialog(widget.isFromDashboard), | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |         if (g?.messageStatus == 2) { | 
		
	
		
			
				|  |  |  |  |           showDialog( | 
		
	
		
			
				|  |  |  |  |             barrierDismissible: true, | 
		
	
		
			
				|  |  |  |  |             context: context, | 
		
	
		
			
				|  |  |  |  |             builder: (cxt) => ConfirmDialog( | 
		
	
		
			
				|  |  |  |  |               message: g?.errorEndUserMessage ?? "", | 
		
	
		
			
				|  |  |  |  |               onTap: () { | 
		
	
		
			
				|  |  |  |  |                 Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |               }, | 
		
	
		
			
				|  |  |  |  |               onCloseTap: () {}, | 
		
	
		
			
				|  |  |  |  |             ), | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           showMDialog( | 
		
	
		
			
				|  |  |  |  |             context, | 
		
	
		
			
				|  |  |  |  |             backgroundColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |             isDismissable: false, | 
		
	
		
			
				|  |  |  |  |             child: SuccessDialog(widget.isFromDashboard), | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } catch (ex) { | 
		
	
		
			
				|  |  |  |  |         await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); | 
		
	
		
			
				|  |  |  |  |       if (AppState().isAuthenticated) { | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         await closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -272,12 +404,26 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |         GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); | 
		
	
		
			
				|  |  |  |  |         bool status = await model.fetchAttendanceTracking(context); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         showMDialog( | 
		
	
		
			
				|  |  |  |  |           context, | 
		
	
		
			
				|  |  |  |  |           backgroundColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |           isDismissable: true, | 
		
	
		
			
				|  |  |  |  |           child: SuccessDialog(widget.isFromDashboard), | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |         if (g?.messageStatus == 2) { | 
		
	
		
			
				|  |  |  |  |           showDialog( | 
		
	
		
			
				|  |  |  |  |             barrierDismissible: true, | 
		
	
		
			
				|  |  |  |  |             context: context, | 
		
	
		
			
				|  |  |  |  |             builder: (cxt) => ConfirmDialog( | 
		
	
		
			
				|  |  |  |  |               message: g?.errorEndUserMessage ?? "", | 
		
	
		
			
				|  |  |  |  |               onTap: () { | 
		
	
		
			
				|  |  |  |  |                 Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |               }, | 
		
	
		
			
				|  |  |  |  |               onCloseTap: () {}, | 
		
	
		
			
				|  |  |  |  |             ), | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           showMDialog( | 
		
	
		
			
				|  |  |  |  |             context, | 
		
	
		
			
				|  |  |  |  |             backgroundColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |             isDismissable: true, | 
		
	
		
			
				|  |  |  |  |             child: SuccessDialog(widget.isFromDashboard), | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } catch (ex) { | 
		
	
		
			
				|  |  |  |  |         print(ex); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
	
		
			
				
					|  |  |  | 
 |