From 0445011e53a5bad6a8ce56fb27b56990eca09249 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 15 Mar 2021 14:32:05 +0300 Subject: [PATCH 1/3] bug fixes --- lib/config/localized_values.dart | 32 +++-- .../ancillary-orders/ancillaryOrders.dart | 2 +- .../ancillaryOrdersDetails.dart | 54 +++++++- .../insurance/insurance_card_screen.dart | 120 +++++++++++------- lib/pages/login/login.dart | 4 +- lib/uitl/translations_delegate_base.dart | 19 ++- 6 files changed, 169 insertions(+), 62 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4cababb4..ca30816c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1961,20 +1961,34 @@ const Map localizedValues = { "en": "Your session has timed out, Please try again", "ar": "انتهت مهلة جلسة الخاص بها. يرجى المحاولة مرة أخرى" }, - "ancillary-orders": {"en": "Ancillary Orders", "ar": "الأوامر التبعية"}, + "ancillary-orders": {"en": "Ancillary Orders", "ar": "الأوامر التبعية"}, - "onlineCheckInAgreement": {"en": "The online check-in is for non-life threatening situationCall the red crescent (number) or go to the nearest emergency department if there are:signs of stroke or heart attack history of seizure or syncope there is limb or life threatening injury picture of severe injuries​", - "ar": "تسجيل الذهاب الى الطوارئ عبر الإنترنت هو فقط للحالات  التي لا تهدد الحياة يجب الاتصل بالهلال الأحمر (رقم) أو الذهاب إلى أقرب قسم طوارئ إذا كان هناك علامات السكتة الدماغية أو النوبة القلبية او هناك نوبة تشنج او حالة فقدان الوعي او وجود إصابة تهدد أحد الأطراف او تهدد الحياة او وجود إصابات خطيرة"}, + "onlineCheckInAgreement": { + "en": + "The online check-in is for non-life threatening situationCall the red crescent (number) or go to the nearest emergency department if there are:signs of stroke or heart attack history of seizure or syncope there is limb or life threatening injury picture of severe injuries​", + "ar": + "تسجيل الذهاب الى الطوارئ عبر الإنترنت هو فقط للحالات  التي لا تهدد الحياة يجب الاتصل بالهلال الأحمر (رقم) أو الذهاب إلى أقرب قسم طوارئ إذا كان هناك علامات السكتة الدماغية أو النوبة القلبية او هناك نوبة تشنج او حالة فقدان الوعي او وجود إصابة تهدد أحد الأطراف او تهدد الحياة او وجود إصابات خطيرة" + }, "MRN": {"en": "MRN", "ar": "ایم آر این"}, "appointment-date": {"en": "Appointment Date", "ar": "تقرری کی تاریخ"}, "appointment-no": {"en": "Appointment No", "ar": "تقرری نمبر"}, "insurance-id": {"en": "Insurance ID", "ar": "انشورنس ID"}, "chiefComplaints": {"en": "Chief Complaints", "ar": "الشكوى الرئيسة"}, - "errorChiefComplaints": {"en": "Please Chief Complaints", "ar": "يرجى ادخال الشكوى الرئيسة"}, - "errorExpectedArrivalTimes": {"en": "Please Expected arrival time", "ar": "يرجى ادخال الوقت المتوقع للوصول"}, - "expectedArrivalTime": {"en": "Expected arrival time", "ar": "الوقت المتوقع للوصول"}, - "add-address": { - "en": "Add new address", - "ar": "اضف عنوان جديد" + "errorChiefComplaints": { + "en": "Please Chief Complaints", + "ar": "يرجى ادخال الشكوى الرئيسة" + }, + "errorExpectedArrivalTimes": { + "en": "Please Expected arrival time", + "ar": "يرجى ادخال الوقت المتوقع للوصول" + }, + "expectedArrivalTime": { + "en": "Expected arrival time", + "ar": "الوقت المتوقع للوصول" + }, + "add-address": {"en": "Add new address", "ar": "اضف عنوان جديد"}, + "enter-file": { + "en": "Please enter the mobile number and the medical file number", + "ar": "الرجاء إدخال رقم الجوال ورقم الملف الطبي" } }; diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart index b229775a..eccc1309 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart @@ -103,7 +103,7 @@ class _AnicllaryOrdersState extends State bottom: BorderSide( width: 0.5, ))), - padding: EdgeInsets.all(5), + padding: EdgeInsets.all(15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 9fb7e7d2..dc0d73d4 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import "package:collection/collection.dart"; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; class AnicllaryOrdersDetails extends StatefulWidget { final dynamic appoNo; @@ -186,11 +187,60 @@ class _AnicllaryOrdersState extends State } Widget getAncillaryDetails(model) { - var newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcList, + Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcList, (obj) => obj.procedureCategoryName); print(newMap); + return Padding( padding: EdgeInsets.only(top: 10, bottom: 10), - child: Column(children: [])); + child: getHeaderDetails(newMap)); + } + + Widget getHeaderDetails(newMap) { + List list = new List(); + + newMap.forEach((key, value) { + list.add( + Texts( + key, + fontWeight: FontWeight.bold, + ), + ); + list.add(Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [getLabDetails(value)], + )); + }); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: list, + ); + } + + getLabDetails(value) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: value.map((result) { + return Container( + width: MediaQuery.of(context).size.width * .9, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + flex: 3, + child: Text(result.procedureName.toString(), + overflow: TextOverflow.ellipsis)), + Expanded(child: AppText(result.companyShare.toString())), + Expanded(child: AppText(result.companyTaxAmount.toString())), + Expanded( + child: AppText( + result.companyShareWithTax.toString(), + )) + ], + )); + }).toList(), + ); } } diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 42efc179..da66c572 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -109,58 +109,92 @@ class _InsuranceCardState extends State { ), Column( crossAxisAlignment: - CrossAxisAlignment.stretch, + CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).category +": "+ - model.insurance[index] - .subCategoryDesc, - fontSize: 18.5, + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context) + .category, + fontSize: 18.5), + Texts( + model.insurance[index] + .subCategoryDesc, + fontSize: 18.5) + ], ), Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Texts( - TranslationBase.of(context) - .expirationDate +": "+ - convertDateFormat(model - .insurance[index].cardValidTo), - fontSize: 18.5, - ), - Expanded( - child: Column( - children: [ - model.insurance[index].isActive == true - ? Texts( - TranslationBase.of(context) - .activeInsurence, - color: Colors.green, - fontWeight: FontWeight.w900, - fontSize: 17.9) - : Texts( - TranslationBase.of(context) - .notActive, - color: Colors.red, - fontWeight: FontWeight.w900, - fontSize: 17.9) - ], - ), - ), + TranslationBase.of(context) + .expirationDate, + fontSize: 18.5), + Texts( + convertDateFormat( + model.insurance[index] + .cardValidTo, + ), + fontSize: 18.5), ], ), - Texts( - TranslationBase.of(context) - .patientCard +": "+ - model - .insurance[index].patientCardID, - fontSize: 18.5, + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context) + .status + + ": ", + fontSize: 18.5), + model.insurance[index].isActive == + true + ? Texts( + TranslationBase.of(context) + .activeInsurence, + color: Colors.green, + fontWeight: FontWeight.w900, + fontSize: 17.9) + : Texts( + TranslationBase.of(context) + .notActive, + color: Colors.red, + fontWeight: FontWeight.w900, + fontSize: 17.9) + ], ), - Texts( - TranslationBase.of(context) - .policyNumber +" "+ - model.insurance[index] - .insurancePolicyNumber, - fontSize: 18.5, + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context) + .patientCard, + fontSize: 18.5), + Texts( + model.insurance[index] + .patientCardID, + fontSize: 18.5) + ], ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context) + .policyNumber, + fontSize: 18.5, + ), + Texts( + model.insurance[index] + .insurancePolicyNumber, + fontSize: 18.5, + ) + ]), ], ), SizedBox( diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 6bc99be5..8d655f76 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -88,7 +88,9 @@ class _Login extends State { Expanded( flex: 2, child: Texts( - TranslationBase.of(context).enterNationalId, + loginType == 1 + ? TranslationBase.of(context).enterNationalId + : TranslationBase.of(context).enterFile, fontSize: SizeConfig.textMultiplier * 3.5, textAlign: TextAlign.start, )), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a9756330..a90f8614 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1573,12 +1573,18 @@ class TranslationBase { String get shippingAddresss => localizedValues["shipping-address"][locale.languageCode]; String get covidAlert => localizedValues["covid-alert"][locale.languageCode]; - String get pharmacyRelogin => localizedValues["pharmacy-relogin"][locale.languageCode]; - String get onlineCheckInAgreement => localizedValues["onlineCheckInAgreement"][locale.languageCode]; - String get chiefComplaints => localizedValues["chiefComplaints"][locale.languageCode]; - String get errorChiefComplaints => localizedValues["errorChiefComplaints"][locale.languageCode]; - String get expectedArrivalTime => localizedValues["expectedArrivalTime"][locale.languageCode]; - String get errorExpectedArrivalTime => localizedValues["errorExpectedArrivalTimes"][locale.languageCode]; + String get pharmacyRelogin => + localizedValues["pharmacy-relogin"][locale.languageCode]; + String get onlineCheckInAgreement => + localizedValues["onlineCheckInAgreement"][locale.languageCode]; + String get chiefComplaints => + localizedValues["chiefComplaints"][locale.languageCode]; + String get errorChiefComplaints => + localizedValues["errorChiefComplaints"][locale.languageCode]; + String get expectedArrivalTime => + localizedValues["expectedArrivalTime"][locale.languageCode]; + String get errorExpectedArrivalTime => + localizedValues["errorExpectedArrivalTimes"][locale.languageCode]; String get anicllaryOrders => localizedValues["ancillary-orders"][locale.languageCode]; String get mrn => localizedValues["MRN"][locale.languageCode]; @@ -1588,6 +1594,7 @@ class TranslationBase { localizedValues["appointment-no"][locale.languageCode]; String get insuranceID => localizedValues["insurance-id"][locale.languageCode]; + String get enterFile => localizedValues["enter-file"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 9bfd725e4f505af90830f3541962da304ad674e4 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 15 Mar 2021 19:08:57 +0300 Subject: [PATCH 2/3] bug fixes --- lib/theme/theme_value.dart | 13 +- lib/uitl/utils.dart | 98 +-- .../data_display/services)contaniner.dart | 3 +- lib/widgets/drawer/app_drawer_widget.dart | 758 +++++++++--------- 4 files changed, 451 insertions(+), 421 deletions(-) diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index e209081d..e20d6439 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -45,9 +45,9 @@ defaultTheme({fontName}) { primaryTextTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)), iconTheme: IconThemeData(), textTheme: TextTheme( - bodyText1: TextStyle(color: Colors.black), - headline1: TextStyle(color: Colors.white), - ), + bodyText1: TextStyle(color: Colors.black), + headline1: TextStyle(color: Colors.white), + headline2: TextStyle(color: Colors.white)), appBarTheme: AppBarTheme( color: Color(0xff515A5D), brightness: Brightness.light, @@ -74,9 +74,9 @@ invertThemes({fontName}) { ), hintColor: Colors.grey[400], textTheme: TextTheme( - bodyText1: TextStyle(color: Colors.white), - headline1: TextStyle(color: Colors.white), - ), + bodyText1: TextStyle(color: Colors.white), + headline1: TextStyle(color: Colors.white), + headline2: TextStyle(color: Colors.white)), disabledColor: Colors.grey[800], errorColor: Color.fromRGBO(235, 80, 60, 1.0), scaffoldBackgroundColor: Color(0xff000000), // Colors.grey[100], @@ -125,6 +125,7 @@ bwThemes({fontName}) { textTheme: TextTheme( bodyText1: TextStyle(color: Colors.red[900]), headline1: TextStyle(color: Colors.red[900]), + headline2: TextStyle(color: Colors.white), bodyText2: TextStyle(color: Colors.red[900]), subtitle1: TextStyle(color: Colors.red[900]), ), diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index c08d68a4..5b3e1c8c 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -183,10 +183,9 @@ class Utils { // } } - static getPhoneNumberWithoutZero(String number){ - String newNumber=""; - if(number.startsWith('0')) - { + static getPhoneNumberWithoutZero(String number) { + String newNumber = ""; + if (number.startsWith('0')) { newNumber = number.substring(1); } return newNumber; @@ -202,7 +201,11 @@ class Utils { .hasMatch(email); } - static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + static List myMedicalList( + {ProjectViewModel projectViewModel, + BuildContext context, + bool isLogin, + count}) { List medical = List(); if (projectViewModel.havePrivilege(5)) { medical.add(InkWell( @@ -406,16 +409,16 @@ class Utils { )); } if (projectViewModel.havePrivilege(20)) - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: HomeReportPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).medical, - imagePath: 'medical_reports_icon.png', - subTitle: TranslationBase.of(context).medicalSubtitle, - ), - )); + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomeReportPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medical, + imagePath: 'medical_reports_icon.png', + subTitle: TranslationBase.of(context).medicalSubtitle, + ), + )); if (projectViewModel.havePrivilege(19)) { medical.add(InkWell( @@ -477,16 +480,16 @@ class Utils { )); } if (projectViewModel.havePrivilege(30)) - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: SmartWatchInstructions())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).smartWatches, - imagePath: 'smartwatch_icon.png', - subTitle: TranslationBase.of(context).smartWatchesSubtitle, - ), - )); + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: SmartWatchInstructions())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).smartWatches, + imagePath: 'smartwatch_icon.png', + subTitle: TranslationBase.of(context).smartWatchesSubtitle, + ), + )); if (projectViewModel.havePrivilege(28)) { medical.add(InkWell( @@ -500,25 +503,29 @@ class Utils { ), )); } - if (projectViewModel.havePrivilege(32) || true) { + if (projectViewModel.havePrivilege(32) || true) { medical.add(InkWell( - onTap: () { - userData().then((userData_){ - if (projectViewModel.isLogin && userData_ != null) { - String patientID = userData_.patientID.toString(); - GifLoaderDialogUtils.showMyDialog(context); - projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}); - } else { - AlertDialogBox( - context: context, - confirmMessage: "Please login with your account first to use this feature", - okText: "OK", - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - }).showAlertDialog(context); - } - }); - }, + onTap: () { + userData().then((userData_) { + if (projectViewModel.isLogin && userData_ != null) { + String patientID = userData_.patientID.toString(); + GifLoaderDialogUtils.showMyDialog(context); + projectViewModel + .platformBridge() + .connectHMGInternetWifi(patientID) + .then((value) => {GifLoaderDialogUtils.hideDialog(context)}); + } else { + AlertDialogBox( + context: context, + confirmMessage: + "Please login with your account first to use this feature", + okText: "OK", + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + }).showAlertDialog(context); + } + }); + }, child: MedicalProfileItem( title: TranslationBase.of(context).internet, imagePath: 'insurance_card_icon.png', @@ -546,12 +553,11 @@ class Utils { } Future userData() async { - var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER)); + var userData = AuthenticatedUser.fromJson( + await AppSharedPreferences().getObject(MAIN_USER)); return userData; } - - // extension function that use in iterations(list.. etc) to iterate items and get index and item it self extension IndexedIterable on Iterable { Iterable mapIndexed(T Function(E e, int i) f) { diff --git a/lib/widgets/data_display/services)contaniner.dart b/lib/widgets/data_display/services)contaniner.dart index cb0b3774..e435539f 100644 --- a/lib/widgets/data_display/services)contaniner.dart +++ b/lib/widgets/data_display/services)contaniner.dart @@ -15,7 +15,7 @@ class ServicesContainer extends StatelessWidget { height: 60, margin: EdgeInsets.all(8), decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: Theme.of(context).textTheme.headline2.color, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), @@ -38,6 +38,7 @@ class ServicesContainer extends StatelessWidget { Texts( title, fontSize: 16, + color: Colors.black, ), ], ), diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 8822526c..d5ddf3a9 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -61,394 +61,416 @@ class _AppDrawerState extends State { @override Widget build(BuildContext context) { projectProvider = Provider.of(context); - return SizedBox( - width: MediaQuery.of(context).size.width * 0.75, - child: Container( - color: Colors.white, - child: Drawer( - child: Column( - children: [ - Expanded( - flex: 4, - child: ListView( - padding: EdgeInsets.zero, - children: [ - Container( - height: SizeConfig.screenHeight * .30, - child: InkWell( - child: DrawerHeader( - child: Column( - children: [ - Container( - child: - Image.asset('assets/images/logo_HMG.png'), - margin: EdgeInsets.all( - SizeConfig.imageSizeMultiplier * 4), - ), - (user != null && projectProvider.isLogin) - ? Padding( - padding: EdgeInsets.all(15), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Row( + return Container( + width: MediaQuery.of(context).size.width * 0.75, + color: Theme.of(context).scaffoldBackgroundColor, + child: Container( + // color: Colors.white, + child: Theme( + data: Theme.of(context).copyWith( + canvasColor: Theme.of(context).scaffoldBackgroundColor), + child: Drawer( + child: Column( + children: [ + Expanded( + flex: 4, + child: ListView( + padding: EdgeInsets.zero, + children: [ + Container( + height: SizeConfig.screenHeight * .30, + child: InkWell( + child: DrawerHeader( + child: Column( + children: [ + Container( + child: Image.asset( + 'assets/images/logo_HMG.png'), + margin: EdgeInsets.all( + SizeConfig.imageSizeMultiplier * 4), + ), + (user != null && projectProvider.isLogin) + ? Padding( + padding: EdgeInsets.all(15), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.only( - right: 5), - child: Icon( - Icons.account_circle, + Row( + children: [ + Padding( + padding: + EdgeInsets.only( + right: 5), + child: Icon( + Icons.account_circle, + color: + Color(0xFF40ACC9), + )), + AppText( + user.firstName + + ' ' + + user.lastName, color: Color(0xFF40ACC9), + ) + ], + ), + Row(children: [ + Padding( + padding: EdgeInsets.only( + left: 30, top: 5), + child: Column( + children: [ + AppText( + TranslationBase.of( + context) + .fileno + + ": " + + user.patientID + .toString(), + color: Color( + 0xFF40ACC9), + fontSize: SizeConfig + .textMultiplier * + 1.5, + ), + AppText( + user.bloodGroup != + null + ? 'Blood Group: ' + + user.bloodGroup + : '', + fontSize: SizeConfig + .textMultiplier * + 1.5, + ), + ], + )) + ]) + ])) + : SizedBox(), + ], + ), + ), + ), + ), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + InkWell( + child: DrawerItem( + TranslationBase.of(context).arabicChange, + Icons.translate), + onTap: () { + sharedPref.setBool(IS_ROBOT_INIT, null); + if (projectProvider.isArabic) { + projectProvider.changeLanguage('en'); + } else { + projectProvider.changeLanguage('ar'); + } + }, + ), + (user != null && projectProvider.isLogin) + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + (user.isFamily == null || + user.isFamily == false) && + projectProvider.havePrivilege(2) + ? InkWell( + child: DrawerItem( + TranslationBase.of(context) + .family, + Icons.group, + textColor: Theme.of(context) + .textTheme + .bodyText1 + .color, + iconColor: Theme.of(context) + .textTheme + .bodyText1 + .color, + bottomLine: false, + sideArrow: true, + ), + onTap: () { + Navigator.of(context).pushNamed( + MY_FAMILIY, + ); + }, + ) + : SizedBox(), + FutureBuilder( + future: getFamilyFiles(), // async work + builder: (BuildContext context, + AsyncSnapshot< + GetAllSharedRecordsByStatusResponse> + snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Padding( + padding: EdgeInsets.all(10), + child: Text('')); + default: + if (snapshot.hasError) + return Padding( + padding: EdgeInsets.all(10), + child: + Text(snapshot.error)); + else + return Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + // <--- left side + color: Colors.grey[200], + width: 1.0, + ), )), - AppText( - user.firstName + - ' ' + - user.lastName, - color: Color(0xFF40ACC9), - ) - ], - ), - Row(children: [ - Padding( - padding: EdgeInsets.only( - left: 30, top: 5), - child: Column( - children: [ - AppText( - TranslationBase.of( - context) - .fileno + - ": " + - user.patientID - .toString(), - color: - Color(0xFF40ACC9), - fontSize: SizeConfig - .textMultiplier * - 1.5, + child: Column( + children: [ + user.isFamily == true + ? Container( + padding: EdgeInsets + .only( + bottom: + 5), + child: InkWell( + onTap: () { + switchUser( + mainUser, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: < + Widget>[ + Expanded( + child: + Icon(Icons.person), + ), + Expanded( + flex: + 7, + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(mainUser.firstName + ' ' + mainUser.lastName, color: Theme.of(context).textTheme.bodyText1.color), + AppText( + TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString(), + color: Theme.of(context).textTheme.bodyText1.color, + ), + ])), + ], + ))) + : SizedBox(), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + mainAxisSize: + MainAxisSize + .min, + children: snapshot + .data + .getAllSharedRecordsByStatusList + .map( + (result) { + return result + .status == + 3 + ? Container( + padding: EdgeInsets.only( + bottom: + 5), + child: InkWell( + onTap: () { + switchUser(result, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ), + Expanded( + flex: 7, + child: Padding( + padding: EdgeInsets.only(left: 5, right: 5), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ]))), + ], + ))) + : SizedBox(); + }).toList()) + ], + )); + } + }, + ), + InkWell( + child: Stack( + children: [ + DrawerItem( + TranslationBase.of(context) + .notification, + Icons.notifications, + count: notificationCount != null + ? new Container( + padding: + EdgeInsets.all(4), + margin: EdgeInsets.all(2), + decoration: + new BoxDecoration( + color: Colors.red, + borderRadius: + BorderRadius + .circular(20), ), - AppText( - user.bloodGroup != null - ? 'Blood Group: ' + - user.bloodGroup - : '', - fontSize: SizeConfig - .textMultiplier * - 1.5, + constraints: + BoxConstraints( + minWidth: 20, + minHeight: 20, ), - ], - )) - ]) - ])) - : SizedBox(), - ], - ), - ), - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - InkWell( - child: DrawerItem( - TranslationBase.of(context).arabicChange, - Icons.translate), - onTap: () { - sharedPref.setBool(IS_ROBOT_INIT, null); - if (projectProvider.isArabic) { - projectProvider.changeLanguage('en'); - } else { - projectProvider.changeLanguage('ar'); - } - }, - ), - (user != null && projectProvider.isLogin) - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - (user.isFamily == null || - user.isFamily == false) && - projectProvider.havePrivilege(2) - ? InkWell( + child: new Text( + notificationCount, + style: new TextStyle( + color: Colors.white, + fontSize: + projectProvider + .isArabic + ? 8 + : 9, + ), + textAlign: + TextAlign.center, + ), + // ), + ) + : SizedBox(), + ), + ], + ), + onTap: () { + //NotificationsPage + Navigator.of(context).pop(); + Navigator.push( + context, + FadePage( + page: NotificationsPage())); + }, + ), + if (projectProvider.havePrivilege(3)) + InkWell( child: DrawerItem( - TranslationBase.of(context).family, - Icons.group, - textColor: Theme.of(context) - .textTheme - .bodyText1 - .color, - iconColor: Theme.of(context) - .textTheme - .bodyText1 - .color, - bottomLine: false, - sideArrow: true, - ), + TranslationBase.of(context) + .appsetting, + Icons.settings_input_composite), onTap: () { Navigator.of(context).pushNamed( - MY_FAMILIY, + SETTINGS, ); }, - ) - : SizedBox(), - FutureBuilder( - future: getFamilyFiles(), // async work - builder: (BuildContext context, - AsyncSnapshot< - GetAllSharedRecordsByStatusResponse> - snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.all(10), - child: Text('')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text(snapshot.error)); - else - return Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - // <--- left side - color: Colors.grey[200], - width: 1.0, - ), - )), - child: Column( - children: [ - user.isFamily == true - ? Container( - padding: - EdgeInsets.only( - bottom: 5), - child: InkWell( - onTap: () { - switchUser( - mainUser, - context); - }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Expanded( - child: Icon( - Icons - .person), - ), - Expanded( - flex: 7, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText(mainUser.firstName + ' ' + mainUser.lastName), - AppText(TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString()), - ])), - ], - ))) - : SizedBox(), - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - mainAxisSize: - MainAxisSize.min, - children: snapshot.data - .getAllSharedRecordsByStatusList - .map( - (result) { - return result - .status == - 3 - ? Container( - padding: EdgeInsets - .only( - bottom: - 5), - child: InkWell( - onTap: () { - switchUser( - result, - context); - }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: < - Widget>[ - Expanded( - child: - Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - ), - Expanded( - flex: 7, - child: Padding( - padding: EdgeInsets.only(left: 5, right: 5), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - ]))), - ], - ))) - : SizedBox(); - }).toList()) - ], - )); - } - }, - ), - InkWell( - child: Stack( - children: [ - DrawerItem( - TranslationBase.of(context) - .notification, - Icons.notifications, - count: notificationCount != null - ? new Container( - padding: EdgeInsets.all(4), - margin: EdgeInsets.all(2), - decoration: new BoxDecoration( - color: Colors.red, - borderRadius: - BorderRadius.circular( - 20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - notificationCount, - style: new TextStyle( - color: Colors.white, - fontSize: projectProvider - .isArabic - ? 8 - : 9, - ), - textAlign: TextAlign.center, - ), - // ), - ) - : SizedBox(), ), - ], - ), - onTap: () { - //NotificationsPage - Navigator.of(context).pop(); - Navigator.push(context, - FadePage(page: NotificationsPage())); - }, - ), - if (projectProvider.havePrivilege(3)) - InkWell( - child: DrawerItem( - TranslationBase.of(context) - .appsetting, - Icons.settings_input_composite), - onTap: () { - Navigator.of(context).pushNamed( - SETTINGS, - ); - }, - ), - InkWell( - child: DrawerItem( - TranslationBase.of(context).rateApp, - Icons.star), - onTap: () { - if (Platform.isIOS) { - launch( - "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); - } else { - launch( - "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); - } - }, - ), - InkWell( + InkWell( + child: DrawerItem( + TranslationBase.of(context).rateApp, + Icons.star), + onTap: () { + if (Platform.isIOS) { + launch( + "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); + } else { + launch( + "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + } + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).logout, + Icons.lock_open), + onTap: () { + logout(); + }, + ) + ], + ) + : InkWell( child: DrawerItem( - TranslationBase.of(context).logout, + TranslationBase.of(context) + .loginregister, Icons.lock_open), onTap: () { - logout(); + login(); }, - ) - ], - ) - : InkWell( - child: DrawerItem( - TranslationBase.of(context).loginregister, - Icons.lock_open), - onTap: () { - login(); - }, - ), - // InkWell( - // child: DrawerItem( - // TranslationBase.of(context).appsetting, - // Icons.settings_input_composite), - // onTap: () { - // Navigator.of(context).pushNamed( - // SETTINGS, - // ); - // }, - // ) + ), + // InkWell( + // child: DrawerItem( + // TranslationBase.of(context).appsetting, + // Icons.settings_input_composite), + // onTap: () { + // Navigator.of(context).pushNamed( + // SETTINGS, + // ); + // }, + // ) + ], + )) ], - ) - ], - ), - ), - Expanded( - flex: 1, - child: Column( - children: [ - Container( - child: Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ - Text(TranslationBase.of(context).poweredBy), - Image.asset( - 'assets/images/cs_logo_container.png', - width: SizeConfig.imageSizeMultiplier * 30, - ) - ], - ), - Column( - children: [ - Image.asset( - 'assets/images/new-design/vidamobile.png', - width: SizeConfig.imageSizeMultiplier * 25, - ) + ), + ), + Expanded( + flex: 1, + child: Column( + children: [ + Container( + child: Align( + alignment: FractionalOffset.bottomCenter, + child: Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Column( + children: [ + Text(TranslationBase.of(context) + .poweredBy), + Image.asset( + 'assets/images/cs_logo_container.png', + width: + SizeConfig.imageSizeMultiplier * 30, + ) + ], + ), + Column( + children: [ + Image.asset( + 'assets/images/new-design/vidamobile.png', + width: + SizeConfig.imageSizeMultiplier * 25, + ) + ], + ), ], ), - ], + ), ), - ), - ), - ) - ], - ), - ) - ], + ) + ], + ), + ) + ], + ), + ), ), - ), - ), - ); + )); } drawerNavigator(context, routeName) { From 60b1688bb4ff81264f69aeb8c23387d551366782 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 16 Mar 2021 10:40:17 +0300 Subject: [PATCH 3/3] chatbot --- lib/uitl/utils.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 5b3e1c8c..b4804a21 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -36,6 +36,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../Constants.dart'; import 'app_shared_preferences.dart'; @@ -536,10 +537,9 @@ class Utils { if (projectViewModel.havePrivilege(40)) { medical.add(InkWell( -// onTap: () { -// Navigator.push( -// context, FadePage(page: InsuranceApproval())); -// }, + onTap: () { + launch('whatsapp://send?phone=18885521858&text='); + }, child: MedicalProfileItem( title: TranslationBase.of(context).chatbot, imagePath: 'insurance_approvals_icon.png',