|
|
|
@ -170,21 +170,14 @@ class SwipeGeneralUtils {
|
|
|
|
static void confirmDialog(cxt, String message, {VoidCallback onTap}) {
|
|
|
|
static void confirmDialog(cxt, String message, {VoidCallback onTap}) {
|
|
|
|
showDialog(
|
|
|
|
showDialog(
|
|
|
|
context: cxt,
|
|
|
|
context: cxt,
|
|
|
|
builder: (BuildContext cxt) => ConfirmDialog(
|
|
|
|
builder: (BuildContext cxt) => ConfirmDialog(message: message, onTap: onTap),
|
|
|
|
message: message,
|
|
|
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void showErrorDialog({String message, @required BuildContext context}) {
|
|
|
|
static void showErrorDialog({String message, @required BuildContext context}) {
|
|
|
|
showDialog(
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
builder: (context) => ConfirmDialog(
|
|
|
|
builder: (context) => ConfirmDialog(message: message, title: 'Error', onTap: () => Navigator.pop(context)),
|
|
|
|
message: message,
|
|
|
|
|
|
|
|
title: 'Error',
|
|
|
|
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -399,8 +392,6 @@ class SwipeGeneralUtils {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// general methods......
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void handleSwipeOperation({@required SwipeTypeEnum swipeType, double lat, double lang, BuildContext context}) {
|
|
|
|
static void handleSwipeOperation({@required SwipeTypeEnum swipeType, double lat, double lang, BuildContext context}) {
|
|
|
|
switch (swipeType) {
|
|
|
|
switch (swipeType) {
|
|
|
|
case SwipeTypeEnum.NFC:
|
|
|
|
case SwipeTypeEnum.NFC:
|
|
|
|
@ -448,7 +439,7 @@ class SwipeGeneralUtils {
|
|
|
|
|
|
|
|
|
|
|
|
if (swipeResponse.isSuccess) {
|
|
|
|
if (swipeResponse.isSuccess) {
|
|
|
|
hideLoading(context);
|
|
|
|
hideLoading(context);
|
|
|
|
showSuccessDialog(context: context);
|
|
|
|
Navigator.pushNamed(context, SwipeSuccessView.routeName);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
hideLoading(context);
|
|
|
|
hideLoading(context);
|
|
|
|
showDialog(
|
|
|
|
showDialog(
|
|
|
|
@ -513,7 +504,7 @@ class SwipeGeneralUtils {
|
|
|
|
|
|
|
|
|
|
|
|
if (swipeResponse.isSuccess) {
|
|
|
|
if (swipeResponse.isSuccess) {
|
|
|
|
hideLoading(context);
|
|
|
|
hideLoading(context);
|
|
|
|
showSuccessDialog(context: context, fromDashBoard: true);
|
|
|
|
Navigator.pushNamed(context, SwipeSuccessView.routeName);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
hideLoading(context);
|
|
|
|
hideLoading(context);
|
|
|
|
showErrorDialog(message: swipeResponse.message ?? "Unexpected error occurred", context: context);
|
|
|
|
showErrorDialog(message: swipeResponse.message ?? "Unexpected error occurred", context: context);
|
|
|
|
@ -525,11 +516,7 @@ class SwipeGeneralUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handleSwipe({
|
|
|
|
static void handleSwipe({SwipeTypeEnum swipeType, @required bool isEnable, @required BuildContext context}) async {
|
|
|
|
SwipeTypeEnum swipeType,
|
|
|
|
|
|
|
|
@required bool isEnable,
|
|
|
|
|
|
|
|
@required BuildContext context,
|
|
|
|
|
|
|
|
}) async {
|
|
|
|
|
|
|
|
if (!(await isGoogleServicesAvailable())) {
|
|
|
|
if (!(await isGoogleServicesAvailable())) {
|
|
|
|
checkHuaweiLocationPermission(attendanceType: swipeType, context: context);
|
|
|
|
checkHuaweiLocationPermission(attendanceType: swipeType, context: context);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -606,10 +593,10 @@ class SwipeGeneralUtils {
|
|
|
|
return availableMethods;
|
|
|
|
return availableMethods;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Future<void> showSwipeTypeBottomSheetSheet({@required BuildContext context, @required bool isNfcSupported}) {
|
|
|
|
static void showSwipeTypeBottomSheetSheet({@required BuildContext context, @required bool isNfcSupported}) {
|
|
|
|
UserProvider _userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
UserProvider _userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
|
|
|
|
|
|
|
|
return showModalBottomSheet(
|
|
|
|
showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
@ -636,16 +623,6 @@ class SwipeGeneralUtils {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void showSuccessDialog({@required BuildContext context, bool fromDashBoard}) {
|
|
|
|
|
|
|
|
Navigator.pushReplacementNamed(context, SwipeSuccessView.routeName);
|
|
|
|
|
|
|
|
// showMDialog(
|
|
|
|
|
|
|
|
// context,
|
|
|
|
|
|
|
|
// backgroundColor: Colors.transparent,
|
|
|
|
|
|
|
|
// isDismissable: true,
|
|
|
|
|
|
|
|
// child: SuccessDialog(fromDashBoard),
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void readNFc({Function(String) onRead}) {
|
|
|
|
static void readNFc({Function(String) onRead}) {
|
|
|
|
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
|
|
|
|
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
|
|
|
|
MifareUltralight f;
|
|
|
|
MifareUltralight f;
|
|
|
|
|