diff --git a/lib/config/config.dart b/lib/config/config.dart index 81c5f2e4..2317361f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -243,6 +243,9 @@ const GET_USER_TERMS = '/Services/Patients.svc/REST/GetUserTermsAndConditions'; const UPDATE_HEALTH_TERMS = '/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; +/// +const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege'; + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; diff --git a/lib/core/model/privilege/PrivilegeModel.dart b/lib/core/model/privilege/PrivilegeModel.dart new file mode 100644 index 00000000..3b629fde --- /dev/null +++ b/lib/core/model/privilege/PrivilegeModel.dart @@ -0,0 +1,24 @@ +class PrivilegeModel { + int iD; + String serviceName; + bool privilege; + dynamic region; + + PrivilegeModel({this.iD, this.serviceName, this.privilege, this.region}); + + PrivilegeModel.fromJson(Map json) { + iD = json['ID']; + serviceName = json['ServiceName']; + privilege = json['Previlege']; + region = json['Region']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['ServiceName'] = this.serviceName; + data['Previlege'] = this.privilege; + data['Region'] = this.region; + return data; + } +} diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart new file mode 100644 index 00000000..5beef992 --- /dev/null +++ b/lib/core/service/privilege_service.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PrivilegeService extends BaseService { + + List privilegeModelList = List(); + + Future getPrivilege() async { + Map body = Map(); + body['PatientType'] = 4; + await baseAppClient.post(GET_PRIVILEGE, + onSuccess: (dynamic response, int statusCode) { + response['ServicePrivilegeList'].forEach((item) { + privilegeModelList.add(PrivilegeModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index d2b7cf8b..700ab2a4 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -2,6 +2,8 @@ import 'dart:async'; import 'package:connectivity/connectivity.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -18,9 +20,7 @@ class ProjectViewModel extends BaseViewModel { bool isError = false; String error = ''; dynamic searchvalue; - bool isLogin - = false; - + bool isLogin = false; dynamic get searchValue => searchvalue; @@ -30,12 +30,18 @@ class ProjectViewModel extends BaseViewModel { bool get isArabic => _isArabic; - // BaseViewModel baseViewModel = locator() + + bool isLoginChild = false; + List privilegeRootUser = List(); + List privilegeChildUser = List(); + + List get privileges => + isLoginChild ? privilegeChildUser : privilegeChildUser; + StreamSubscription subscription; ProjectViewModel() { loadSharedPrefLanguage(); - subscription = Connectivity() .onConnectivityChanged .listen((ConnectivityResult result) { @@ -78,6 +84,49 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } + setPrivilegeModelList( + {List privilege}) { + this.isLoginChild = isLoginChild; + privilegeRootUser = privilege; + + notifyListeners(); + } + + setPrivilege({privilegeList, bool isLoginChild = false}) { + List privilege = List(); + + privilegeList['List'][0]['ListPrivilege'].forEach((item) { + privilege.add(PrivilegeModel.fromJson(item)); + }); + + this.isLoginChild = isLoginChild; + if (isLoginChild) + privilegeChildUser = privilege; + else + privilegeRootUser = privilege; + + notifyListeners(); + } + + setIsLoginChild({@required bool isLoginChild}){ + this.isLoginChild = isLoginChild; + notifyListeners(); + } + + bool havePrivilege(int id) { + bool isHavePrivilege = false; + if(isLoginChild) + privilegeChildUser.forEach((element) { + if (element.iD == id) isHavePrivilege = element.privilege; + }); + else{ + privilegeRootUser.forEach((element) { + if (element.iD == id) isHavePrivilege = element.privilege; + }); + } + return isHavePrivilege; + } + @override void dispose() { if (subscription != null) subscription.cancel(); diff --git a/lib/locator.dart b/lib/locator.dart index 8e5f7dde..812bff98 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -47,6 +47,7 @@ import 'core/service/medical/reports_monthly_service.dart'; import 'core/service/medical/vital_sign_service.dart'; import 'core/service/parmacyModule/order-preview-service.dart'; import 'core/service/notifications_service.dart'; +import 'core/service/privilege_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/service/parmacyModule/parmacy_module_service.dart'; @@ -144,6 +145,7 @@ void setupLocator() { locator.registerLazySingleton(() => PharmacyModuleService()); locator.registerLazySingleton(() => OrderPreviewService()); locator.registerLazySingleton(() => CustomerAddressesService()); + locator.registerLazySingleton(() => PrivilegeService()); /// View Model diff --git a/lib/models/Authentication/check_activation_code_response.dart b/lib/models/Authentication/check_activation_code_response.dart index 3a0aed65..55ba6559 100644 --- a/lib/models/Authentication/check_activation_code_response.dart +++ b/lib/models/Authentication/check_activation_code_response.dart @@ -270,7 +270,7 @@ class CheckActivationCode { } } -class List { +class Lists { String setupID; int patientType; int patientID; @@ -330,7 +330,7 @@ class List { dynamic tempAddress; dynamic zipCode; - List({ + Lists({ this.setupID, this.patientType, this.patientID, @@ -391,7 +391,7 @@ class List { this.zipCode, }); - List.fromJson(Map json) { + Lists.fromJson(Map json) { setupID = json['SetupID']; patientType = json['PatientType']; patientID = json['PatientID']; diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 1faffd22..60d643c5 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; @@ -31,6 +32,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class AllHabibMedicalService extends StatefulWidget { @@ -57,6 +59,7 @@ class _AllHabibMedicalServiceState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).alhabiServices, @@ -149,6 +152,7 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), + if(projectViewModel.havePrivilege(58)) ServicesContainer( onTap: () => Navigator.push( context, @@ -225,6 +229,7 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/family_menu_icon_red.png', title: TranslationBase.of(context).family, ), + if(projectViewModel.havePrivilege(35)) ServicesContainer( onTap: () => Navigator.push( context, @@ -245,6 +250,7 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), + if(projectViewModel.havePrivilege(42)) ServicesContainer( onTap: () => Navigator.push( context, @@ -252,7 +258,8 @@ class _AllHabibMedicalServiceState extends State { ), imageLocation: 'assets/images/new-design/body_icon.png', title: 'Symptom Checker'), - ServicesContainer( + if(projectViewModel.havePrivilege(36)) + ServicesContainer( onTap: () => Navigator.push( context, FadePage(page: BloodDonationPage()), @@ -282,6 +289,7 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/health_convertor_icon.png', title: 'Health Converter', ), + if(projectViewModel.havePrivilege(38)) ServicesContainer( onTap: () => Navigator.push( context, @@ -292,6 +300,7 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/new-design/water_icon.png', title: 'H2O', ), + if(projectViewModel.havePrivilege(41)) ServicesContainer( onTap: () => Navigator.push( context, diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 80de8ecd..196f9e19 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -1,27 +1,22 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -37,7 +32,6 @@ class MyFamily extends StatefulWidget { } class _MyFamily extends State with TickerProviderStateMixin { - List imagesInfo = List(); final familyFileProvider = FamilyFilesProvider(); AppSharedPreferences sharedPref = new AppSharedPreferences(); var userID; @@ -49,6 +43,7 @@ class _MyFamily extends State with TickerProviderStateMixin { locator(); ProjectViewModel projectViewModel; AuthenticatedUser user; + List imagesInfo = List(); @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); @@ -646,26 +641,9 @@ class _MyFamily extends State with TickerProviderStateMixin { loginAfter(result, context) async{ GifLoaderDialogUtils.hideDialog(context); - // var familyFile = await sharedPref.getObject(FAMILY_FILE); - // var mainUser = await sharedPref.getObject(MAIN_USER); - // result = CheckActivationCode.fromJson(result); - // this.sharedPref.clear(); - // this.sharedPref.setObject(FAMILY_FILE, familyFile); - // this.sharedPref.setObject(MAIN_USER, mainUser); - // result.list.isFamily = true; - // this.sharedPref.setObject(USER_PROFILE, result.list); - // this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); - // this.sharedPref.setString(TOKEN, result.authenticationTokenID); - // - // authenticatedUserObject.isLogin = true; - // appointmentRateViewModel.isLogin = true; - // projectViewModel.isLogin = true; - // //this.checkIfUserAgreedBefore(result), - // Navigator.of(context).pushNamed( - // HOME, - // ); - result = list.CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); + Provider.of(context, listen: false).setPrivilege(privilegeList: result,isLoginChild: true); + result = CheckActivationCode.fromJson(result); var mainUser = await sharedPref.getObject(MAIN_USER); this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 9c82ff09..5e857011 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -435,11 +435,13 @@ class _HomePageState extends State { ), ], ), + if(projectViewModel.havePrivilege(64)||projectViewModel.havePrivilege(65)||projectViewModel.havePrivilege(67)) Container( margin: EdgeInsets.only(left: 15, right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + if(projectViewModel.havePrivilege(64)) DashboardItem( onTap: () { Navigator.push( @@ -478,6 +480,7 @@ class _HomePageState extends State { imageName: 'home_healthcare_service_bg.png', opacity: 0.5, ), + if(projectViewModel.havePrivilege(65)) DashboardItem( //onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())), @@ -508,6 +511,7 @@ class _HomePageState extends State { height: MediaQuery.of(context).size.width * 0.4, imageName: 'al-habib_onlne_pharmacy_bg.png', ), + if(projectViewModel.havePrivilege(67)) DashboardItem( onTap: (){ Navigator.push( @@ -623,6 +627,7 @@ class _HomePageState extends State { borderRadius: BorderRadius.circular(6.0), color: Colors.white, )), + if(projectViewModel.havePrivilege(60)) Container( width: MediaQuery.of(context).size.width * 0.29, child: InkWell( diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index e08f1773..b4014fbc 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -444,7 +444,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { index: currentTab, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - floatingActionButton: currentTab == 0 + floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0) ? FloatingButton( elevation: true, onTap: () { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 50cada42..2b02540b 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -515,6 +515,7 @@ class _ConfirmLogin extends State { .then((result) => { if (result is Map) { + projectViewModel.setPrivilege(privilegeList: result), result = CheckActivationCode.fromJson(result), if (this.registerd_data != null && this.registerd_data.isRegister == true) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index db4ba713..cc1a0350 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -242,6 +242,7 @@ class _Login extends State { // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { sharedPref.remove(FAMILY_FILE), + projectViewModel.setPrivilege(privilegeList: result), result = CheckActivationCode.fromJson(result), result.list.isFamily = false, this.sharedPref.setObject(USER_PROFILE, result.list), diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index 26503c89..373c3c79 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -1,10 +1,12 @@ import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class ContactLensPage extends StatelessWidget { final ListHISGetContactLensPerscription listHISGetContactLensPerscription; @@ -14,6 +16,7 @@ class ContactLensPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( body: SingleChildScrollView( child: Container( @@ -82,6 +85,7 @@ class ContactLensPage extends StatelessWidget { SizedBox( height: 17, ), + if(projectViewModel.havePrivilege(15)) Container( width: double.infinity, child: SecondaryButton( diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 052b196e..d7c479d6 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -47,12 +48,15 @@ class MedicalProfilePage extends StatefulWidget { class _MedicalProfilePageState extends State { var authProvider = new AuthProvider(); - + List medical=List(); + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); - return BaseView( + + List myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel,context: context,count: appoCountProvider.count,isLogin: projectViewModel.isLogin); + return BaseView( onModelReady: (model) => model.getAppointmentHistory(), builder: (_, model, widget) => AppScaffold( isShowDecPage: false, @@ -92,457 +96,30 @@ class _MedicalProfilePageState extends State { ], ), ), + SizedBox(height: 50,), Padding( padding: EdgeInsets.symmetric(vertical: 5.0), - child: Column( - children: [ - if(model.isLogin) - Container( - width: double.infinity, - height: 55, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: MyAppointments(), - ), - ); - }, - child: authProvider.isLogin - ? Stack(children: [ - MedicalProfileItem( - title: - TranslationBase.of(context) - .myAppointments, - imagePath: - 'my_appointment_icon.png', - subTitle: - TranslationBase.of(context) - .myAppointmentsList, - hasBadge: true, - ), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: - BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: Colors - .red[800].withOpacity(1.0), - borderRadius: - BorderRadius.circular(8), - badgeContent: Container( - padding: - EdgeInsets.all(2.0), - child: Text( - appoCountProvider.count - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 16.0)), - ), - ), - ), - ]) - : MedicalProfileItem( - title: TranslationBase.of(context) - .myAppointments, - imagePath: - 'my_appointment_icon.png', - subTitle: - TranslationBase.of(context) - .myAppointmentsList, - hasBadge: true, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LabsHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).lab, - imagePath: 'lab_result_icon.png', - subTitle: TranslationBase.of(context).labSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .radiology, - imagePath: 'radiology_icon.png', - subTitle: TranslationBase.of(context) - .radiologySubtitle, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .medicines, - imagePath: 'prescription_icon.png', - subTitle: TranslationBase.of(context) - .medicinesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: VitalSignDetailsScreen(), - ), - ), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .vitalSigns, - imagePath: 'vital_signs.png', - subTitle: TranslationBase.of(context) - .vitalSignsSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: ActiveMedicationsPage())), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myMedical, - imagePath: 'active_medications.png', - subTitle: TranslationBase.of(context) - .myMedicalSubtitle, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: DoctorHomePage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myDoctor, - imagePath: 'doctor_icon.png', - subTitle: TranslationBase.of(context) - .myDoctorSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: EyeMeasurementsPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).eye, - imagePath: 'eye_measurement_icon.png', - subTitle: TranslationBase.of(context) - .eyeSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .insurance, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context) - .insuranceSubtitle, - ), - ), - ), - ], - ), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceUpdate())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .updateInsurance, - imagePath: 'insurance_update_icon_.png', - subTitle: TranslationBase.of(context) - .updateInsuranceSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceApproval())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .insuranceApproval, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context) - .insuranceApprovalSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap:()=> Navigator.push(context, FadePage(page: AllergiesPage())) , - child: MedicalProfileItem( - title: TranslationBase.of(context).allergies, - imagePath: 'my_allergies_icon.png', - subTitle: TranslationBase.of(context) - .allergiesSubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyVaccines())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myVaccines, - imagePath: 'my_vaccines_icon.png', - subTitle: TranslationBase.of(context) - .myVaccinesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: 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, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MonthlyReportsPage())); - }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).monthly, - imagePath: 'monthly_reports_icon.png', - subTitle: TranslationBase.of(context) - .monthlySubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PatientSickLeavePage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).sick, - imagePath: 'sick_leaves_icons.png', - subTitle: TranslationBase.of(context) - .sickSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyBalancePage())); - }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).myBalance, - imagePath: 'check-in.png', - subTitle: TranslationBase.of(context) - .myBalanceSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: MedicalProfileItem( - title: - TranslationBase.of(context).patientCall, - imagePath: 'medical_history_icon.png', - subTitle: TranslationBase.of(context) - .patientCallSubtitle, - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - //TODO - onTap: () { - Navigator.push( - context, FadePage(page: SmartWatchInstructions())); + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 2.40), + ), + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + + return myMedicalList[index]; }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .smartWatches, - imagePath: 'smartwatch_icon.png', - subTitle: TranslationBase.of(context) - .smartWatchesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyTrackers())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myTrackers, - imagePath: 'my_tracker_icon.png', - subTitle: TranslationBase.of(context) - .myTrackersSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: (){ - Navigator.push(context, - FadePage(page: AskDoctorHomPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).askYour, - imagePath: 'ask_doctor_icon.png', - subTitle: TranslationBase.of(context) - .askYourSubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - //TODO -// onTap: () { -// Navigator.push( -// context, FadePage(page: DoctorHomePage())); -// }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).internet, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context) - .internetSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( -// onTap: () { -// Navigator.push( -// context, FadePage(page: InsuranceApproval())); -// }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).chatbot, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context) - .chatbotSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: Container(), - ), - ]), - SizedBox( - height: - MediaQuery.of(context).size.height * 0.12, - ) - ], ), ) ], ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.12, + ), if (model.user != null && model.isLogin) Positioned( top: 185, @@ -604,4 +181,20 @@ class _MedicalProfilePageState extends State { ), ); } + + fullMedicalData(){ + if(projectViewModel.havePrivilege(5)) + {} + } +} + +class Medical{ + + final String title; + final String imagePath; + final String subTitle; + final Widget page; + + Medical({this.title, this.imagePath, this.subTitle, this.page}); + } diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 033295aa..4d561d60 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -39,6 +39,7 @@ class _PatientSickLeavePageState extends State { subName: model.sickLeaveList[index].projectName, isInOutPatient: model.sickLeaveList[index].isInOutPatient, + onEmailTap: () { model.sendSickLeaveEmail( message: TranslationBase.of(context).emailSentSuccessfully, diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 696ea2db..f70810dd 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -11,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; @@ -19,6 +21,7 @@ class PrescriptionItemsPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPrescriptionReport(prescriptions: prescriptions), @@ -148,6 +151,7 @@ class PrescriptionItemsPage extends StatelessWidget { child: Column( children: [ Divider(), + if(projectViewModel.havePrivilege(13)) Container( width: MediaQuery.of(context).size.width * 0.8, child: Button( diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 9f8a0640..f7648aad 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -1,12 +1,14 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class RadiologyDetailsPage extends StatelessWidget { @@ -16,6 +18,7 @@ class RadiologyDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getRadImageURL( projectId: finalRadiology.projectID, @@ -29,40 +32,48 @@ class RadiologyDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text('${finalRadiology.reportData}',textAlign: TextAlign.center,), + Text( + '${finalRadiology.reportData}', + textAlign: TextAlign.center, + ), ], ), ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.2, - color: Colors.grey[100], - child: Column( - children: [ - Divider(), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () { - launch(model.radImageURL); - }, - label: TranslationBase.of(context).openRad, - backgroundColor: Colors.grey[800], - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () => model.sendRadReportEmail( - finalRadiology: finalRadiology), - label: TranslationBase.of(context).sendCopyRad, - loading: model.state == ViewState.BusyLocal, - backgroundColor: Theme.of(context).primaryColor, + bottomSheet: (projectViewModel.havePrivilege(9) || + projectViewModel.havePrivilege(8)) + ? Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.2, + color: Colors.grey[100], + child: Column( + children: [ + Divider(), + if (projectViewModel.havePrivilege(9)) + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + onTap: () { + launch(model.radImageURL); + }, + label: TranslationBase.of(context).openRad, + backgroundColor: Colors.grey[800], + ), + ), + if (projectViewModel.havePrivilege(8)) + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + onTap: () => model.sendRadReportEmail( + finalRadiology: finalRadiology), + label: TranslationBase.of(context).sendCopyRad, + loading: model.state == ViewState.BusyLocal, + backgroundColor: Theme.of(context).primaryColor, + ), + ) + ], ), ) - ], - ), - )), + : Container()), ); } } diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 636d4e00..42f207da 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; @@ -12,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class HomeReportPage extends StatefulWidget { @override @@ -37,6 +39,7 @@ class _HomeReportPageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png')); imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); @@ -147,7 +150,7 @@ class _HomeReportPageState extends State SizedBox(height: 110,) ], ), - bottomSheet: Container( + bottomSheet: projectViewModel.havePrivilege(21) ?Container( width: double.infinity, height: 90, margin: EdgeInsets.all(8.0), @@ -161,7 +164,7 @@ class _HomeReportPageState extends State ), ), ), - ), + ):null, ), ), ); diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index cc2fd7ca..fb356dca 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -26,6 +26,7 @@ class PaymentService extends StatelessWidget { children: [ Row( children: [ + if(projectViewModel.havePrivilege(33)) Expanded( child: InkWell( onTap: () => Navigator.push( @@ -61,6 +62,45 @@ class PaymentService extends StatelessWidget { ), ), ), + if(!projectViewModel.havePrivilege(33)) + Expanded( + child: InkWell( + onTap: () => Navigator.push( + context, FadePage(page: MyBalancePage())), + child: Container( + margin: EdgeInsets.all(5.0), + padding: EdgeInsets.all(9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + shape: BoxShape.rectangle), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'My Balances', + color: HexColor('#B61422'), + bold: true, + ), + Texts( + TranslationBase.of(context).payment, + fontSize: 14, + fontWeight: FontWeight.normal, + ), + Align( + alignment: projectViewModel.isArabic + ? Alignment.centerRight + : Alignment.centerLeft, + child: Image.asset( + 'assets/images/al-habib_online_payment_service_icon.png', + height: 55, + ), + ), + ], + ), + ), + ), + ), Expanded( child: Container( margin: EdgeInsets.all(5.0), @@ -97,6 +137,7 @@ class PaymentService extends StatelessWidget { ) ], ), + if(!projectViewModel.havePrivilege(33)) Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 02d67cac..3e81c41c 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -6,6 +7,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; @@ -22,6 +24,7 @@ class MyVaccines extends StatefulWidget { class _MyVaccinesState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getVaccine(), builder: (BuildContext context, VaccineViewModel model, Widget child) => @@ -171,6 +174,7 @@ class _MyVaccinesState extends State { Navigator.push(context, FadePage(page: MyVaccinesItemPage())), ), ), + if(projectViewModel.havePrivilege(27)) Container( width: double.infinity, // height: 80.0, diff --git a/lib/splashPage.dart b/lib/splashPage.dart index d367d3ec..aaffcbbd 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; @@ -20,6 +21,8 @@ class SplashScreen extends StatefulWidget { } class _SplashScreenState extends State { + PrivilegeService _privilegeService = locator(); + //Provider.of(context, listen: false).isLogin @override void initState() { @@ -27,7 +30,7 @@ class _SplashScreenState extends State { Timer( Duration(seconds: 1, milliseconds: 500), () { - getUserData().then((value) { + loadPrivilege().then((value) { Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (BuildContext context) => LandingPage(), @@ -38,14 +41,11 @@ class _SplashScreenState extends State { ); } - Future getUserData() async { - var data = await sharedPref.getObject(USER_PROFILE); - if (data != null) { - AuthenticatedUser userData = AuthenticatedUser.fromJson(data); - Provider.of(context, listen: false).isLogin = true; - authenticatedUserObject.isLogin = true; - authenticatedUserObject.user = userData; - } + + /// load the Privilege from service + Future loadPrivilege() async { + await _privilegeService.getPrivilege(); + Provider.of(context, listen: false).setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); } @override diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 3e1e4892..34c0e58d 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -2,7 +2,33 @@ import 'dart:convert'; import 'dart:core'; import 'dart:typed_data'; +import 'package:badges/badges.dart'; import 'package:connectivity/connectivity.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/Blood/my_balance_page.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'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.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'; +import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart'; +import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers.dart'; +import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; +import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -160,7 +186,340 @@ class Utils { .hasMatch(email); } + static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + List medical = List(); + if (projectViewModel.havePrivilege(5)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: MyAppointments(), + ), + ); + }, + child: isLogin + ? Container( + height: 120, + child: Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + Positioned( + right: 0.0, + child: Badge( + toAnimate: false, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: Color(0xFF40ACC9).withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: + TextStyle(color: Colors.white, fontSize: 16.0)), + ), + ), + ), + ]), + ) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + )); + } + if (projectViewModel.havePrivilege(10)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).lab, + imagePath: 'lab_result_icon.png', + subTitle: TranslationBase.of(context).labSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(7)) { + medical.add(InkWell( + onTap: () => + Navigator.push(context, FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).radiology, + imagePath: 'radiology_icon.png', + subTitle: TranslationBase.of(context).radiologySubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(12)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomePrescriptionsPage(), + ), + ); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicines, + imagePath: 'prescription_icon.png', + subTitle: TranslationBase.of(context).medicinesSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(25)) { + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen(), + ), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).vitalSigns, + imagePath: 'vital_signs.png', + subTitle: TranslationBase.of(context).vitalSignsSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(48)) { + medical.add(InkWell( + onTap: () => + Navigator.push(context, FadePage(page: ActiveMedicationsPage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).myMedical, + imagePath: 'active_medications.png', + subTitle: TranslationBase.of(context).myMedicalSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(6)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'doctor_icon.png', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(14)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: EyeMeasurementsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).eye, + imagePath: 'eye_measurement_icon.png', + subTitle: TranslationBase.of(context).eyeSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(22)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceCard())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).insurance, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).insuranceSubtitle, + ), + )); + } + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceUpdate())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).updateInsurance, + imagePath: 'insurance_update_icon_.png', + subTitle: TranslationBase.of(context).updateInsuranceSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(18)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceApproval())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).insuranceApproval, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(23)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: AllergiesPage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'my_allergies_icon.png', + subTitle: TranslationBase.of(context).allergiesSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(26)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyVaccines())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myVaccines, + imagePath: 'my_vaccines_icon.png', + subTitle: TranslationBase.of(context).myVaccinesSubtitle, + ), + )); + } + 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, + ), + )); + + if (projectViewModel.havePrivilege(19)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MonthlyReportsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).monthly, + imagePath: 'monthly_reports_icon.png', + subTitle: TranslationBase.of(context).monthlySubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(16)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PatientSickLeavePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).sick, + imagePath: 'sick_leaves_icons.png', + subTitle: TranslationBase.of(context).sickSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(47)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyBalancePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myBalance, + imagePath: 'check-in.png', + subTitle: TranslationBase.of(context).myBalanceSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(61)) { + medical.add(MedicalProfileItem( + title: TranslationBase.of(context).patientCall, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context).patientCallSubtitle, + )); + } + + if (projectViewModel.havePrivilege(24)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyTrackers())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myTrackers, + imagePath: 'my_tracker_icon.png', + subTitle: TranslationBase.of(context).myTrackersSubtitle, + ), + )); + } + 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, + ), + )); + + if (projectViewModel.havePrivilege(28)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: AskDoctorHomPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).askYour, + imagePath: 'ask_doctor_icon.png', + subTitle: TranslationBase.of(context).askYourSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(32)) { + medical.add(InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: TranslationBase.of(context).internet, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).internetSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(40)) { + medical.add(InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: TranslationBase.of(context).chatbot, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).chatbotSubtitle, + ), + )); + } + + return medical; + } } + // 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/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 1ae7b684..7cbe7615 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -1,18 +1,20 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../d_q_icons_icons.dart'; import 'bottom_navigation_item.dart'; class BottomNavBar extends StatefulWidget { final ValueChanged changeIndex; - final int index; - - BottomNavBar({Key key, this.changeIndex, this.index}) : super(key: key); + final int index ; + BottomNavBar({Key key, this.changeIndex,this.index}) : super(key: key); @override _BottomNavBarState createState() => _BottomNavBarState(); @@ -27,6 +29,7 @@ class _BottomNavBarState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BottomAppBar( elevation: 4, shape: CircularNotchedRectangle(), @@ -53,7 +56,7 @@ class _BottomNavBarState extends State { currentIndex: 1, name: TranslationBase.of(context).medicalProfile, ), - if (widget.index == 0) + if (widget.index == 0 && projectViewModel.havePrivilege(34)) Expanded( child: SizedBox( height: 50, @@ -66,7 +69,7 @@ class _BottomNavBarState extends State { ), ), ), - if (widget.index != 0) + if (widget.index != 0 && projectViewModel.havePrivilege(34)) BottomNavigationItem( icon: EvaIcons.calendar, activeIcon: EvaIcons.calendar, @@ -83,6 +86,7 @@ class _BottomNavBarState extends State { currentIndex: 3, name: TranslationBase.of(context).myFamily, ), + if(projectViewModel.havePrivilege(51)) BottomNavigationItem( icon: EvaIcons.calendar, activeIcon: EvaIcons.calendar, diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 732a8934..3b790b24 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -135,7 +135,7 @@ class DoctorCard extends StatelessWidget { ), ), ), - if (onEmailTap != null) + if (onEmailTap != null && projectViewModel.havePrivilege(17)) InkWell( onTap: onEmailTap, child: Icon( diff --git a/lib/widgets/data_display/medical/laboratory_result_widget.dart b/lib/widgets/data_display/medical/laboratory_result_widget.dart index d16019b6..20c72f1c 100644 --- a/lib/widgets/data_display/medical/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/laboratory_result_widget.dart @@ -79,6 +79,7 @@ class _LaboratoryResultWidgetState extends State { ), ), ), + if(projectViewModel.havePrivilege(11)) InkWell( onTap: widget.onTap, child: Container( diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index cc77d17d..74334ce1 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -40,8 +40,7 @@ class _AppDrawerState extends State { var familyFileProvider = FamilyFilesProvider(); AuthenticatedUser user; AuthenticatedUser mainUser; - AuthenticatedUserObject authenticatedUserObject = locator< - AuthenticatedUserObject>(); + AuthenticatedUserObject authenticatedUserObject = locator(); VitalSignService _vitalSignService = locator(); @@ -49,10 +48,7 @@ class _AppDrawerState extends State { Widget build(BuildContext context) { projectProvider = Provider.of(context); return SizedBox( - width: MediaQuery - .of(context) - .size - .width * 0.75, + width: MediaQuery.of(context).size.width * 0.75, child: Container( color: Colors.white, child: Drawer( @@ -71,67 +67,66 @@ class _AppDrawerState extends State { children: [ Container( child: - Image.asset('assets/images/DQ/DQ_logo.png'), + Image.asset('assets/images/DQ/DQ_logo.png'), margin: EdgeInsets.all( SizeConfig.imageSizeMultiplier * 4), ), (user != null && projectProvider.isLogin) ? Padding( - padding: EdgeInsets.all(15), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Row( + 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), - )), - 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, - ), - ], - )) - ]) - ])) + ) + ], + ), + 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(), ], ), @@ -143,9 +138,7 @@ class _AppDrawerState extends State { children: [ InkWell( child: DrawerItem( - TranslationBase - .of(context) - .arabicChange, + TranslationBase.of(context).arabicChange, Icons.translate), onTap: () { // Navigator.of(context).pushNamed( @@ -160,263 +153,197 @@ class _AppDrawerState extends State { ), (user != null && projectProvider.isLogin) ? Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - user.isFamily == null || user.isFamily == false - ? InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .family, - Icons.group, - textColor: Color(0xFF40ACC9), - iconColor: Color(0xFF40ACC9), - 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('Loading....')); - 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: < - Widget>[ - 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), + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if(projectProvider.havePrivilege(2)) + InkWell( + child: DrawerItem( + TranslationBase.of(context).family, + Icons.group, + textColor: Color(0xFF40ACC9), + iconColor: Color(0xFF40ACC9), + bottomLine: false, + sideArrow: true, + ), + onTap: () { + Navigator.of(context).pushNamed( + MY_FAMILIY, + ); + }, + ), + // if(projectProvider.havePrivilege(2)) + 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('Loading....')); + 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( - result, + mainUser, context); }, child: Row( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment + .start, children: < Widget>[ Expanded( - child: - Icon(Icons - .person, - color: result - .responseID == - user - .patientID - ? Color( - 0xFF40ACC9) - : Colors - .black), + child: Icon( + Icons + .person), ), Expanded( flex: 7, - child: Padding( - padding: EdgeInsets - .only( - left: 5, - right: 5), - child: Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: < - Widget>[ - 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), - ]))), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText(mainUser.firstName + ' ' + mainUser.lastName), + AppText(TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString()), + ])), ], ))) - : SizedBox(); - }).toList()) - ], - )); - } - }, - ), - InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .notification, - Icons.notifications), - onTap: () { - //NotificationsPage - Navigator.of(context).pop(); - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - NotificationsPage())); - }, - ), - 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( - child: DrawerItem( - TranslationBase - .of(context) - .logout, - Icons.lock_open), - onTap: () { - logout(); - }, - ) - ], - ) + : 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()) + ], + )); + } + }, + ), + if(projectProvider.havePrivilege(1)) + + InkWell( + child: DrawerItem( + TranslationBase.of(context) + .notification, + Icons.notifications), + onTap: () { + //NotificationsPage + Navigator.of(context).pop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + 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( + child: DrawerItem( + TranslationBase.of(context).logout, + Icons.lock_open), + onTap: () { + logout(); + }, + ) + ], + ) : InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .loginregister, - Icons.lock_open), - onTap: () { - login(); - }, - ), + child: DrawerItem( + TranslationBase.of(context).loginregister, + Icons.lock_open), + onTap: () { + login(); + }, + ), ], ) ], @@ -435,9 +362,7 @@ class _AppDrawerState extends State { children: [ Column( children: [ - Text(TranslationBase - .of(context) - .poweredBy), + Text(TranslationBase.of(context).poweredBy), Image.asset( 'assets/images/cs_logo_container.png', width: SizeConfig.imageSizeMultiplier * 30, @@ -490,8 +415,8 @@ class _AppDrawerState extends State { authenticatedUserObject.logout(); projectProvider.isLogin = false; await authenticatedUserObject.getUser(); - _vitalSignService.heightCm = ""; - _vitalSignService.weightKg = ""; + _vitalSignService.heightCm =""; + _vitalSignService.weightKg =""; await sharedPref.clear(); this.user = null; Navigator.of(context).pushNamed(HOME); @@ -541,6 +466,7 @@ class _AppDrawerState extends State { loginAfter(result, context) async { Utils.hideProgressDialog(); + Provider.of(context, listen: false).setPrivilege(privilegeList: result,isLoginChild: true); result = CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); var mainUser = await sharedPref.getObject(MAIN_USER);