|
|
|
|
@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart';
|
|
|
|
|
@ -68,10 +69,8 @@ class Utils {
|
|
|
|
|
|
|
|
|
|
/// Check The Internet Connection
|
|
|
|
|
static Future<bool> checkConnection() async {
|
|
|
|
|
ConnectivityResult connectivityResult =
|
|
|
|
|
await (Connectivity().checkConnectivity());
|
|
|
|
|
if ((connectivityResult == ConnectivityResult.mobile) ||
|
|
|
|
|
(connectivityResult == ConnectivityResult.wifi)) {
|
|
|
|
|
ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity());
|
|
|
|
|
if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
@ -135,19 +134,11 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static String getAppointmentTransID(int projectID, int clinicID, int appoNo) {
|
|
|
|
|
return projectID.toString() +
|
|
|
|
|
'-' +
|
|
|
|
|
clinicID.toString() +
|
|
|
|
|
'-' +
|
|
|
|
|
appoNo.toString();
|
|
|
|
|
return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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, type) {
|
|
|
|
|
@ -207,22 +198,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}) {
|
|
|
|
|
static List<Widget> myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) {
|
|
|
|
|
List<Widget> medical = List();
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
@ -249,11 +232,7 @@ class Utils {
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -271,11 +250,7 @@ class Utils {
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -302,9 +277,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',
|
|
|
|
|
@ -314,9 +287,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',
|
|
|
|
|
@ -342,8 +313,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,
|
|
|
|
|
@ -362,17 +332,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',
|
|
|
|
|
@ -382,9 +347,18 @@ 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: AnicllaryOrders())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).anicllaryOrders,
|
|
|
|
|
imagePath: 'assets/images/al-habib_online_payment_service_icon.png',
|
|
|
|
|
isPngImage: true,
|
|
|
|
|
subTitle: TranslationBase.of(context).myInvoice,
|
|
|
|
|
isEnable: projectViewModel.havePrivilege(14),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).eye,
|
|
|
|
|
imagePath: 'eye_measurement.svg',
|
|
|
|
|
@ -394,9 +368,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(22)
|
|
|
|
|
? Navigator.push(context, FadePage(page: InsuranceCard()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(22) ? Navigator.push(context, FadePage(page: InsuranceCard())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).insurance,
|
|
|
|
|
imagePath: 'insurance_card.svg',
|
|
|
|
|
@ -417,9 +389,7 @@ class Utils {
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
medical.add(InkWell(
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(18)
|
|
|
|
|
? Navigator.push(context, FadePage(page: InsuranceApproval()))
|
|
|
|
|
: null,
|
|
|
|
|
onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null,
|
|
|
|
|
child: MedicalProfileItem(
|
|
|
|
|
title: TranslationBase.of(context).insuranceApproval,
|
|
|
|
|
imagePath: 'insurance_approval.svg',
|
|
|
|
|
@ -429,9 +399,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',
|
|
|
|
|
@ -441,9 +409,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',
|
|
|
|
|
@ -453,9 +419,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',
|
|
|
|
|
@ -465,9 +429,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',
|
|
|
|
|
@ -477,9 +439,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',
|
|
|
|
|
@ -489,9 +449,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',
|
|
|
|
|
@ -508,9 +466,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',
|
|
|
|
|
@ -520,9 +476,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',
|
|
|
|
|
@ -532,14 +486,9 @@ 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) {
|
|
|
|
|
@ -549,18 +498,13 @@ class Utils {
|
|
|
|
|
if (projectViewModel.isLogin && userData_ != null) {
|
|
|
|
|
String patientID = userData_.patientID.toString();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
projectViewModel
|
|
|
|
|
.platformBridge()
|
|
|
|
|
.connectHMGInternetWifi(patientID)
|
|
|
|
|
.then((value) => {GifLoaderDialogUtils.hideDialog(context)})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}).catchError((err) {
|
|
|
|
|
print(err.toString());
|
|
|
|
|
});
|
|
|
|
|
} 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);
|
|
|
|
|
@ -577,9 +521,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',
|
|
|
|
|
@ -591,17 +533,11 @@ class Utils {
|
|
|
|
|
return medical;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 = List();
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
@ -624,11 +560,7 @@ class Utils {
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -646,11 +578,7 @@ class Utils {
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -677,9 +605,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',
|
|
|
|
|
@ -689,9 +615,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',
|
|
|
|
|
@ -709,24 +633,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,
|
|
|
|
|
@ -744,11 +663,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}) {
|
|
|
|
|
@ -759,12 +674,7 @@ class Utils {
|
|
|
|
|
SizedBox(height: 6),
|
|
|
|
|
Text(
|
|
|
|
|
text,
|
|
|
|
|
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)
|
|
|
|
|
@ -777,27 +687,16 @@ class Utils {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnValue(String text,
|
|
|
|
|
{bool isLast = false,
|
|
|
|
|
bool isCapitable = true,
|
|
|
|
|
ProjectViewModel mProjectViewModel}) {
|
|
|
|
|
ProjectViewModel projectViewModel =
|
|
|
|
|
mProjectViewModel ?? Provider.of(AppGlobal.context);
|
|
|
|
|
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,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
Text(
|
|
|
|
|
isCapitable && !projectViewModel.isArabic
|
|
|
|
|
? text.toLowerCase().capitalizeFirstofEach
|
|
|
|
|
: text,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.4,
|
|
|
|
|
height: 16 / 10),
|
|
|
|
|
isCapitable && !projectViewModel.isArabic ? text.toLowerCase().capitalizeFirstofEach : text,
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
if (!isLast)
|
|
|
|
|
@ -810,8 +709,7 @@ class Utils {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
@ -822,13 +720,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)
|
|
|
|
|
@ -842,13 +734,7 @@ class Utils {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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: [
|
|
|
|
|
@ -865,8 +751,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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -880,12 +765,9 @@ extension IndexedIterable<E> on Iterable<E> {
|
|
|
|
|
|
|
|
|
|
openAppStore({String androidPackageName, String iOSAppID}) async {
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
assert(!(androidPackageName == null),
|
|
|
|
|
"Should have valid value in androidPackageName parameter");
|
|
|
|
|
if ((await FlutterHmsGmsAvailability.isGmsAvailable))
|
|
|
|
|
launch("market://details?id=com.ejada.hmg");
|
|
|
|
|
if ((await FlutterHmsGmsAvailability.isHmsAvailable))
|
|
|
|
|
launch("appmarket://details?id=com.ejada.hmg");
|
|
|
|
|
assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter");
|
|
|
|
|
if ((await FlutterHmsGmsAvailability.isGmsAvailable)) launch("market://details?id=com.ejada.hmg");
|
|
|
|
|
if ((await FlutterHmsGmsAvailability.isHmsAvailable)) launch("appmarket://details?id=com.ejada.hmg");
|
|
|
|
|
} else if (Platform.isIOS) {
|
|
|
|
|
assert((iOSAppID == null), "Should have valid value in iOSAppID parameter");
|
|
|
|
|
launch("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)");
|
|
|
|
|
@ -911,11 +793,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) => ' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|