|
|
|
@ -16,6 +16,7 @@ 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';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedicationsPage.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart';
|
|
|
|
@ -44,13 +45,14 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
import '../Constants.dart';
|
|
|
|
|
import '../locator.dart';
|
|
|
|
|
import 'app_shared_preferences.dart';
|
|
|
|
|
import 'app_toast.dart';
|
|
|
|
|
import 'gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'navigation_service.dart';
|
|
|
|
|
|
|
|
|
|
AppSharedPreferences sharedPref = new AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Utils {
|
|
|
|
|
// static ProgressDialog pr;
|
|
|
|
|
|
|
|
|
@ -66,8 +68,10 @@ 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;
|
|
|
|
@ -131,11 +135,19 @@ 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) {
|
|
|
|
@ -195,14 +207,22 @@ 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(
|
|
|
|
@ -229,7 +249,11 @@ 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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -247,7 +271,11 @@ 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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -274,7 +302,9 @@ 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',
|
|
|
|
@ -284,7 +314,9 @@ 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',
|
|
|
|
@ -310,7 +342,8 @@ 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,
|
|
|
|
@ -329,12 +362,17 @@ 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',
|
|
|
|
@ -344,7 +382,9 @@ 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',
|
|
|
|
@ -354,7 +394,9 @@ 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',
|
|
|
|
@ -375,7 +417,9 @@ 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',
|
|
|
|
@ -385,7 +429,9 @@ 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',
|
|
|
|
@ -395,7 +441,9 @@ 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',
|
|
|
|
@ -405,7 +453,9 @@ 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',
|
|
|
|
@ -415,7 +465,9 @@ 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',
|
|
|
|
@ -425,7 +477,9 @@ 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',
|
|
|
|
@ -435,7 +489,9 @@ 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',
|
|
|
|
@ -452,7 +508,9 @@ 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',
|
|
|
|
@ -462,7 +520,9 @@ 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',
|
|
|
|
@ -472,9 +532,14 @@ 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) {
|
|
|
|
@ -484,13 +549,18 @@ 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);
|
|
|
|
@ -507,7 +577,9 @@ 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',
|
|
|
|
@ -519,13 +591,17 @@ 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(
|
|
|
|
@ -548,7 +624,11 @@ 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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -566,7 +646,11 @@ 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)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -593,7 +677,9 @@ 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',
|
|
|
|
@ -603,7 +689,9 @@ 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',
|
|
|
|
@ -621,19 +709,24 @@ 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,
|
|
|
|
@ -650,6 +743,14 @@ class Utils {
|
|
|
|
|
return route.runtimeType == equalsTo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static navigateToCartPage() {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => LandingPagePharmacy(currentTab: 3)),
|
|
|
|
|
(Route<dynamic> r) => false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Widget tableColumnTitle(String text, {bool showDivider = true}) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
@ -658,7 +759,12 @@ 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)
|
|
|
|
@ -671,16 +777,27 @@ 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)
|
|
|
|
@ -693,7 +810,8 @@ 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,
|
|
|
|
@ -704,7 +822,13 @@ 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)
|
|
|
|
@ -718,7 +842,13 @@ 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: [
|
|
|
|
@ -735,7 +865,8 @@ Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, doubl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<AuthenticatedUser> userData() async {
|
|
|
|
|
var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER));
|
|
|
|
|
var userData = AuthenticatedUser.fromJson(
|
|
|
|
|
await AppSharedPreferences().getObject(MAIN_USER));
|
|
|
|
|
return userData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -749,9 +880,12 @@ 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)");
|
|
|
|
@ -777,7 +911,11 @@ 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) => ' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|