|
|
|
@ -64,7 +64,7 @@ class Utils {
|
|
|
|
|
|
|
|
|
|
///show custom Error Toast
|
|
|
|
|
/// [message] to show for user
|
|
|
|
|
static showErrorToast([String message]) {
|
|
|
|
|
static showErrorToast([String? message]) {
|
|
|
|
|
String localMsg = generateContactAdminMessage();
|
|
|
|
|
if (message != null) {
|
|
|
|
|
localMsg = message.toString();
|
|
|
|
@ -98,14 +98,14 @@ class Utils {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static showPermissionConsentDialog(BuildContext context, String message, Function onTap) {
|
|
|
|
|
static showPermissionConsentDialog(BuildContext context, String message, VoidCallback? onTap) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (cxt) => CovidConsentDialog(
|
|
|
|
|
okTitle: TranslationBase.of(context).acceptLbl,
|
|
|
|
|
title: TranslationBase.of(context).covidConsentHeader,
|
|
|
|
|
message: message,
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
onTap: onTap!,
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -160,7 +160,7 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool validateIDBox(String value, type) {
|
|
|
|
|
Pattern pattern = loginIDPattern(type); //r'^\d+(?:\.\d+)?$';
|
|
|
|
|
String pattern = loginIDPattern(type).toString(); //r'^\d+(?:\.\d+)?$';
|
|
|
|
|
|
|
|
|
|
RegExp regex = new RegExp(pattern);
|
|
|
|
|
return regex.hasMatch(value);
|
|
|
|
@ -219,25 +219,25 @@ class Utils {
|
|
|
|
|
return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static List<Widget> myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
|
|
|
|
|
static List<Widget> myMedicalList({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count}) {
|
|
|
|
|
List<Widget> medical =[];
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null,
|
|
|
|
|
child: isLogin
|
|
|
|
|
onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null,
|
|
|
|
|
child: isLogin!
|
|
|
|
|
? Stack(children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myAppointments,
|
|
|
|
|
title: TranslationBase.of(context!).myAppointments,
|
|
|
|
|
imagePath: 'appointment_list.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).myAppointmentsList,
|
|
|
|
|
subTitle: TranslationBase.of(context!).myAppointmentsList,
|
|
|
|
|
hasBadge: true,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(5)),
|
|
|
|
|
isEnable: projectViewModel!.havePrivilege(5)),
|
|
|
|
|
),
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? !projectViewModel.user.isFamily
|
|
|
|
|
? !projectViewModel.user!.isFamily
|
|
|
|
|
? Positioned(
|
|
|
|
|
left: 8,
|
|
|
|
|
top: 4,
|
|
|
|
@ -246,7 +246,7 @@ class Utils {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
badgeColor: secondaryColor.withOpacity(1.0),
|
|
|
|
|
badgeColor: secondaryColor!.withOpacity(1.0),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
@ -255,7 +255,7 @@ class Utils {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
: !projectViewModel.user.isFamily
|
|
|
|
|
: !projectViewModel.user!.isFamily
|
|
|
|
|
? Positioned(
|
|
|
|
|
right: 8,
|
|
|
|
|
top: 4,
|
|
|
|
@ -264,7 +264,7 @@ class Utils {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
badgeColor: secondaryColor.withOpacity(1.0),
|
|
|
|
|
badgeColor: secondaryColor!.withOpacity(1.0),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
@ -275,11 +275,11 @@ class Utils {
|
|
|
|
|
: Container(),
|
|
|
|
|
])
|
|
|
|
|
: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myAppointments,
|
|
|
|
|
title: TranslationBase.of(context!).myAppointments,
|
|
|
|
|
imagePath: 'appointment_list.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).myAppointmentsList,
|
|
|
|
|
subTitle: TranslationBase.of(context!).myAppointmentsList,
|
|
|
|
|
hasBadge: true,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(5),
|
|
|
|
|
isEnable: projectViewModel!.havePrivilege(5),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
@ -596,20 +596,20 @@ class Utils {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static List<Widget> myMedicalListHomePage({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
|
|
|
|
|
static List<Widget> myMedicalListHomePage({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count}) {
|
|
|
|
|
List<Widget> medical =[];
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null,
|
|
|
|
|
child: isLogin
|
|
|
|
|
onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null,
|
|
|
|
|
child: isLogin!
|
|
|
|
|
? Stack(children: [
|
|
|
|
|
MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myAppointments,
|
|
|
|
|
title: TranslationBase.of(context!).myAppointments,
|
|
|
|
|
imagePath: 'appointment_list.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).myAppointmentsList,
|
|
|
|
|
subTitle: TranslationBase.of(context!).myAppointmentsList,
|
|
|
|
|
hasBadge: true,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(5)),
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
isEnable: projectViewModel!.havePrivilege(5)),
|
|
|
|
|
projectViewModel.isArabic!
|
|
|
|
|
? !projectViewModel.isLoginChild
|
|
|
|
|
? Positioned(
|
|
|
|
|
left: 8,
|
|
|
|
@ -619,7 +619,7 @@ class Utils {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
badgeColor: secondaryColor.withOpacity(1.0),
|
|
|
|
|
badgeColor: secondaryColor!.withOpacity(1.0),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
@ -637,7 +637,7 @@ class Utils {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
badgeColor: secondaryColor.withOpacity(1.0),
|
|
|
|
|
badgeColor: secondaryColor!.withOpacity(1.0),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
@ -648,11 +648,11 @@ class Utils {
|
|
|
|
|
: Container(),
|
|
|
|
|
])
|
|
|
|
|
: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myAppointments,
|
|
|
|
|
title: TranslationBase.of(context!).myAppointments,
|
|
|
|
|
imagePath: 'appointment_list.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).myAppointmentsList,
|
|
|
|
|
subTitle: TranslationBase.of(context!).myAppointmentsList,
|
|
|
|
|
hasBadge: true,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(5),
|
|
|
|
|
isEnable: projectViewModel!.havePrivilege(5),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
@ -702,7 +702,7 @@ class Utils {
|
|
|
|
|
return medical;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}) {
|
|
|
|
|
static Widget loadNetworkImage({required String url, BoxFit fitting = BoxFit.cover}) {
|
|
|
|
|
return CachedNetworkImage(
|
|
|
|
|
placeholderFadeInDuration: Duration(milliseconds: 250),
|
|
|
|
|
fit: fitting,
|
|
|
|
@ -717,7 +717,7 @@ class Utils {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool route(Route route, {@required Type equalsTo}) {
|
|
|
|
|
static bool route(Route route, {required Type equalsTo}) {
|
|
|
|
|
if ((route is FadePage)) {
|
|
|
|
|
return route.page.runtimeType == equalsTo;
|
|
|
|
|
}
|
|
|
|
@ -725,7 +725,7 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static navigateToCartPage() {
|
|
|
|
|
Navigator.pushAndRemoveUntil(locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route<dynamic> r) => false);
|
|
|
|
|
Navigator.pushAndRemoveUntil(locator<NavigationService>()!.navigatorKey!.currentContext!, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route<dynamic> r) => false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnTitle(String text, {bool showDivider = true}) {
|
|
|
|
@ -749,7 +749,7 @@ class Utils {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true, ProjectViewModel mProjectViewModel}) {
|
|
|
|
|
static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true, ProjectViewModel? mProjectViewModel}) {
|
|
|
|
|
ProjectViewModel projectViewModel = mProjectViewModel ?? Provider.of(AppGlobal.context);
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
@ -820,13 +820,13 @@ class Utils {
|
|
|
|
|
return isVidaPlus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static String generateSignature() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// static String generateSignature() {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) {
|
|
|
|
|
Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), required Widget child}) {
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
boxShadow: [
|
|
|
|
@ -855,7 +855,7 @@ extension IndexedIterable<E> on Iterable<E> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openAppStore({String androidPackageName, String iOSAppID, bool isHuawei = false}) async {
|
|
|
|
|
openAppStore({String? androidPackageName, String? iOSAppID, bool isHuawei = false}) async {
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter");
|
|
|
|
|
if (isHuawei) {
|
|
|
|
@ -869,7 +869,7 @@ openAppStore({String androidPackageName, String iOSAppID, bool isHuawei = false}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String labelFrom({@required String className}) {
|
|
|
|
|
String labelFrom({required String className}) {
|
|
|
|
|
RegExp exp = RegExp(r'(?<=[a-z])[A-Z]');
|
|
|
|
|
|
|
|
|
|
String result = className.replaceAllMapped(exp, (m) {
|
|
|
|
|