|
|
|
|
@ -81,8 +81,7 @@ enum GenderType { male, female }
|
|
|
|
|
enum MaritalStatusType { single, married, divorced, widowed }
|
|
|
|
|
|
|
|
|
|
class Utils {
|
|
|
|
|
static int? onOtpBtnPressed(
|
|
|
|
|
OTPType type, String? phoneNumber, BuildContext context) {
|
|
|
|
|
static int? onOtpBtnPressed(OTPType type, String? phoneNumber, BuildContext context) {
|
|
|
|
|
if (phoneNumber == null || phoneNumber.isEmpty) {
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
@ -142,14 +141,10 @@ class Utils {
|
|
|
|
|
sharedPref.remove(CLINICS_LIST);
|
|
|
|
|
if (context.read<ProjectViewModel>().isArabic) {
|
|
|
|
|
context.read<ProjectViewModel>().changeLanguage('en');
|
|
|
|
|
locator<GAnalytics>()
|
|
|
|
|
.hamburgerMenu
|
|
|
|
|
.logMenuItemClick('change language to english');
|
|
|
|
|
locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to english');
|
|
|
|
|
} else {
|
|
|
|
|
context.read<ProjectViewModel>().changeLanguage('ar');
|
|
|
|
|
locator<GAnalytics>()
|
|
|
|
|
.hamburgerMenu
|
|
|
|
|
.logMenuItemClick('change language to arabic');
|
|
|
|
|
locator<GAnalytics>().hamburgerMenu.logMenuItemClick('change language to arabic');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -160,20 +155,7 @@ class Utils {
|
|
|
|
|
final year = dateTime.year.toString();
|
|
|
|
|
|
|
|
|
|
// Map month number to short month name
|
|
|
|
|
const monthNames = [
|
|
|
|
|
'Jan',
|
|
|
|
|
'Feb',
|
|
|
|
|
'Mar',
|
|
|
|
|
'Apr',
|
|
|
|
|
'May',
|
|
|
|
|
'Jun',
|
|
|
|
|
'Jul',
|
|
|
|
|
'Aug',
|
|
|
|
|
'Sep',
|
|
|
|
|
'Oct',
|
|
|
|
|
'Nov',
|
|
|
|
|
'Dec'
|
|
|
|
|
];
|
|
|
|
|
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
|
|
|
final month = monthNames[dateTime.month - 1];
|
|
|
|
|
|
|
|
|
|
return '$day $month, $year';
|
|
|
|
|
@ -195,20 +177,7 @@ class Utils {
|
|
|
|
|
final year = parts[0];
|
|
|
|
|
|
|
|
|
|
// Map month number to short month name (Hijri months)
|
|
|
|
|
const hijriMonthNames = [
|
|
|
|
|
'Muharram',
|
|
|
|
|
'Safar',
|
|
|
|
|
'Rabi I',
|
|
|
|
|
'Rabi II',
|
|
|
|
|
'Jumada I',
|
|
|
|
|
'Jumada II',
|
|
|
|
|
'Rajab',
|
|
|
|
|
'Sha\'ban',
|
|
|
|
|
'Ramadan',
|
|
|
|
|
'Shawwal',
|
|
|
|
|
'Dhu al-Qi\'dah',
|
|
|
|
|
'Dhu al-Hijjah'
|
|
|
|
|
];
|
|
|
|
|
const hijriMonthNames = ['Muharram', 'Safar', 'Rabi I', 'Rabi II', 'Jumada I', 'Jumada II', 'Rajab', 'Sha\'ban', 'Ramadan', 'Shawwal', 'Dhu al-Qi\'dah', 'Dhu al-Hijjah'];
|
|
|
|
|
final monthIndex = int.tryParse(parts[1]) ?? 1;
|
|
|
|
|
final month = hijriMonthNames[monthIndex - 1];
|
|
|
|
|
|
|
|
|
|
@ -300,13 +269,10 @@ class Utils {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
static Future<bool> checkConnection(
|
|
|
|
|
{bool bypassConnectionCheck = false}) async {
|
|
|
|
|
static Future<bool> checkConnection({bool bypassConnectionCheck = false}) async {
|
|
|
|
|
if (bypassConnectionCheck) return true;
|
|
|
|
|
List<ConnectivityResult> connectivityResult =
|
|
|
|
|
await (Connectivity().checkConnectivity());
|
|
|
|
|
if (connectivityResult.contains(ConnectivityResult.mobile) ||
|
|
|
|
|
connectivityResult.contains(ConnectivityResult.wifi)) {
|
|
|
|
|
List<ConnectivityResult> connectivityResult = await (Connectivity().checkConnectivity());
|
|
|
|
|
if (connectivityResult.contains(ConnectivityResult.mobile) || connectivityResult.contains(ConnectivityResult.wifi)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
@ -327,8 +293,7 @@ class Utils {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static showPermissionConsentDialog(
|
|
|
|
|
BuildContext context, String message, VoidCallback? onTap) {
|
|
|
|
|
static showPermissionConsentDialog(BuildContext context, String message, VoidCallback? onTap, {VoidCallback? onConsentDeclined}) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (cxt) => CovidConsentDialog(
|
|
|
|
|
@ -336,6 +301,7 @@ class Utils {
|
|
|
|
|
title: TranslationBase.of(context).covidConsentHeader,
|
|
|
|
|
message: message,
|
|
|
|
|
onTap: onTap!,
|
|
|
|
|
onConsentDeclined: onConsentDeclined!,
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -381,27 +347,13 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static String getAppointmentTransID(int projectID, int clinicID, int appoNo,
|
|
|
|
|
{bool isAddMilliseconds = true}) {
|
|
|
|
|
static String getAppointmentTransID(int projectID, int clinicID, int appoNo, {bool isAddMilliseconds = true}) {
|
|
|
|
|
String currentMillis = DateTime.now().millisecondsSinceEpoch.toString();
|
|
|
|
|
return projectID.toString() +
|
|
|
|
|
'-' +
|
|
|
|
|
clinicID.toString() +
|
|
|
|
|
'-' +
|
|
|
|
|
appoNo.toString() +
|
|
|
|
|
(isAddMilliseconds
|
|
|
|
|
? '-' +
|
|
|
|
|
currentMillis.substring(
|
|
|
|
|
currentMillis.length - 5, currentMillis.length)
|
|
|
|
|
: "");
|
|
|
|
|
return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString() + (isAddMilliseconds ? '-' + currentMillis.substring(currentMillis.length - 5, currentMillis.length) : "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static String getAdvancePaymentTransID(int projectID, int fileNumber) {
|
|
|
|
|
return projectID.toString() +
|
|
|
|
|
'-' +
|
|
|
|
|
fileNumber.toString() +
|
|
|
|
|
'-' +
|
|
|
|
|
DateTime.now().millisecondsSinceEpoch.toString();
|
|
|
|
|
return projectID.toString() + '-' + fileNumber.toString() + '-' + DateTime.now().millisecondsSinceEpoch.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool validateIDBox(String value, int type) {
|
|
|
|
|
@ -460,23 +412,14 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static validEmail(email) {
|
|
|
|
|
return RegExp(
|
|
|
|
|
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
|
|
|
|
|
.hasMatch(email);
|
|
|
|
|
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,
|
|
|
|
|
Function? onWeCareClick}) {
|
|
|
|
|
static List<Widget> myMedicalList({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count, Function? onWeCareClick}) {
|
|
|
|
|
List<Widget> medical = [];
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(5)
|
|
|
|
|
? Navigator.push(context, FadePage(page: MyAppointments()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null,
|
|
|
|
|
child: isLogin!
|
|
|
|
|
? Stack(children: [
|
|
|
|
|
Container(
|
|
|
|
|
@ -495,8 +438,7 @@ class Utils {
|
|
|
|
|
left: 8,
|
|
|
|
|
top: 4,
|
|
|
|
|
child: badge_import.Badge(
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(
|
|
|
|
|
toAnimate: false),
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false),
|
|
|
|
|
badgeStyle: badge_import.BadgeStyle(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
@ -506,11 +448,7 @@ class Utils {
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
|
child: Text(count.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 12.0)),
|
|
|
|
|
child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -521,8 +459,7 @@ class Utils {
|
|
|
|
|
top: 4,
|
|
|
|
|
child: badge_import.Badge(
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(
|
|
|
|
|
toAnimate: false),
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false),
|
|
|
|
|
badgeStyle: badge_import.BadgeStyle(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
@ -531,11 +468,7 @@ class Utils {
|
|
|
|
|
),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
|
child: Text(count.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 12.0)),
|
|
|
|
|
child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -562,9 +495,7 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(7)
|
|
|
|
|
? Navigator.push(context, FadePage(page: RadiologyHomePage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(7) ? Navigator.push(context, FadePage(page: RadiologyHomePage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).radiology,
|
|
|
|
|
imagePath: 'radiology.svg',
|
|
|
|
|
@ -574,9 +505,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(12)
|
|
|
|
|
? Navigator.push(context, FadePage(page: HomePrescriptionsPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(12) ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).medicines,
|
|
|
|
|
imagePath: 'medicine_prescription.svg',
|
|
|
|
|
@ -602,8 +531,7 @@ class Utils {
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (projectViewModel.havePrivilege(48))
|
|
|
|
|
Navigator.push(context, FadePage(page: ActiveMedicationsPage()));
|
|
|
|
|
if (projectViewModel.havePrivilege(48)) Navigator.push(context, FadePage(page: ActiveMedicationsPage()));
|
|
|
|
|
},
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myMedical,
|
|
|
|
|
@ -622,17 +550,12 @@ class Utils {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myDoctor,
|
|
|
|
|
imagePath: 'my_doc.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).myDoctorSubtitle,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(6)),
|
|
|
|
|
child:
|
|
|
|
|
MedicalProfileItem(title: TranslationBase.of(context).myDoctor, imagePath: 'my_doc.svg', subTitle: TranslationBase.of(context).myDoctorSubtitle, isEnable: projectViewModel.havePrivilege(6)),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(14)
|
|
|
|
|
? Navigator.push(context, FadePage(page: MyInvoices()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: MyInvoices())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).invoicesList,
|
|
|
|
|
imagePath: 'invoice_list.svg',
|
|
|
|
|
@ -642,9 +565,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(85)
|
|
|
|
|
? Navigator.push(context, FadePage(page: AnicllaryOrders()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(85) ? Navigator.push(context, FadePage(page: AnicllaryOrders())) : null,
|
|
|
|
|
// onTap: () => Navigator.push(context, FadePage(page: AnicllaryOrders())),
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).anicllaryOrders,
|
|
|
|
|
@ -680,9 +601,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(14)
|
|
|
|
|
? Navigator.push(context, FadePage(page: EyeMeasurementsPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).eye,
|
|
|
|
|
imagePath: 'eye_measurement.svg',
|
|
|
|
|
@ -737,9 +656,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(23)
|
|
|
|
|
? Navigator.push(context, FadePage(page: AllergiesPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(23) ? Navigator.push(context, FadePage(page: AllergiesPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).allergies,
|
|
|
|
|
imagePath: 'allergies_diagnosed.svg',
|
|
|
|
|
@ -749,9 +666,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(26)
|
|
|
|
|
? Navigator.push(context, FadePage(page: MyVaccines()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(26) ? Navigator.push(context, FadePage(page: MyVaccines())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myVaccines,
|
|
|
|
|
imagePath: 'vaccine_list.svg',
|
|
|
|
|
@ -761,9 +676,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(20)
|
|
|
|
|
? Navigator.push(context, FadePage(page: HomeReportPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).medical,
|
|
|
|
|
imagePath: 'medical_report.svg',
|
|
|
|
|
@ -773,9 +686,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(19)
|
|
|
|
|
? Navigator.push(context, FadePage(page: MonthlyReportsPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).monthly,
|
|
|
|
|
imagePath: 'monthly_report.svg',
|
|
|
|
|
@ -785,9 +696,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(16)
|
|
|
|
|
? Navigator.push(context, FadePage(page: PatientSickLeavePage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).sick,
|
|
|
|
|
imagePath: 'sick_leave.svg',
|
|
|
|
|
@ -797,9 +706,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(47)
|
|
|
|
|
? Navigator.push(context, FadePage(page: MyBalancePage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(47) ? Navigator.push(context, FadePage(page: MyBalancePage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myBalance,
|
|
|
|
|
imagePath: 'balance_credit.svg',
|
|
|
|
|
@ -816,9 +723,7 @@ class Utils {
|
|
|
|
|
// ));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(24)
|
|
|
|
|
? Navigator.push(context, FadePage(page: MyTrackers()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(24) ? Navigator.push(context, FadePage(page: MyTrackers())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myTrackers,
|
|
|
|
|
imagePath: 'tracker.svg',
|
|
|
|
|
@ -828,9 +733,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(30)
|
|
|
|
|
? Navigator.push(context, FadePage(page: SmartWatchInstructions()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(30) ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).smartWatchesSubtitle,
|
|
|
|
|
imagePath: 'smart_watch.svg',
|
|
|
|
|
@ -840,22 +743,16 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(28)
|
|
|
|
|
? Navigator.push(context, FadePage(page: AskDoctorHomPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(28) ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).askYourSubtitle,
|
|
|
|
|
imagePath: 'ask_doctor.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).askYour,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(28)),
|
|
|
|
|
title: TranslationBase.of(context).askYourSubtitle, imagePath: 'ask_doctor.svg', subTitle: TranslationBase.of(context).askYour, isEnable: projectViewModel.havePrivilege(28)),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
if (projectViewModel.havePrivilege(32) || true) {
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
showPermissionConsentDialog(
|
|
|
|
|
context, TranslationBase.of(context).wifiPermission, () {
|
|
|
|
|
showPermissionConsentDialog(context, TranslationBase.of(context).wifiPermission, () {
|
|
|
|
|
connectWifi(projectViewModel, context);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
@ -871,9 +768,7 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(40)
|
|
|
|
|
? launch('whatsapp://send?phone=18885521858&text=')
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(40) ? launch('whatsapp://send?phone=18885521858&text=') : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).chatbot,
|
|
|
|
|
imagePath: 'chatbot.svg',
|
|
|
|
|
@ -885,20 +780,15 @@ class Utils {
|
|
|
|
|
return medical;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getPatientWifiCredentials(String patientID,
|
|
|
|
|
Function(String username, String password) successCallback) {
|
|
|
|
|
static getPatientWifiCredentials(String patientID, Function(String username, String password) successCallback) {
|
|
|
|
|
final body = <String, dynamic>{"PatientID": patientID};
|
|
|
|
|
locator<BaseAppClient>().post(WIFI_CREDENTIALS, body: body,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
locator<BaseAppClient>().post(WIFI_CREDENTIALS, body: body, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
print(response);
|
|
|
|
|
var data = response["Hmg_SMS_Get_By_ProjectID_And_PatientIDList"];
|
|
|
|
|
if (data is List && data.first != null) {
|
|
|
|
|
final username = data.first['UserName'];
|
|
|
|
|
final password = data.first['Password'];
|
|
|
|
|
if (username != null &&
|
|
|
|
|
password != null &&
|
|
|
|
|
username.isNotEmpty &&
|
|
|
|
|
password.isNotEmpty) {
|
|
|
|
|
if (username != null && password != null && username.isNotEmpty && password.isNotEmpty) {
|
|
|
|
|
successCallback(username, password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -917,18 +807,12 @@ class Utils {
|
|
|
|
|
// projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}).catchError((err) {
|
|
|
|
|
// print(err.toString());
|
|
|
|
|
// });
|
|
|
|
|
projectViewModel
|
|
|
|
|
.platformBridge()
|
|
|
|
|
.connectHMGGuestWifi(GUEST_SSID)
|
|
|
|
|
.then((value) async {
|
|
|
|
|
projectViewModel.platformBridge().connectHMGGuestWifi(GUEST_SSID).then((value) async {
|
|
|
|
|
if (value == 0) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
} else {
|
|
|
|
|
getPatientWifiCredentials(patientID, (username, password) async {
|
|
|
|
|
final result = await projectViewModel
|
|
|
|
|
.platformBridge()
|
|
|
|
|
.connectHMGInternetWifi(PATIENT_SSID, username, password)
|
|
|
|
|
.catchError((err) => print(err.toString()));
|
|
|
|
|
final result = await projectViewModel.platformBridge().connectHMGInternetWifi(PATIENT_SSID, username, password).catchError((err) => print(err.toString()));
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (result == 1) {
|
|
|
|
|
// Success
|
|
|
|
|
@ -941,8 +825,7 @@ class Utils {
|
|
|
|
|
} else {
|
|
|
|
|
AlertDialogBox(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage:
|
|
|
|
|
"Please login with your account first to use this feature",
|
|
|
|
|
confirmMessage: "Please login with your account first to use this feature",
|
|
|
|
|
okText: "OK",
|
|
|
|
|
okFunction: () {
|
|
|
|
|
AlertDialogBox.closeAlertDialog(context);
|
|
|
|
|
@ -951,17 +834,11 @@ 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,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null,
|
|
|
|
|
child: isLogin!
|
|
|
|
|
? Stack(children: [
|
|
|
|
|
MedicalProfileItem(
|
|
|
|
|
@ -977,8 +854,7 @@ class Utils {
|
|
|
|
|
top: 4,
|
|
|
|
|
child: badge_import.Badge(
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(
|
|
|
|
|
toAnimate: false),
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false),
|
|
|
|
|
badgeStyle: badge_import.BadgeStyle(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
@ -987,11 +863,7 @@ class Utils {
|
|
|
|
|
),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
|
child: Text(count.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 12.0)),
|
|
|
|
|
child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -1001,8 +873,7 @@ class Utils {
|
|
|
|
|
right: 8,
|
|
|
|
|
top: 4,
|
|
|
|
|
child: badge_import.Badge(
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(
|
|
|
|
|
toAnimate: false),
|
|
|
|
|
badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false),
|
|
|
|
|
badgeStyle: badge_import.BadgeStyle(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
shape: badge_import.BadgeShape.circle,
|
|
|
|
|
@ -1012,11 +883,7 @@ class Utils {
|
|
|
|
|
position: badge_import.BadgePosition.topEnd(),
|
|
|
|
|
badgeContent: Container(
|
|
|
|
|
padding: EdgeInsets.all(2.0),
|
|
|
|
|
child: Text(count.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 12.0)),
|
|
|
|
|
child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -1032,9 +899,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(10)
|
|
|
|
|
? Navigator.push(context, FadePage(page: LabsHomePage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(10) ? Navigator.push(context, FadePage(page: LabsHomePage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).lab,
|
|
|
|
|
imagePath: 'lab_result.svg',
|
|
|
|
|
@ -1044,9 +909,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(7)
|
|
|
|
|
? Navigator.push(context, FadePage(page: RadiologyHomePage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(7) ? Navigator.push(context, FadePage(page: RadiologyHomePage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).radiology,
|
|
|
|
|
imagePath: 'radiology.svg',
|
|
|
|
|
@ -1056,9 +919,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(12)
|
|
|
|
|
? Navigator.push(context, FadePage(page: HomePrescriptionsPage()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(12) ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).medicines,
|
|
|
|
|
imagePath: 'medicine_prescription.svg',
|
|
|
|
|
@ -1076,24 +937,19 @@ class Utils {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).myDoctor,
|
|
|
|
|
imagePath: 'my_doc.svg',
|
|
|
|
|
subTitle: TranslationBase.of(context).myDoctorSubtitle,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(6)),
|
|
|
|
|
child:
|
|
|
|
|
MedicalProfileItem(title: TranslationBase.of(context).myDoctor, imagePath: 'my_doc.svg', subTitle: TranslationBase.of(context).myDoctorSubtitle, isEnable: projectViewModel.havePrivilege(6)),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
imageUrl: url,
|
|
|
|
|
placeholder: (context, url) =>
|
|
|
|
|
Container(child: Center(child: CircularProgressIndicator())),
|
|
|
|
|
placeholder: (context, url) => Container(child: Center(child: CircularProgressIndicator())),
|
|
|
|
|
errorWidget: (context, url, error) {
|
|
|
|
|
return Icon(
|
|
|
|
|
Icons.error,
|
|
|
|
|
@ -1111,11 +967,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}) {
|
|
|
|
|
@ -1127,12 +979,7 @@ class Utils {
|
|
|
|
|
Text(
|
|
|
|
|
text,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
height: 18 / 12),
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 5),
|
|
|
|
|
if (showDivider)
|
|
|
|
|
@ -1145,14 +992,8 @@ class Utils {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnValue(String text,
|
|
|
|
|
{bool isLast = false,
|
|
|
|
|
bool isCapitable = true,
|
|
|
|
|
bool isHighLow = false,
|
|
|
|
|
bool isCurrency = false,
|
|
|
|
|
required ProjectViewModel mProjectViewModel}) {
|
|
|
|
|
ProjectViewModel projectViewModel =
|
|
|
|
|
mProjectViewModel ?? Provider.of(AppGlobal.context);
|
|
|
|
|
static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true, bool isHighLow = false, bool isCurrency = false, required ProjectViewModel mProjectViewModel}) {
|
|
|
|
|
ProjectViewModel projectViewModel = mProjectViewModel ?? Provider.of(AppGlobal.context);
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
@ -1162,19 +1003,10 @@ class Utils {
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
isCapitable && !projectViewModel.isArabic
|
|
|
|
|
? text.toLowerCase().capitalizeFirstofEach
|
|
|
|
|
: text,
|
|
|
|
|
isCapitable && !projectViewModel.isArabic ? text.toLowerCase().capitalizeFirstofEach : text,
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: isHighLow
|
|
|
|
|
? CustomColors.accentColor
|
|
|
|
|
: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.4,
|
|
|
|
|
height: 16 / 10),
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: isHighLow ? CustomColors.accentColor : Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
isCurrency ? getSaudiRiyalSymbol() : Container(),
|
|
|
|
|
@ -1191,10 +1023,7 @@ class Utils {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnValueWithFlowChart(String text, String flowChartText,
|
|
|
|
|
{bool isLast = false,
|
|
|
|
|
bool isCapitable = true,
|
|
|
|
|
ProjectViewModel? mProjectViewModel}) {
|
|
|
|
|
static Widget tableColumnValueWithFlowChart(String text, String flowChartText, {bool isLast = false, bool isCapitable = true, ProjectViewModel? mProjectViewModel}) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
@ -1204,25 +1033,14 @@ class Utils {
|
|
|
|
|
text,
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.4,
|
|
|
|
|
height: 16 / 10),
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
AutoSizeText(
|
|
|
|
|
flowChartText,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minFontSize: 6,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xffD02127),
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
height: 18 / 12),
|
|
|
|
|
style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
if (!isLast)
|
|
|
|
|
@ -1236,9 +1054,7 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<bool> isGoogleServicesAvailable() async {
|
|
|
|
|
GooglePlayServicesAvailability availability = await GoogleApiAvailability
|
|
|
|
|
.instance
|
|
|
|
|
.checkGooglePlayServicesAvailability();
|
|
|
|
|
GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
|
|
|
|
|
String status = availability.toString().split('.').last;
|
|
|
|
|
if (status == "success") {
|
|
|
|
|
return true;
|
|
|
|
|
@ -1254,8 +1070,7 @@ class Utils {
|
|
|
|
|
final lat1Radians = _toRadians(lat1);
|
|
|
|
|
final lat2Radians = _toRadians(lat2);
|
|
|
|
|
|
|
|
|
|
final a =
|
|
|
|
|
_haversin(dLat) + cos(lat1Radians) * cos(lat2Radians) * _haversin(dLon);
|
|
|
|
|
final a = _haversin(dLat) + cos(lat1Radians) * cos(lat2Radians) * _haversin(dLon);
|
|
|
|
|
final c = 2 * asin(sqrt(a));
|
|
|
|
|
|
|
|
|
|
return r * c;
|
|
|
|
|
@ -1265,8 +1080,7 @@ class Utils {
|
|
|
|
|
|
|
|
|
|
static num _haversin(double radians) => pow(sin(radians / 2), 2);
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnValueWithUnderLine(String text,
|
|
|
|
|
{bool isLast = false, bool isCapitable = true}) {
|
|
|
|
|
static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
@ -1277,13 +1091,7 @@ class Utils {
|
|
|
|
|
isCapitable ? text.toLowerCase().capitalizeFirstofEach : text,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minFontSize: 6,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xffD02127),
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
height: 18 / 12),
|
|
|
|
|
style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
if (!isLast)
|
|
|
|
|
@ -1300,8 +1108,7 @@ class Utils {
|
|
|
|
|
return crypto.md5.convert(utf8.encode(input)).toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool isVidaPlusProject(
|
|
|
|
|
ProjectViewModel projectViewModel, int projectID) {
|
|
|
|
|
static bool isVidaPlusProject(ProjectViewModel projectViewModel, int projectID) {
|
|
|
|
|
bool isVidaPlus = false;
|
|
|
|
|
projectViewModel.vidaPlusProjectList.forEach((element) {
|
|
|
|
|
if (element.projectID == projectID) {
|
|
|
|
|
@ -1321,8 +1128,7 @@ class Utils {
|
|
|
|
|
return isHMCProject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ProjectDetailListModel getProjectDetailObj(
|
|
|
|
|
ProjectViewModel projectViewModel, int projectID) {
|
|
|
|
|
static ProjectDetailListModel getProjectDetailObj(ProjectViewModel projectViewModel, int projectID) {
|
|
|
|
|
ProjectDetailListModel projectDetailListModel = ProjectDetailListModel();
|
|
|
|
|
projectViewModel.projectDetailListModel.forEach((element) {
|
|
|
|
|
if (element.projectID == projectID) {
|
|
|
|
|
@ -1333,20 +1139,13 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget getSaudiRiyalSymbol({double fontSize = 16}) {
|
|
|
|
|
return Text(" SAR ",
|
|
|
|
|
style: TextStyle(fontFamily: "SaudiRiyal", fontSize: fontSize));
|
|
|
|
|
return Text(" SAR ", style: TextStyle(fontFamily: "SaudiRiyal", fontSize: fontSize));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//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: [
|
|
|
|
|
@ -1363,8 +1162,7 @@ Widget applyShadow(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<AuthenticatedUser> userData() async {
|
|
|
|
|
var userData = AuthenticatedUser.fromJson(
|
|
|
|
|
await AppSharedPreferences().getObject(MAIN_USER));
|
|
|
|
|
var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER));
|
|
|
|
|
return userData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1376,13 +1174,9 @@ 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");
|
|
|
|
|
assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter");
|
|
|
|
|
if (isHuawei) {
|
|
|
|
|
launchUrl(Uri.parse("appmarket://details?id=com.ejada.hmg"));
|
|
|
|
|
} else {
|
|
|
|
|
@ -1390,8 +1184,7 @@ openAppStore(
|
|
|
|
|
}
|
|
|
|
|
} else if (Platform.isIOS) {
|
|
|
|
|
assert((iOSAppID == null), "Should have valid value in iOSAppID parameter");
|
|
|
|
|
launchUrl(
|
|
|
|
|
Uri.parse("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"));
|
|
|
|
|
launchUrl(Uri.parse("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1414,11 +1207,7 @@ String labelFrom({required String className}) {
|
|
|
|
|
|
|
|
|
|
extension StringExtension on String {
|
|
|
|
|
String capitalize() {
|
|
|
|
|
return this.splitMapJoin(RegExp(r'\w+'),
|
|
|
|
|
onMatch: (m) =>
|
|
|
|
|
'${m.group(0)}'.substring(0, 1).toUpperCase() +
|
|
|
|
|
'${m.group(0)}'.substring(1).toLowerCase(),
|
|
|
|
|
onNonMatch: (n) => ' ');
|
|
|
|
|
return this.splitMapJoin(RegExp(r'\w+'), onMatch: (m) => '${m.group(0)}'.substring(0, 1).toUpperCase() + '${m.group(0)}'.substring(1).toLowerCase(), onNonMatch: (n) => ' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1522,12 +1311,9 @@ extension SelectedLanguageExtension on BuildContext {
|
|
|
|
|
return language;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double getLottieScaledWidth(double value) =>
|
|
|
|
|
MediaQuery.of(this).size.width * (value / MediaQuery.of(this).size.width);
|
|
|
|
|
double getLottieScaledWidth(double value) => MediaQuery.of(this).size.width * (value / MediaQuery.of(this).size.width);
|
|
|
|
|
|
|
|
|
|
double getLottieScaledHeight(double value) =>
|
|
|
|
|
MediaQuery.of(this).size.height *
|
|
|
|
|
(value / MediaQuery.of(this).size.height);
|
|
|
|
|
double getLottieScaledHeight(double value) => MediaQuery.of(this).size.height * (value / MediaQuery.of(this).size.height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension GenderTypeExtension on GenderType {
|
|
|
|
|
|