diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index aee938c6..bef0e1f4 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -13,11 +13,11 @@ class BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); BaseService() { - getUser(); + _getUser(); } - getUser() async { - user = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - + _getUser() async { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); } } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a72d15a7..53f91de7 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -24,21 +24,21 @@ class BaseAppClient { try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); -// body['SetupID'] = SETUP_ID; -// body['VersionID'] = VERSION_ID; -// body['Channel'] = CHANNEL; -// body['LanguageID'] = LANGUAGE; -// body['IPAdress'] = IP_ADDRESS; -// body['generalid'] = GENERAL_ID; -// // body['PatientOutSA'] = PATIENT_OUT_SA; -// body['SessionID'] = null; //SESSION_ID; -// body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; -// body['DeviceTypeID'] = DeviceTypeID; -// body['PatientType'] = PATIENT_TYPE; -// body['PatientTypeID'] = PATIENT_TYPE_ID; + body['SetupID'] = body.containsKey('SetupID') ? body['SetupID']!=null? body['SetupID'] :SETUP_ID :SETUP_ID; + body['VersionID'] = body.containsKey('VersionID') ? body['VersionID']!=null? body['VersionID'] :VERSION_ID :VERSION_ID; + body['Channel'] = CHANNEL; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + body['IPAdress'] = IP_ADDRESS; + body['generalid'] = GENERAL_ID; + body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA']!=null? body['PatientOutSA'] :PATIENT_OUT_SA :PATIENT_OUT_SA; + body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; + body['DeviceTypeID'] = DeviceTypeID; + body['PatientType'] = body.containsKey('PatientType') ? body['PatientType']!=null? body['PatientType'] :PATIENT_TYPE :PATIENT_TYPE; + body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID']!=null? body['PatientTypeID'] :PATIENT_TYPE_ID :PATIENT_TYPE_ID; if (user != null) { - body['TokenID'] = token; //user['TokenID']; + body['TokenID'] = token; body['PatientID'] = user['PatientID']; body['PatientOutSA'] = user['OutSA']; body['SessionID'] = getSessionId(token); diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index 39065f48..575e4110 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/model/feedback/request_insert_coc_item.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; @@ -19,6 +20,7 @@ class FeedbackService extends BaseService { String attachment, AppointmentHistory appointHistory}) async { hasError = false; + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); _requestInsertCOCItem.attachment = attachment; _requestInsertCOCItem.title = title; @@ -31,7 +33,7 @@ class FeedbackService extends BaseService { _requestInsertCOCItem.patientName = user.firstName + " " + user.lastName; _requestInsertCOCItem.fileName = ""; _requestInsertCOCItem.appVersion = VERSION_ID; - _requestInsertCOCItem.uILanguage = "ar"; //TODO Change it to be dynamic + _requestInsertCOCItem.uILanguage = languageID; //TODO Change it to be dynamic _requestInsertCOCItem.browserInfo = Platform.localHostname; _requestInsertCOCItem.deviceInfo = Platform.localHostname; _requestInsertCOCItem.resolution = "400x847"; diff --git a/lib/core/service/medical/medical_service.dart b/lib/core/service/medical/medical_service.dart new file mode 100644 index 00000000..95d45012 --- /dev/null +++ b/lib/core/service/medical/medical_service.dart @@ -0,0 +1,21 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; + +class MedicalService extends BaseService { + List appoitmentAllHistoryResultList = List(); + + getAppointmentHistory() async { + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, + onSuccess: (response, statusCode) async { + appoitmentAllHistoryResultList.clear(); + response['AppoimentAllHistoryResultList'].forEach((appoitment) { + appoitmentAllHistoryResultList + .add(AppoitmentAllHistoryResultList.fromJson(appoitment)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } +} diff --git a/lib/core/service/medical/vital_sign_service.dart b/lib/core/service/medical/vital_sign_service.dart index 813332cc..1add63cf 100644 --- a/lib/core/service/medical/vital_sign_service.dart +++ b/lib/core/service/medical/vital_sign_service.dart @@ -4,23 +4,20 @@ import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model. import '../base_service.dart'; class VitalSignService extends BaseService { - List vitalSignResModelList = List(); + Map body = Map(); - Future getPatientRadOrders () async { + Future getPatientRadOrders() async { hasError = false; await baseAppClient.post(GET_PATIENT_VITAL_SIGN, onSuccess: (dynamic response, int statusCode) { - vitalSignResModelList.clear(); - response['List_DoctorPatientVitalSign'].forEach((vital) { - vitalSignResModelList.add(VitalSignResModel.fromJson(vital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: Map()); + vitalSignResModelList.clear(); + response['List_DoctorPatientVitalSign'].forEach((vital) { + vitalSignResModelList.add(VitalSignResModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); } - - - } diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 497a96b6..08fc7a9d 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -1,4 +1,7 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; class BaseViewModel extends ChangeNotifier { @@ -9,8 +12,21 @@ class BaseViewModel extends ChangeNotifier { String error = ""; + AuthenticatedUser user; + AppSharedPreferences sharedPref = AppSharedPreferences(); + void setState(ViewState viewState) { _state = viewState; notifyListeners(); } + + BaseViewModel() { + _getUser(); + } + + _getUser() async { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); + notifyListeners(); + } } diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart new file mode 100644 index 00000000..b5db9d80 --- /dev/null +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/medical/medical_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; + +class MedicalViewModel extends BaseViewModel { + List get appoitmentAllHistoryResultList => + List(); + + MedicalService _medicalService = locator(); + + getAppointmentHistory() { + setState(ViewState.Busy); + _medicalService.getAppointmentHistory(); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index f884edcb..529c9e90 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -4,6 +4,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; import 'core/service/medical/labs_service.dart'; +import 'core/service/medical/medical_service.dart'; import 'core/service/medical/my_doctor_service.dart'; import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; @@ -11,6 +12,7 @@ import 'core/service/medical/vital_sign_service.dart'; import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/medical/labs_view_model.dart'; +import 'core/viewModels/medical/medical_view_model.dart'; import 'core/viewModels/medical/my_doctor_view_model.dart'; import 'core/viewModels/medical/prescriptions_view_model.dart'; import 'core/viewModels/medical/radiology_view_model.dart'; @@ -34,7 +36,7 @@ void setupLocator() { locator.registerLazySingleton(() => FeedbackService()); locator.registerLazySingleton(() => InsuranceCardService()); locator.registerLazySingleton(() => VitalSignService()); - + locator.registerLazySingleton(() => MedicalService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -46,4 +48,5 @@ void setupLocator() { locator.registerFactory(() => FeedbackViewModel()); locator.registerFactory(() => VitalSignViewModel()); locator.registerFactory(() => InsuranceViewModel()); + locator.registerFactory(() => MedicalViewModel()); } diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 9ef7c524..9cfa41a9 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -299,7 +299,6 @@ class _InsuranceUpdateState extends State ); }), ), - //////////////// ], )) ], diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index d3c4e378..08e5ba6b 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -1,16 +1,21 @@ import 'dart:math'; +import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; +import '../../locator.dart'; import 'doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; @@ -22,202 +27,414 @@ class MedicalProfilePage extends StatefulWidget { } class _MedicalProfilePageState extends State { + @override Widget build(BuildContext context) { - return AppScaffold( - body: CustomScrollView( - physics: BouncingScrollPhysics(), - key: PageStorageKey("medical"), - slivers: [ - SliverPersistentHeader( - delegate: SliverAppBarDelegate( - maxHeight: 200.0, - minHeight: 200.0, - child: Container( - width: double.infinity, - height: 200, - color: Colors.grey, - ), - ), - ), - SliverPersistentHeader( - delegate: SliverAppBarDelegate( - maxHeight: double.maxFinite, - minHeight: double.maxFinite, - child: Padding( - padding: EdgeInsets.symmetric(vertical: 12.0), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: DoctorHomePage())); - }, - child: MedicalProfileItem( - title: 'My Doctor', - imagePath: 'doctor_icon.png', - subTitle: 'List', - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () {}, - child: MedicalProfileItem( - title: 'Lab', - imagePath: 'lab_result_icon.png', - subTitle: 'Result', + return BaseView( + onModelReady: (model) => model.getAppointmentHistory(), + builder: (_, model, widget) => AppScaffold( + baseViewModel: model, + body: SafeArea( + child: SingleChildScrollView( + child: Column( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + color: Colors.grey, + height: 150, + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 12.0), + child: Column( + children: [ + Container( + width: double.infinity, + height: 30, ), - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: 'Radiology', - imagePath: 'radiology_icon.png', - subTitle: 'Service', + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: MyAppointments())); + }, + child: MedicalProfileItem( + title: 'My Appointments', + imagePath: 'my_appointment_icon.png', + subTitle: 'List', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.push(context, + FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: 'Radiology', + imagePath: 'radiology_icon.png', + subTitle: 'Service', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () {}, + child: MedicalProfileItem( + title: 'Lab', + imagePath: 'lab_result_icon.png', + subTitle: 'Result', + ), + ), + ), + ], ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: HomePrescriptionsPage())); - }, - child: MedicalProfileItem( - title: 'Medicines', - imagePath: 'prescription_icon.png', - subTitle: 'Prescriptions', + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomePrescriptionsPage())); + }, + child: MedicalProfileItem( + title: 'Medicines', + imagePath: 'prescription_icon.png', + subTitle: 'Prescriptions', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen())), + child: MedicalProfileItem( + title: 'Vital Signs', + imagePath: 'medical_history_icon.png', + subTitle: 'Reports', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () => Navigator.push( +// context, FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: 'My Medicines ', + imagePath: 'radiology_icon.png', + subTitle: 'Service', + ), + ), + ), + ], ), - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: 'Insurance', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: DoctorHomePage())); + }, + child: MedicalProfileItem( + title: 'My Doctor', + imagePath: 'doctor_icon.png', + subTitle: 'List', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push(context, +// FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'Eye', + imagePath: + 'insurance_approvals_icon.png', + subTitle: 'Measurement', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: InsuranceCard())); + }, + child: MedicalProfileItem( + title: 'Insurance', + imagePath: 'insurance_card_icon.png', + subTitle: 'Card', + ), + ), + ), + ], ), - ), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Update Insurance', + imagePath: 'insurance_card_icon.png', + subTitle: 'card', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'Insurance Approval', + imagePath: 'insurance_approvals_icon.png', + subTitle: '', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Allergies', + imagePath: 'medical_history_icon.png', + subTitle: 'Diagnosed', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'My Vaccines', + imagePath: 'insurance_card_icon.png', + subTitle: 'card', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'Medical', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Reports', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Monthly', + imagePath: 'medical_history_icon.png', + subTitle: 'Report', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Sick', + imagePath: 'insurance_card_icon.png', + subTitle: 'Leaves', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'My Balance', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Credit', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Patient Call', + imagePath: 'medical_history_icon.png', + subTitle: 'Service', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Smart Watches', + imagePath: 'insurance_card_icon.png', + subTitle: 'Pairing', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'My Trackers', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Service', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Ask Your', + imagePath: 'medical_history_icon.png', + subTitle: 'Doctor', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Internet', + imagePath: 'insurance_card_icon.png', + subTitle: 'Pairing', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'My Trackers', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Service', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Ask Your', + imagePath: 'medical_history_icon.png', + subTitle: 'Doctor', + ), + ), + ]), + ], ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceApproval())); - }, - child: MedicalProfileItem( - title: 'Insurance Approval', - imagePath: 'insurance_approvals_icon.png', - subTitle: 'Card', - ), - ), - ) - ], - ), - Row(children: [ - Expanded( - flex: 1, - child: MedicalProfileItem( - title: 'Medical', - imagePath: 'medical_history_icon.png', - subTitle: 'Reports', + ) + ], + ), + if (model.user != null) + Positioned( + top: 110, + left: 20, + right: 20, + child: Container( + width: double.infinity, + height: 70, + decoration: BoxDecoration( + color: Colors.grey[600], + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: VitalSignDetailsScreen())), - child: MedicalProfileItem( - title: 'Vital Signs', - imagePath: 'medical_history_icon.png', - subTitle: 'Reports', - ), - ), - ), - ]), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: InsuranceUpdate())); - }, - child: MedicalProfileItem( - title: 'Insurance Update', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 8, ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () {}, - child: MedicalProfileItem( - title: 'new', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + Texts( + model.user.firstName + + " " + + model.user.lastName, + color: Colors.white, ), - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: MyAppointments())); - }, - child: MedicalProfileItem( - title: 'My Appointments', - imagePath: 'my_appointment_icon.png', - subTitle: 'List', + SizedBox( + height: 8, ), - ), - ), - Expanded( - flex: 1, - child: Container(), + Texts( + '${model.user.patientID}', + color: Colors.white, + ), + ], ), - ], - ), - ], - ), + ), + ) + ], ), - ), + ], ), - ]), + ), + ), + ), ); } } diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 86a30f79..3ea323df 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -47,6 +47,13 @@ class AppSharedPreferences { return prefs.getString(key); } + /// Get String [key] the key was saved + getStringWithDefaultValue(String key, String defaultVal) async { + final SharedPreferences prefs = await _prefs; + String value = prefs.getString(key); + return value == null ? defaultVal : value; + } + /// Get List of String [key] the key was saved getStringList(String key) async { final SharedPreferences prefs = await _prefs; diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 6357d830..e2baa1e4 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -26,7 +26,7 @@ class MedicalProfileItem extends StatelessWidget { Text( title, style: TextStyle( - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier, color: Hexcolor('#B8382C'), fontWeight: FontWeight.bold), ),