Merge branch 'master' into development_mirza

# Conflicts:
#	ios/Runner/Info.plist
#	lib/ui/my_team/view_attendance.dart
#	pubspec.yaml
merge-requests/12/head
Sikander Saleem 3 years ago
commit e71c5c829f

@ -32,8 +32,22 @@
<true/> <true/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>This app requires camera access to capture &amp; upload pictures.</string> <string>This app requires camera access to capture &amp; upload pictures.</string>
<key>NSFaceIDUsageDescription</key>
<string>This app requires Face ID to allow biometric authentication for app login.</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to select image as document &amp; upload it.</string> <string>This app requires photo library access to select image as document &amp; upload it.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This App requires access to your location to mark your attendance.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This App requires access to your location to mark your attendance.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This App requires access to your location to mark your attendance.</string>
<key>NFCReaderUsageDescription</key>
<string>This App requires access to NFC to mark your attendance.</string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
@ -53,5 +67,9 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>0000</string>
</array>
</dict> </dict>
</plist> </plist>

@ -1,7 +1,12 @@
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
class AppPermissions{ class AppPermissions {
static void location(Function(bool) completion) { static void location(Function(bool) completion, BuildContext context) {
Permission.location.isGranted.then((isGranted){ Permission.location.isGranted.then((isGranted){
if(!isGranted){ if(!isGranted){
Permission.location.request().then((granted){ Permission.location.request().then((granted){
@ -10,21 +15,34 @@ class AppPermissions{
} }
completion(isGranted); completion(isGranted);
}); });
} }
static void checkAll(Function(bool) completion){ static void showErrorLocationDialog(bool isPermissionError, BuildContext context) {
[ showDialog(
Permission.location context: context,
].request().then((value){ builder: (cxt) => ConfirmDialog(
message: "Please provide location permission",
onTap: () {
if (isPermissionError) {
Geolocator.openAppSettings();
} else {
Geolocator.openLocationSettings();
}
Navigator.pop(context);
// createVacationRule(list);
},
),
);
}
static void checkAll(Function(bool) completion) {
[Permission.location].request().then((value) {
bool allGranted = false; bool allGranted = false;
value.values.forEach((element) { value.values.forEach((element) {
allGranted = allGranted && element == PermissionStatus.granted; allGranted = allGranted && element == PermissionStatus.granted;
}); });
completion(allGranted); completion(allGranted);
}); });
} }
} }

@ -1,7 +1,7 @@
class ApiConsts { class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server //static String baseUrl = "http://10.200.204.20:2801/"; // Local server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";

@ -59,7 +59,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<String> namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"];
GlobalKey<ScaffoldState> _key = GlobalKey(); // GlobalKey<ScaffoldState> _key = GlobalKey(); //
return Scaffold( return Scaffold(
key: _scaffoldState, key: _scaffoldState,
@ -71,15 +70,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
return Row( return Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Image.memory( Image.memory(
Utils.getPostBytes( Utils.getPostBytes(
AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
), ),
errorBuilder: (BuildContext context, error, stackTrace) { errorBuilder: (BuildContext context, error, stackTrace) {
return SvgPicture.asset( return SvgPicture.asset(
"assets/images/user.svg", height: 34, width: 34, "assets/images/user.svg",
); height: 34,
}, width: 34,
);
},
width: 34, width: 34,
height: 34, height: 34,
fit: BoxFit.cover, fit: BoxFit.cover,

@ -136,8 +136,8 @@ class _AppDrawerState extends State<AppDrawer> {
AppState().isAuthenticated = false; AppState().isAuthenticated = false;
AppState().isLogged = false; AppState().isLogged = false;
AppState().setPostParamsInitConfig(); AppState().setPostParamsInitConfig();
SharedPreferences prefs = await SharedPreferences.getInstance(); // SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.clear(); // await prefs.clear();
Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route<dynamic> route) => false, arguments: false); Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route<dynamic> route) => false, arguments: null);
} }
} }

@ -50,7 +50,7 @@ class _LoginScreenState extends State<LoginScreen> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
// checkFirebaseToken(); // checkFirebaseToken();
} }
@override @override
@ -130,8 +130,8 @@ class _LoginScreenState extends State<LoginScreen> {
if (isAppOpenBySystem == null) { if (isAppOpenBySystem == null) {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
print('isAppOpenBySystem:$isAppOpenBySystem'); print('isAppOpenBySystem:$isAppOpenBySystem');
username.text = "15153"; // username.text = "15153";
password.text = "Abcd@12345"; // password.text = "Abcd@12345";
if (isAppOpenBySystem!) checkFirebaseToken(); if (isAppOpenBySystem!) checkFirebaseToken();
} }

@ -60,10 +60,10 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
leading: IconButton( // leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), // icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
onPressed: () => Navigator.pop(context), // onPressed: () => Navigator.pop(context),
), // ),
actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width], actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width],
), ),
body: Column( body: Column(
@ -211,7 +211,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
bool authenticated = false; bool authenticated = false;
try { try {
authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print(e); print(e);
Utils.hideLoading(context); Utils.hideLoading(context);
@ -238,12 +238,13 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
return; return;
} else { } else {
if (mobileLoginInfoListModel!.loginType == 2 || mobileLoginInfoListModel!.loginType == 3) { if (mobileLoginInfoListModel!.loginType == 2 || mobileLoginInfoListModel!.loginType == 3) {
bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics();
if (!authenticateWithFaceAndTouchID) { // if (!authenticateWithFaceAndTouchID) {
return; // return;
} else { // } else {
performApiCall(_title, _icon, _flag, isDirectLogin: true); // performApiCall(_title, _icon, _flag, isDirectLogin: true);
} // }
performApiCall(_title, _icon, _flag, isDirectLogin: true);
} else { } else {
isNeedVerifyWithFaceIDAndBiometrics = true; isNeedVerifyWithFaceIDAndBiometrics = true;
selectedFlag = _flag; selectedFlag = _flag;

@ -517,7 +517,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
bool authenticated = false; bool authenticated = false;
try { try {
authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print(e); print(e);
Utils.hideLoading(context); Utils.hideLoading(context);

@ -14,8 +14,8 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:month_picker_dialog_2/month_picker_dialog_2.dart';
import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart';
import 'package:month_picker_dialog_2/month_picker_dialog_2.dart';
import 'package:pie_chart/pie_chart.dart'; import 'package:pie_chart/pie_chart.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -405,6 +405,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
); );
} }
void calendarTapped(CalendarTapDetails details) async { void calendarTapped(CalendarTapDetails details) async {
dynamic index = details.date?.day; dynamic index = details.date?.day;
if (index != null) { if (index != null) {
@ -425,214 +426,213 @@ class _ViewAttendanceState extends State<ViewAttendance> {
} }
if (details.date!.month == formattedDate.month && details.date!.year == formattedDate.year) { if (details.date!.month == formattedDate.month && details.date!.year == formattedDate.year) {
int val = details.date!.day; int val = details.date!.day;
getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'Y' getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'Y' ?
? showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
isScrollControlled: true, isScrollControlled: true,
backgroundColor: MyColors.backgroundBlackColor, backgroundColor: MyColors.backgroundBlackColor,
builder: (_) { builder: (_) {
return DraggableScrollableSheet( return DraggableScrollableSheet(
maxChildSize: 0.9, maxChildSize: 0.9,
expand: false, expand: false,
builder: (_, controller) { builder: (_, controller) {
dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE; dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE;
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss a").parse(dmyString); DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss a").parse(dmyString);
return Column( return Column(
children: [ children: [
Container( Container(
width: 49, width: 49,
height: 7, height: 7,
margin: const EdgeInsets.symmetric(vertical: 10), margin: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(25),
color: MyColors.darkGreyColor, color: MyColors.darkGreyColor,
), ),
), ),
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
controller: controller, controller: controller,
itemCount: 1, itemCount: 1,
itemBuilder: (_, i) => Container( itemBuilder: (_, i) =>
decoration: const BoxDecoration( Container(
borderRadius: BorderRadius.vertical( decoration: const BoxDecoration(
top: Radius.circular(25.0), borderRadius: BorderRadius.vertical(
), top: Radius.circular(25.0),
color: MyColors.backgroundBlackColor,
), ),
child: Column( color: MyColors.backgroundBlackColor,
children: [ ),
Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Column(
"${DateFormat("MMMM-dd-yyyy").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white), crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor), children: [
12.height, "${DateFormat("MMMM-dd-yyyy").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white),
CircularStepProgressBar( LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor),
totalSteps: 16 * 4, 12.height,
currentStep: percentage, CircularStepProgressBar(
width: 224, totalSteps: 16 * 4,
height: 236, currentStep: percentage,
selectedColor: MyColors.gradiantEndColor, width: 224,
unselectedColor: MyColors.grey70Color, height: 236,
child: Column( selectedColor: MyColors.gradiantEndColor,
mainAxisSize: MainAxisSize.min, unselectedColor: MyColors.grey70Color,
children: [ child: Column(
"${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true), mainAxisSize: MainAxisSize.min,
LocaleKeys.completed.tr().toText11(color: MyColors.greyACColor), children: [
28.height, "${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true),
LocaleKeys.shiftTime.tr().toText11(color: MyColors.greyACColor), LocaleKeys.completed.tr().toText11(color: MyColors.greyACColor),
"${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true), 28.height,
], LocaleKeys.shiftTime.tr().toText11(color: MyColors.greyACColor),
).center, "${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true),
],
).center, ).center,
], ).center,
).paddingOnly(left: 21, right: 21, top: 27, bottom: 37), ],
Stack( ).paddingOnly(left: 21, right: 21, top: 27, bottom: 37),
children: [ Stack(
Container( children: [
width: double.infinity, Container(
decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), width: double.infinity,
padding: const EdgeInsets.only(left: 31, right: 31, top: 30, bottom: 29), decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white),
child: Column( padding: const EdgeInsets.only(left: 31, right: 31, top: 30, bottom: 29),
children: [ child: Column(
Row( children: [
children: [ Row(
Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.actualCheckIn.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.actualCheckIn.tr().toText11(
), color: MyColors.grey67Color,
"${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" != "" ),
? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true) "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" != ""
: "__".toText22(color: Colors.black, isBold: true), ? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true)
], : "__".toText22(color: Colors.black, isBold: true),
).expanded, ],
Column( ).expanded,
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.actualCheckOut.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.actualCheckOut.tr().toText11(
), color: MyColors.grey67Color,
"${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != "" ),
? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true) "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != ""
: "__".toText22(color: Colors.black, isBold: true), ? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true)
], : "__".toText22(color: Colors.black, isBold: true),
).expanded, ],
], ).expanded,
), ],
25.height, ),
const Divider( 25.height,
height: 1, const Divider(
thickness: 1, height: 1,
color: MyColors.lightGreyEFColor, thickness: 1,
), color: MyColors.lightGreyEFColor,
25.height, ),
Row( 25.height,
children: [ Row(
Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.approvedCheckIn.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.approvedCheckIn.tr().toText11(
), color: MyColors.grey67Color,
"${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" != "" ),
? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true) "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" != ""
: "__".toText22(color: MyColors.greenColor, isBold: true), ? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true)
], : "__".toText22(color: MyColors.greenColor, isBold: true),
).expanded, ],
Column( ).expanded,
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.approvedCheckOut.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.approvedCheckOut.tr().toText11(
), color: MyColors.grey67Color,
"${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}" != "" ),
? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true) "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}" != ""
: "__".toText22(color: MyColors.greenColor, isBold: true), ? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true)
], : "__".toText22(color: MyColors.greenColor, isBold: true),
).expanded, ],
], ).expanded,
), ],
25.height, ),
const Divider( 25.height,
height: 1, const Divider(
thickness: 1, height: 1,
color: MyColors.lightGreyEFColor, thickness: 1,
), color: MyColors.lightGreyEFColor,
25.height, ),
Row( 25.height,
children: [ Row(
Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.lateIn.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.lateIn.tr().toText11(
), color: MyColors.grey67Color,
"${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true), ),
], "${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true),
).expanded, ],
Column( ).expanded,
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.excess.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.excess.tr().toText11(
), color: MyColors.grey67Color,
"${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true), ),
], "${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
).expanded, ],
], ).expanded,
), ],
25.height, ),
const Divider( 25.height,
height: 1, const Divider(
thickness: 1, height: 1,
color: MyColors.lightGreyEFColor, thickness: 1,
), color: MyColors.lightGreyEFColor,
25.height, ),
Row( 25.height,
children: [ Row(
Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.shortage.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.shortage.tr().toText11(
), color: MyColors.grey67Color,
"${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true), ),
], "${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: MyColors.backgroundBlackColor, isBold: true),
).expanded, ],
Column( ).expanded,
crossAxisAlignment: CrossAxisAlignment.start, Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
LocaleKeys.earlyOut.tr().toText11( children: [
color: MyColors.grey67Color, LocaleKeys.earlyOut.tr().toText11(
), color: MyColors.grey67Color,
"${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true), ),
], "${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true),
).expanded, ],
], ).expanded,
), ],
], ),
), ],
), ),
], ),
), ],
], ),
), ],
), ),
), ),
), ),
], ),
); ],
}, );
); },
}, );
) },
: null; ):null;
} }
} }
List<Meeting> _getDataSource() { List<Meeting> _getDataSource() {
List<Meeting> meetings = <Meeting>[]; List<Meeting> meetings = <Meeting>[];
return meetings; return meetings;

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'dart:ui'; import 'dart:ui';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
@ -45,7 +46,7 @@ class Location {
}); });
} }
static void getCurrentLocation(Function(LatLng?) callback) { static void getCurrentLocation(Function(LatLng?) callback, BuildContext context) {
void done(Position position) { void done(Position position) {
//AppStorage.sp.saveLocation(position); //AppStorage.sp.saveLocation(position);
@ -64,8 +65,10 @@ class Location {
done(value); done(value);
} }
}); });
} else {
// AppPermissions
} }
}); }, context);
} }
// static LatLng locationAwayFrom( // static LatLng locationAwayFrom(
@ -137,11 +140,11 @@ class _Map {
}); });
} }
void goToCurrentLocation({Completer<GoogleMapController>? mapController, double? direction = 0.0, bool? animation}) { // void goToCurrentLocation({Completer<GoogleMapController>? mapController, double? direction = 0.0, bool? animation}) {
Location.getCurrentLocation((location) { // Location.getCurrentLocation((location) {
moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!); // moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!);
}); // });
} // }
var routes = Map<String, DirectionsRoute>(); var routes = Map<String, DirectionsRoute>();

@ -90,7 +90,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isNfcLocationEnabled) { if (isNfcLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) { Location.getCurrentLocation((LatLng? latlng) {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}); }, context);
} else { } else {
performNfcAttendance(widget.model); performNfcAttendance(widget.model);
} }
@ -100,7 +100,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isWifiLocationEnabled) { if (isWifiLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) { Location.getCurrentLocation((LatLng? latlng) {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}); }, context);
} else { } else {
performWifiAttendance(widget.model); performWifiAttendance(widget.model);
} }
@ -111,7 +111,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isQrLocationEnabled) { if (isQrLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) { Location.getCurrentLocation((LatLng? latlng) {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}); }, context);
} else { } else {
performQrCodeAttendance(widget.model); performQrCodeAttendance(widget.model);
} }
@ -158,16 +158,19 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
bool isConnected = bool isConnected =
await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", password: AppState().getMohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false); await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", password: AppState().getMohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false);
if (isConnected) { if (isConnected) {
Utils.showLoading(context);
await WiFiForIoTPlugin.forceWifiUsage(true); await WiFiForIoTPlugin.forceWifiUsage(true);
Utils.showLoading(context); await Future.delayed(Duration(seconds: 1));
try { try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng);
bool status = await model.fetchAttendanceTracking(context); bool status = await model.fetchAttendanceTracking(context);
Utils.hideLoading(context); Utils.hideLoading(context);
await closeWifiRequest(); // await closeWifiRequest();
} catch (ex) { } catch (ex) {
await closeWifiRequest(); print("performWifiAttendance: "+ex.toString());
// await closeWifiRequest();
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, (msg) { Utils.handleException(ex, context, (msg) {
Utils.confirmDialog(context, msg); Utils.confirmDialog(context, msg);
@ -179,7 +182,8 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
} }
Future<bool> closeWifiRequest() async { Future<bool> closeWifiRequest() async {
await WiFiForIoTPlugin.forceWifiUsage(false); // await WiFiForIoTPlugin.forceWifiUsage(false);
// Future.delayed(Duration(seconds: 2));
return await WiFiForIoTPlugin.disconnect(); return await WiFiForIoTPlugin.disconnect();
} }

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nfc_manager/nfc_manager.dart'; import 'package:nfc_manager/nfc_manager.dart';
@ -41,9 +42,13 @@ class _NfcLayoutState extends State<NfcLayout> {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
print(tag.data); print(tag.data);
var f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); var f;
if (Platform.isAndroid) {
f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
} else {
f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
}
String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join('');
// print(identifier); // => 0428fcf2255e81
nfcId = identifier; nfcId = identifier;
setState(() { setState(() {
@ -54,8 +59,16 @@ class _NfcLayoutState extends State<NfcLayout> {
Future.delayed(const Duration(seconds: 1), () { Future.delayed(const Duration(seconds: 1), () {
NfcManager.instance.stopSession(); NfcManager.instance.stopSession();
Navigator.pop(context); Navigator.pop(context);
// if (Platform.isAndroid) {
// Navigator.pop(context);
// } else {
// Navigator.pop(context);
// Navigator.pop(context);
// }
widget.onNcfScan(nfcId); widget.onNcfScan(nfcId);
}); });
}).catchError((err) {
print(err);
}); });
} }

@ -1,4 +1,5 @@
name: mohem_flutter_app name: mohem_flutter_app
description: A new Flutter application. description: A new Flutter application.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
@ -52,7 +53,7 @@ dependencies:
shimmer: ^2.0.0 shimmer: ^2.0.0
logger: ^1.1.0 logger: ^1.1.0
flutter_countdown_timer: ^4.1.0 flutter_countdown_timer: ^4.1.0
nfc_manager: ^3.2.0 nfc_manager: ^3.1.1
uuid: ^3.0.6 uuid: ^3.0.6
image_picker: ^0.8.5+3 image_picker: ^0.8.5+3
file_picker: ^4.6.1 file_picker: ^4.6.1
@ -60,11 +61,11 @@ dependencies:
google_maps_flutter: ^2.0.2 google_maps_flutter: ^2.0.2
google_maps_utils: ^1.4.0+1 google_maps_utils: ^1.4.0+1
google_directions_api: ^0.9.0 google_directions_api: ^0.9.0
geolocator: any geolocator: ^9.0.2
# flutter_compass: ^0.6.1 # flutter_compass: ^0.6.1
google_maps_flutter_web: ^0.3.2 google_maps_flutter_web: ^0.3.2
month_year_picker: ^0.2.0+1 month_year_picker: ^0.2.0+1
month_picker_dialog_2: ^0.5.5 month_picker_dialog_2: 0.5.5
open_file: ^3.2.1 open_file: ^3.2.1
wifi_iot: ^0.3.16 wifi_iot: ^0.3.16
flutter_html: ^2.2.1 flutter_html: ^2.2.1

Loading…
Cancel
Save