From df9d151f46d336fe2face591eea09d82f6fd7a0a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 7 Dec 2020 12:08:51 +0200 Subject: [PATCH 01/14] refactor Referral Patient Service --- .../service/referral_patient_service.dart | 51 +++++++++++++++++++ lib/core/viewModel/referral_view_model.dart | 38 ++++++++++++++ lib/locator.dart | 4 ++ lib/screens/dashboard_screen.dart | 7 +-- .../doctor/my_referral_patient_screen.dart | 32 ++++-------- .../doctor/my_referral_patient_widget.dart | 27 ++++------ 6 files changed, 114 insertions(+), 45 deletions(-) create mode 100644 lib/core/service/referral_patient_service.dart create mode 100644 lib/core/viewModel/referral_view_model.dart diff --git a/lib/core/service/referral_patient_service.dart b/lib/core/service/referral_patient_service.dart new file mode 100644 index 00000000..088e40ca --- /dev/null +++ b/lib/core/service/referral_patient_service.dart @@ -0,0 +1,51 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; + +class ReferralPatientService extends BaseService { + + List _listMyReferralPatientModel = []; + List get listMyReferralPatientModel => _listMyReferralPatientModel; + + + Helpers helpers = Helpers(); + + + RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); + RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); + + Future getMyReferralPatient() async { + await baseAppClient.post(GET_MY_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + _listMyReferralPatientModel.clear(); + response['List_MyReferralPatient'].forEach((v) { + listMyReferralPatientModel.add(MyReferralPatientModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestMyReferralPatient .toJson(),); + } + + Future replay( + String referredDoctorRemarks, MyReferralPatientModel model) async { + + _requestAddReferredDoctorRemarks.admissionNo = model.admissionNo; + _requestAddReferredDoctorRemarks.patientID = model.patientID; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; + _requestAddReferredDoctorRemarks.lineItemNo = model.lineItemNo; + _requestAddReferredDoctorRemarks.referringDoctor = model.referringDoctor; + await baseAppClient.post(GET_MY_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + model.referredDoctorRemarks = referredDoctorRemarks; + listMyReferralPatientModel[ + listMyReferralPatientModel.indexOf(model)] = model; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestMyReferralPatient .toJson(),); + } +} diff --git a/lib/core/viewModel/referral_view_model.dart b/lib/core/viewModel/referral_view_model.dart new file mode 100644 index 00000000..54c3fd8a --- /dev/null +++ b/lib/core/viewModel/referral_view_model.dart @@ -0,0 +1,38 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/hospitals_model.dart'; +import 'package:doctor_app_flutter/core/service/doctor_reply_service.dart'; +import 'package:doctor_app_flutter/core/service/hospital/hospitals_service.dart'; +import 'package:doctor_app_flutter/core/service/referral_patient_service.dart'; +import 'package:doctor_app_flutter/core/service/schedule_service.dart'; +import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class ReferralPatientViewModel extends BaseViewModel { + ReferralPatientService _referralPatientService = locator(); + + List get listMyReferralPatientModel => _referralPatientService.listMyReferralPatientModel; + + Future getMyReferralPatient() async { + setState(ViewState.Busy); + await _referralPatientService.getMyReferralPatient(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future replay(String referredDoctorRemarks, MyReferralPatientModel model) async { + setState(ViewState.BusyLocal); + await _referralPatientService.replay(referredDoctorRemarks, model); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 053f7535..e394aa52 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -2,9 +2,11 @@ import 'package:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/hospital/hospitals_service.dart'; +import 'core/service/referral_patient_service.dart'; import 'core/service/schedule_service.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/hospital_view_model.dart'; +import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; GetIt locator = GetIt.instance; @@ -15,9 +17,11 @@ void setupLocator() { locator.registerLazySingleton(() => HospitalService()); locator.registerLazySingleton(() => DoctorReplyService()); locator.registerLazySingleton(() => ScheduleService()); + locator.registerLazySingleton(() => ReferralPatientService()); /// View Model locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => DoctorReplayViewModel()); locator.registerFactory(() => ScheduleViewModel()); + locator.registerFactory(() => ReferralPatientViewModel()); } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 0f01dd1e..6b2bd275 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -8,7 +8,6 @@ import 'package:doctor_app_flutter/providers/auth_provider.dart'; import 'package:doctor_app_flutter/providers/hospital_provider.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; -import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -826,11 +825,7 @@ class _DashboardScreenState extends State { context, MaterialPageRoute( builder: (context) => - ChangeNotifierProvider( - create: (_) => - MyReferralPatientProvider(), - child: MyReferralPatient(), - ), + MyReferralPatient(), ), ); }, diff --git a/lib/screens/doctor/my_referral_patient_screen.dart b/lib/screens/doctor/my_referral_patient_screen.dart index 4df450e7..c29ce606 100644 --- a/lib/screens/doctor/my_referral_patient_screen.dart +++ b/lib/screens/doctor/my_referral_patient_screen.dart @@ -1,31 +1,22 @@ -import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/referral_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/doctor/my_referral_patient_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; class MyReferralPatient extends StatelessWidget { - MyReferralPatientProvider referralPatientProvider; @override Widget build(BuildContext context) { - referralPatientProvider = Provider.of(context); - return AppScaffold( - appBarTitle: TranslationBase.of(context).myReferralPatient, - body: referralPatientProvider.isLoading - ? DrAppCircularProgressIndeicator() - : referralPatientProvider.isError - ? Center( - child: AppText( - referralPatientProvider.error, - color: Theme.of(context).errorColor, - ), - ) - : referralPatientProvider.listMyReferralPatientModel.length == 0 + return BaseView( + onModelReady: (model) => model.getMyReferralPatient(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).myReferralPatient, + body: model.listMyReferralPatientModel.length == 0 ? Center( child: AppText( TranslationBase.of(context).errorNoSchedule, @@ -44,11 +35,10 @@ class MyReferralPatient extends StatelessWidget { ), Container( child: Column( - children: referralPatientProvider - .listMyReferralPatientModel + children: model.listMyReferralPatientModel .map((item) { return MyReferralPatientWidget( - myReferralPatientModel: item, + myReferralPatientModel: item, model:model ); }).toList(), ), @@ -58,6 +48,6 @@ class MyReferralPatient extends StatelessWidget { ], ), ), - ); + )); } } diff --git a/lib/widgets/doctor/my_referral_patient_widget.dart b/lib/widgets/doctor/my_referral_patient_widget.dart index f1906578..46167975 100644 --- a/lib/widgets/doctor/my_referral_patient_widget.dart +++ b/lib/widgets/doctor/my_referral_patient_widget.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/referral_view_model.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; -import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; @@ -10,13 +12,11 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; class MyReferralPatientWidget extends StatefulWidget { final MyReferralPatientModel myReferralPatientModel; - - MyReferralPatientWidget({Key key, this.myReferralPatientModel}); + final ReferralPatientViewModel model; + MyReferralPatientWidget({Key key, this.myReferralPatientModel, this.model}); @override _MyReferralPatientWidgetState createState() => @@ -310,30 +310,21 @@ class _MyReferralPatientWidgetState extends State { onTap: () async { final form = _formKey.currentState; if (form.validate()) { - setState(() { - _isLoading = true; - }); + try { - await Provider.of( - context, - listen: false) + await widget.model .replay(answerController.text.toString(), widget.myReferralPatientModel); - setState(() { - _isLoading = false; - }); + // TODO: Add Translation DrAppToastMsg.showSuccesToast( 'Reply Successfully'); } catch (e) { - setState(() { - _isLoading = false; - }); DrAppToastMsg.showErrorToast(e); } } }, title: TranslationBase.of(context).replay, - loading: _isLoading, + loading: widget.model.state == ViewState.BusyLocal, ), ) ], From 911921e0b85ea4004bc5479f66bb2dfc4652eb1e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 8 Dec 2020 13:14:54 +0200 Subject: [PATCH 02/14] in-patient && out-patient --- .../patients/patient_search_screen.dart | 328 +++++------ lib/screens/patients/patients_screen.dart | 532 ++++++++++-------- pubspec.lock | 8 +- 3 files changed, 464 insertions(+), 404 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 2a36c216..ac5cbd84 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -140,7 +140,9 @@ class _PatientSearchScreenState extends State { Padding( padding: const EdgeInsets.only(top: 12.0), child: AppText( - TranslationBase.of(context).searchPatientImageCaptionTitle.toUpperCase(), + TranslationBase.of(context) + .searchPatientImageCaptionTitle + .toUpperCase(), fontWeight: FontWeight.bold, fontSize: SizeConfig.heightMultiplier * 2.5, ), @@ -155,7 +157,6 @@ class _PatientSearchScreenState extends State { ) ], ), - Container( padding: EdgeInsets.all(15), width: SizeConfig.screenWidth * 1, @@ -177,10 +178,9 @@ class _PatientSearchScreenState extends State { style: BorderStyle.solid, color: Hexcolor("#CCCCCC")), borderRadius: - BorderRadius.all(Radius.circular(6.0)), + BorderRadius.all(Radius.circular(6.0)), ), ), - width: double.infinity, child: Padding( padding: EdgeInsets.only( @@ -195,54 +195,53 @@ class _PatientSearchScreenState extends State { // add Expanded to have your dropdown button fill remaining space child: DropdownButtonHideUnderline( child: DropdownButton( - isExpanded: true, - value: _selectedType, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return PATIENT_TYPE.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - !projectsProvider.isArabic - ? AppText( - item['text'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - : AppText( - item['text_ar'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (String newValue) => - { - setState(() { - _selectedType = newValue; - selectedPatientType = - int.parse(_selectedType); - }) - }, - items: PATIENT_TYPE.map((item) { - !projectsProvider.isArabic - ? itemText = item['text'] - : itemText = item['text_ar']; - return DropdownMenuItem( - child: Text( - itemText, - textAlign: TextAlign.end, - ), - value: item['val'], - ); - }).toList(), - )), + isExpanded: true, + value: _selectedType, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return PATIENT_TYPE.map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + !projectsProvider.isArabic + ? AppText( + item['text'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + ) + : AppText( + item['text_ar'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (String newValue) => { + setState(() { + _selectedType = newValue; + selectedPatientType = + int.parse(_selectedType); + }) + }, + items: PATIENT_TYPE.map((item) { + !projectsProvider.isArabic + ? itemText = item['text'] + : itemText = item['text_ar']; + return DropdownMenuItem( + child: Text( + itemText, + textAlign: TextAlign.end, + ), + value: item['val'], + ); + }).toList(), + )), ), ], ), @@ -253,30 +252,23 @@ class _PatientSearchScreenState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC")) - ), + width: 1.0, color: Hexcolor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( - - labelText: TranslationBase - .of(context) - .firstName, + labelText: + TranslationBase.of(context).firstName, borderColor: Colors.white, - onSaved: (value) { value == null ? _patientSearchFormValues.setFirstName = - "0" + "0" : _patientSearchFormValues.setFirstName = - value; + value; - if (value - .toString() - .trim() - .isEmpty) { + if (value.toString().trim().isEmpty) { _patientSearchFormValues.setFirstName = "0"; } }, @@ -290,29 +282,24 @@ class _PatientSearchScreenState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC")) - ), + width: 1.0, color: Hexcolor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( - labelText: TranslationBase - .of(context) - .middleName, + labelText: + TranslationBase.of(context).middleName, borderColor: Colors.white, onSaved: (value) { value == null ? _patientSearchFormValues.setMiddleName = - "0" + "0" : _patientSearchFormValues.setMiddleName = - value; - if (value - .toString() - .trim() - .isEmpty) { + value; + if (value.toString().trim().isEmpty) { _patientSearchFormValues.setMiddleName = - "0"; + "0"; } }, // validator: (value) { @@ -325,27 +312,21 @@ class _PatientSearchScreenState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC")) - ), + width: 1.0, color: Hexcolor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( - labelText: TranslationBase - .of(context) - .lastName, + labelText: TranslationBase.of(context).lastName, borderColor: Colors.white, onSaved: (value) { value == null - ? - _patientSearchFormValues.setLastName = "0" + ? _patientSearchFormValues.setLastName = + "0" : _patientSearchFormValues.setLastName = - value; - if (value - .toString() - .trim() - .isEmpty) { + value; + if (value.toString().trim().isEmpty) { _patientSearchFormValues.setLastName = "0"; } }, @@ -356,30 +337,25 @@ class _PatientSearchScreenState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC")) - ), + width: 1.0, color: Hexcolor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( - labelText: TranslationBase - .of(context) - .phoneNumber, + labelText: + TranslationBase.of(context).phoneNumber, borderColor: Colors.white, textInputType: TextInputType.number, inputFormatter: ONLY_NUMBERS, onSaved: (value) { value == null ? _patientSearchFormValues - .setPatientMobileNumber = "0" + .setPatientMobileNumber = "0" : _patientSearchFormValues - .setPatientMobileNumber = value; + .setPatientMobileNumber = value; - if (value - .toString() - .trim() - .isEmpty) { + if (value.toString().trim().isEmpty) { _patientSearchFormValues .setPatientMobileNumber = "0"; } @@ -391,29 +367,24 @@ class _PatientSearchScreenState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC")) - ), + width: 1.0, color: Hexcolor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( - labelText: TranslationBase - .of(context) - .patientID, + labelText: + TranslationBase.of(context).patientID, borderColor: Colors.white, textInputType: TextInputType.number, inputFormatter: ONLY_NUMBERS, onSaved: (value) { value == null - ? - _patientSearchFormValues.setPatientID = 0 + ? _patientSearchFormValues.setPatientID = + 0 : _patientSearchFormValues.setPatientID = - int.parse(value); - if (value - .toString() - .trim() - .isEmpty) { + int.parse(value); + if (value.toString().trim().isEmpty) { _patientSearchFormValues.setPatientID = 0; } }), @@ -423,16 +394,14 @@ class _PatientSearchScreenState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC")) - ), + width: 1.0, color: Hexcolor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( - labelText: TranslationBase - .of(context) - .patientFile, + labelText: + TranslationBase.of(context).patientFile, borderColor: Colors.white, textInputType: TextInputType.number, inputFormatter: ONLY_NUMBERS, @@ -442,8 +411,8 @@ class _PatientSearchScreenState extends State { (!(_selectedType == '2' || _selectedType == '4')) ? DynamicElements(_patientSearchFormValues) : SizedBox( - height: 0, - ), + height: 0, + ), SizedBox( height: 10, ), @@ -456,7 +425,7 @@ class _PatientSearchScreenState extends State { style: BorderStyle.solid, color: Hexcolor("#CCCCCC")), borderRadius: - BorderRadius.all(Radius.circular(6.0)), + BorderRadius.all(Radius.circular(6.0)), ), ), width: double.infinity, @@ -473,29 +442,29 @@ class _PatientSearchScreenState extends State { // add Expanded to have your dropdown button fill remaining space child: DropdownButtonHideUnderline( child: DropdownButton( - isExpanded: true, - value: _selectedLocation, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return LOCATIONS.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - !projectsProvider.isArabic - ? AppText( - item['text'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - : AppText( - item['text-ar'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) + isExpanded: true, + value: _selectedLocation, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return LOCATIONS.map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + !projectsProvider.isArabic + ? AppText( + item['text'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + ) + : AppText( + item['text-ar'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + ) ], ); }).toList(); @@ -517,7 +486,7 @@ class _PatientSearchScreenState extends State { value: item['val'], ); }).toList(), - )), + )), ), ], ), @@ -530,30 +499,29 @@ class _PatientSearchScreenState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: Hexcolor("#CCCCCC")) - ), - height: 25, - width: 25, - child: Checkbox( - value: true, - checkColor: Hexcolor("#2A930A"), - activeColor: Colors.white, - onChanged: (bool newValue) {}), - ), - SizedBox(width: 12,), - AppText( - TranslationBase - .of(context) - .onlyArrivedPatient, - fontSize: SizeConfig.textMultiplier * - 2), - ])), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: Hexcolor("#CCCCCC"))), + height: 25, + width: 25, + child: Checkbox( + value: true, + checkColor: Hexcolor("#2A930A"), + activeColor: Colors.white, + onChanged: (bool newValue) {}), + ), + SizedBox( + width: 12, + ), + AppText( + TranslationBase.of(context) + .onlyArrivedPatient, + fontSize: SizeConfig.textMultiplier * 2), + ])), SizedBox( height: 10, ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index dc1eda67..a4766f0a 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -352,6 +352,7 @@ class _PatientsScreenState extends State { SizedBox(height: 10.0), Container( width: SizeConfig.screenWidth * 0.9, + height: SizeConfig.screenHeight * 0.05, child: TextField( controller: _controller, onChanged: (String str) { @@ -366,8 +367,11 @@ class _PatientsScreenState extends State { SizedBox( height: 10.0, ), + Divider( + thickness: 1, + color: Colors.grey, + ), Container( - decoration: BoxDecoration( color: Color(0Xffffffff), borderRadius: @@ -376,227 +380,318 @@ class _PatientsScreenState extends State { EdgeInsets.fromLTRB(15, 0, 15, 0), child: (responseModelList.length > 0) ? Column( - // mainAxisAlignment: MainAxisAlignment.center, - children: responseModelList - .map((PatiantInformtion item) { - return Container( - decoration: myBoxDecoration(), - child: InkWell( - child: Row( - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Container( - decoration: - BoxDecoration( - gradient: LinearGradient( - begin: - Alignment( - -1, - -1), - end: - Alignment( - 1, 1), - colors: [ - Colors.grey[ - 100], - Colors.grey[ - 200], - ]), - boxShadow: [ - BoxShadow( - color: Color - .fromRGBO( - 0, - 0, - 0, - 0.08), - offset: - Offset( - 0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: BorderRadius - .all(Radius - .circular( - 50.0)), - ), - width: 80, - height: 80, - child: Icon( - item - .genderDescription == - "Male" - ? DoctorApp - .male - : DoctorApp - .female_icon, - size: 80, - )), - ], - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + // mainAxisAlignment: MainAxisAlignment.center, + children: responseModelList.map( + (PatiantInformtion item) { + return Container( + decoration: + myBoxDecoration(), + child: InkWell( + child: Row( children: [ - SizedBox( - height: 15, - ), - AppText( - item.firstName + - " " + - item.lastName, - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: 8, - ), - AppText( - TranslationBase - .of( - context) - .fileNo + - item.patientId - .toString(), - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - AppText( - TranslationBase - .of( - context) - .age + - item.age - .toString(), - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: 8, - ), - SERVICES_PATIANT2[ - int.parse( - patientType)] == - "List_MyOutPatient" - ? Row( + Column( mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: < - Widget>[ + MainAxisAlignment + .start, + children: [ Container( - height: - 20, - width: 80, - decoration: - BoxDecoration( - borderRadius: - BorderRadius - .circular( - 50), - color: Hexcolor( - "#20A169"), - ), - child: - AppText( - item - .startTime, - color: Colors - .white, - fontSize: - 2 * SizeConfig - .textMultiplier, - textAlign: - TextAlign - .center, - fontWeight: - FontWeight - .bold, - ), - ), - SizedBox( - width: 60, - ), - Container( - child: - AppText( - convertDateFormat2( - item - .appointmentDate - .toString()), - fontSize: - 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight - .bold, - ), - ) + decoration: + BoxDecoration( + gradient: LinearGradient( + begin: Alignment( + -1, + -1), + end: Alignment( + 1, + 1), + colors: [ + Colors + .grey[100], + Colors + .grey[200], + ]), + boxShadow: [ + BoxShadow( + color: Color.fromRGBO( + 0, + 0, + 0, + 0.08), + offset: Offset( + 0.0, + 5.0), + blurRadius: + 16.0) + ], + borderRadius: + BorderRadius.all( + Radius.circular(50.0)), + ), + width: 70, + height: 70, + child: Icon( + item.genderDescription == + "Male" + ? DoctorApp + .male + : DoctorApp + .female_icon, + size: 80, + )), ], - ) - : AppText( - item - .nationalityName ?? - item - .nationalityNameN, - fontSize: 2.5 * - SizeConfig - .textMultiplier, ), + SizedBox( - height: 15, + width: 10, + ), + + Expanded( + child: Column( + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets + .only( + top: 10.5), + child: + AppText( + item.firstName + + " " + + item.lastName, + fontSize: + 2.0 * + SizeConfig.textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + textAlign: + TextAlign.left, + ), + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: < + Widget>[ + SizedBox( + height: + 15, + ), + SizedBox( + height: + 0, + ), + SizedBox( + height: + 3.5, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).fileNo, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.patientId.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + AppText( + 'NATIONALITY: ' + + item.nationalityName.toString(), + fontSize: + 1.8 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: + 8, + ), + SERVICES_PATIANT2[int.parse(patientType)] == + "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: Hexcolor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 25.5, + ) + ], + ) + : SizedBox( + height: 15, + ), + ], + ), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + // mainAxisAlignment: + // MainAxisAlignment + // .spaceBetween, + children: < + Widget>[ + SizedBox( + height: + 20.5, + ), + SizedBox( + height: + 0, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).age, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.age.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).gender, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.gender.toString() == '1' ? 'Male' : 'Female', + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 8, + ), + SERVICES_PATIANT2[int.parse(patientType)] == + "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: Hexcolor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 25.5, + ), + ], + ) + : SizedBox( + height: 15, + ), + ], + ), + ], + ), + ], + ), ), + // Divider(color: Colors.grey) ], ), + onTap: () { + Navigator.of(context) + .pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": item + }); + }, ), - // Divider(color: Colors.grey) - ], - ), - onTap: () { - Navigator.of(context) - .pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": item - }); - }, - ), - ); - }).toList(), - ) + ); + }).toList(), + ) : Center( - child: DrAppEmbeddedError( - error: TranslationBase - .of(context) - .youDontHaveAnyPatient), - ), + child: DrAppEmbeddedError( + error: TranslationBase.of( + context) + .youDontHaveAnyPatient), + ), ), ], ), @@ -609,17 +704,17 @@ class _PatientsScreenState extends State { InputDecoration buildInputDecoration(BuildContext context, hint) { return InputDecoration( - prefixIcon: Icon(Icons.search, color: Colors.red), + prefixIcon: Icon(Icons.search, color: Colors.grey), filled: true, fillColor: Colors.white, hintText: hint, - hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + hintStyle: TextStyle(fontSize: 1.66 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), + borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide(color: Hexcolor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(50.0)), + borderRadius: BorderRadius.all(Radius.circular(10.0)), borderSide: BorderSide(color: Colors.grey), //), )); } @@ -627,10 +722,7 @@ class _PatientsScreenState extends State { Widget _locationBar(BuildContext _context) { return Expanded( child: Container( - height: MediaQuery - .of(context) - .size - .height * 0.065, + height: MediaQuery.of(context).size.height * 0.065, width: SizeConfig.screenWidth * 0.95, decoration: BoxDecoration( color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), @@ -647,7 +739,7 @@ class _PatientsScreenState extends State { height: 40, width: 90, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), + borderRadius: BorderRadius.circular(3.0), color: _isActive ? Hexcolor("#B8382B") : Colors.white, ), child: Center( diff --git a/pubspec.lock b/pubspec.lock index 7694efcf..f597a7ce 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -405,7 +405,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: @@ -447,7 +447,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -662,7 +662,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" stream_channel: dependency: transitive description: @@ -769,5 +769,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0-110 <2.11.0" + dart: ">=2.10.0-110 <=2.11.0-213.1.beta" flutter: ">=1.12.13+hotfix.5 <2.0.0" From 45cde2cb72255f84987b5c9d6adf0cad98f737d3 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 8 Dec 2020 14:04:06 +0200 Subject: [PATCH 03/14] refactor Referred Patient Service --- .../service/referred_patient_service.dart | 65 +++++++++++++++ lib/core/viewModel/referred_view_model.dart | 40 +++++++++ lib/locator.dart | 4 + lib/providers/referral_patient_provider.dart | 77 ----------------- lib/providers/referred_patient_provider.dart | 83 ------------------- lib/screens/dashboard_screen.dart | 7 +- .../doctor/my_referred_patient_screen.dart | 50 +++++------ .../doctor/my_referred_patient_widget.dart | 35 +++----- 8 files changed, 143 insertions(+), 218 deletions(-) create mode 100644 lib/core/service/referred_patient_service.dart create mode 100644 lib/core/viewModel/referred_view_model.dart delete mode 100644 lib/providers/referral_patient_provider.dart delete mode 100644 lib/providers/referred_patient_provider.dart diff --git a/lib/core/service/referred_patient_service.dart b/lib/core/service/referred_patient_service.dart new file mode 100644 index 00000000..0fb3de64 --- /dev/null +++ b/lib/core/service/referred_patient_service.dart @@ -0,0 +1,65 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/doctor/verify_referral_doctor_remarks.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; + +class ReferredPatientService extends BaseService { + List _listMyReferredPatientModel = []; + + List get listMyReferredPatientModel => + _listMyReferredPatientModel; + + Helpers helpers = Helpers(); + + RequestMyReferralPatientModel _requestMyReferralPatient = + RequestMyReferralPatientModel(); + VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = + VerifyReferralDoctorRemarks(); + + Future getMyReferredPatient() async { + await baseAppClient.post( + GET_MY_REFERRED_PATIENT, + onSuccess: (dynamic response, int statusCode) { + _listMyReferredPatientModel.clear(); + response['List_MyReferredPatient'].forEach((v) { + listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestMyReferralPatient.toJson(), + ); + } + + Future verify(MyReferredPatientModel model) async { + _verifyreferraldoctorremarks.patientID = model.projectId; + _verifyreferraldoctorremarks.admissionNo = model.admissionNo; + _verifyreferraldoctorremarks.lineItemNo = model.lineItemNo; + _verifyreferraldoctorremarks.referredDoctorRemarks = + model.referredDoctorRemarks; + _verifyreferraldoctorremarks.referringDoctor = model.referringDoctor; + _verifyreferraldoctorremarks.firstName = model.firstName; + _verifyreferraldoctorremarks.middleName = model.middleName; + _verifyreferraldoctorremarks.lastName = model.lastName; + _verifyreferraldoctorremarks.patientMobileNumber = model.mobileNumber; + _verifyreferraldoctorremarks.patientIdentificationID = + model.patientIdentificationNo; + + await baseAppClient.post( + GET_MY_REFERRED_PATIENT, + onSuccess: (dynamic response, int statusCode) { + listMyReferredPatientModel[listMyReferredPatientModel.indexOf(model)] = + model; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _verifyreferraldoctorremarks.toJson(), + ); + } +} diff --git a/lib/core/viewModel/referred_view_model.dart b/lib/core/viewModel/referred_view_model.dart new file mode 100644 index 00000000..b12241e3 --- /dev/null +++ b/lib/core/viewModel/referred_view_model.dart @@ -0,0 +1,40 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/hospitals_model.dart'; +import 'package:doctor_app_flutter/core/service/doctor_reply_service.dart'; +import 'package:doctor_app_flutter/core/service/hospital/hospitals_service.dart'; +import 'package:doctor_app_flutter/core/service/referral_patient_service.dart'; +import 'package:doctor_app_flutter/core/service/referred_patient_service.dart'; +import 'package:doctor_app_flutter/core/service/schedule_service.dart'; +import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class ReferredPatientViewModel extends BaseViewModel { + ReferredPatientService _referralPatientService = locator(); + + List get listMyReferredPatientModel => _referralPatientService.listMyReferredPatientModel; + + Future getMyReferredPatient() async { + setState(ViewState.Busy); + await _referralPatientService.getMyReferredPatient(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future verify(MyReferredPatientModel model) async { + setState(ViewState.BusyLocal); + await _referralPatientService.verify(model); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index e394aa52..47fce510 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -3,10 +3,12 @@ import 'package:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/hospital/hospitals_service.dart'; import 'core/service/referral_patient_service.dart'; +import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/hospital_view_model.dart'; import 'core/viewModel/referral_view_model.dart'; +import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; GetIt locator = GetIt.instance; @@ -18,10 +20,12 @@ void setupLocator() { locator.registerLazySingleton(() => DoctorReplyService()); locator.registerLazySingleton(() => ScheduleService()); locator.registerLazySingleton(() => ReferralPatientService()); + locator.registerLazySingleton(() => ReferredPatientService()); /// View Model locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => DoctorReplayViewModel()); locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ReferralPatientViewModel()); + locator.registerFactory(() => ReferredPatientViewModel()); } diff --git a/lib/providers/referral_patient_provider.dart b/lib/providers/referral_patient_provider.dart deleted file mode 100644 index afc4d2b7..00000000 --- a/lib/providers/referral_patient_provider.dart +++ /dev/null @@ -1,77 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; -import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; -import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:flutter/cupertino.dart'; - - -class MyReferralPatientProvider with ChangeNotifier { - List listMyReferralPatientModel = []; - - bool isLoading = true; - bool isError = false; - String error = ''; - Helpers helpers = Helpers(); - BaseAppClient baseAppClient = BaseAppClient(); - - - RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); - RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); - - MyReferralPatientProvider() { - getMyReferralPatient(); - } - - getMyReferralPatient() async { - try { - await baseAppClient.post(GET_MY_REFERRAL_PATIENT, - body: _requestMyReferralPatient.toJson(), - onSuccess: (dynamic response, int statusCode) { - response['List_MyReferralPatient'].forEach((v) { - listMyReferralPatientModel.add(MyReferralPatientModel.fromJson(v)); - }); - isError = false; - isLoading = false; - }, - onFailure: (String error, int statusCode) { - isError = true; - isLoading = false; - this.error = error; - }, - ); - notifyListeners(); - } catch (error) { - isLoading = false; - isError = true; - this.error = 'Something wrong happened, please contact the admin'; - notifyListeners(); - } - } - - Future replay( - String referredDoctorRemarks, MyReferralPatientModel model) async { - try { - _requestAddReferredDoctorRemarks.admissionNo = model.admissionNo; - _requestAddReferredDoctorRemarks.patientID = model.patientID; - _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; - _requestAddReferredDoctorRemarks.lineItemNo = model.lineItemNo; - _requestAddReferredDoctorRemarks.referringDoctor = model.referringDoctor; - await baseAppClient.post(ADD_REFERRED_DOCTOR_REMARKS, - body: _requestAddReferredDoctorRemarks.toJson(), - onSuccess: (dynamic body, int statusCode) { - model.referredDoctorRemarks = referredDoctorRemarks; - listMyReferralPatientModel[ - listMyReferralPatientModel.indexOf(model)] = model; - notifyListeners(); - }, - onFailure: (String error, int statusCode) { - throw (error); - }, - ); - } catch (error) { - throw error; - } - } -} diff --git a/lib/providers/referred_patient_provider.dart b/lib/providers/referred_patient_provider.dart deleted file mode 100644 index 2aba752c..00000000 --- a/lib/providers/referred_patient_provider.dart +++ /dev/null @@ -1,83 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; -import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; -import 'package:doctor_app_flutter/models/doctor/verify_referral_doctor_remarks.dart'; - -import 'package:flutter/cupertino.dart'; -import '../util/helpers.dart'; - - -class MyReferredPatientProvider with ChangeNotifier { - List listMyReferredPatientModel = []; - - bool isLoading = true; - bool isError = false; - String error = ''; - Helpers helpers = Helpers(); - RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); - VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = VerifyReferralDoctorRemarks(); - MyReferredPatientProvider() { - getMyReferralPatient(); - } - BaseAppClient baseAppClient = BaseAppClient(); - - - getMyReferralPatient() async { - try { - await baseAppClient.post(GET_MY_REFERRED_PATIENT, - body: _requestMyReferralPatient.toJson(), - onSuccess: (dynamic response, int statusCode) { - response['List_MyReferredPatient'].forEach((v) { - listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); - }); - isError = false; - isLoading = false; - }, - onFailure: (String error, int statusCode) { - isError = true; - isLoading = false; - this.error = error; - }, - ); - notifyListeners(); - } catch (error) { - isLoading = false; - isError = true; - this.error = 'Something wrong happened, please contact the admin'; - notifyListeners(); - } - } - - - Future verify( - MyReferredPatientModel model) async { - try { - _verifyreferraldoctorremarks.patientID=model.projectId; - _verifyreferraldoctorremarks.admissionNo =model.admissionNo; - _verifyreferraldoctorremarks.lineItemNo = model.lineItemNo; - _verifyreferraldoctorremarks.referredDoctorRemarks=model.referredDoctorRemarks; - _verifyreferraldoctorremarks.referringDoctor=model.referringDoctor; - _verifyreferraldoctorremarks.firstName=model.firstName; - _verifyreferraldoctorremarks.middleName=model.middleName; - _verifyreferraldoctorremarks.lastName=model.lastName; - _verifyreferraldoctorremarks.patientMobileNumber=model.mobileNumber; - _verifyreferraldoctorremarks.patientIdentificationID=model.patientIdentificationNo; - - await baseAppClient.post(GET_MY_REFERRED_PATIENT, - body: _verifyreferraldoctorremarks.toJson(), - onSuccess: (dynamic body, int statusCode) { - - listMyReferredPatientModel[ - listMyReferredPatientModel.indexOf(model)] = model; - notifyListeners(); - }, - onFailure: (String error, int statusCode) { - throw(error); - }, - ); - } catch (error) { - throw(error); - } - } -} diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 6b2bd275..bb1f8252 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -8,7 +8,6 @@ import 'package:doctor_app_flutter/providers/auth_provider.dart'; import 'package:doctor_app_flutter/providers/hospital_provider.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; -import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -854,11 +853,7 @@ class _DashboardScreenState extends State { context, MaterialPageRoute( builder: (context) => - ChangeNotifierProvider( - create: (_) => - MyReferredPatientProvider(), - child: MyReferredPatient(), - ), + MyReferredPatient(), ), ); }, diff --git a/lib/screens/doctor/my_referred_patient_screen.dart b/lib/screens/doctor/my_referred_patient_screen.dart index ec91b4c3..5fd18cd0 100644 --- a/lib/screens/doctor/my_referred_patient_screen.dart +++ b/lib/screens/doctor/my_referred_patient_screen.dart @@ -1,42 +1,33 @@ -import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/referred_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/doctor/my_referred_patient_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; class MyReferredPatient extends StatelessWidget { - MyReferredPatientProvider referredPatientProvider; @override Widget build(BuildContext context) { - referredPatientProvider = Provider.of(context); - return AppScaffold( + return BaseView( + onModelReady: (model) => model.getMyReferredPatient(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, appBarTitle: TranslationBase.of(context).myReferredPatient, - body: referredPatientProvider.isLoading - ? DrAppCircularProgressIndeicator() - : referredPatientProvider.isError - ? Center( - child: AppText( - referredPatientProvider.error, - color: Theme.of(context).errorColor, - ), - ) - : referredPatientProvider.listMyReferredPatientModel.length == 0 - ? Center( - child: AppText( - TranslationBase.of(context).errorNoSchedule, - color: Theme.of(context).errorColor, - ), - ) - : Container( - padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), - child: ListView( - children: [ - Column( + body: model.listMyReferredPatientModel.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).errorNoSchedule, + color: Theme.of(context).errorColor, + ), + ) + : Container( + padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), + child: ListView( + children: [ + Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( @@ -45,11 +36,12 @@ class MyReferredPatient extends StatelessWidget { Container( child: Column( //children: referredPatientProvider.listMyReferralPatientModel.map((item) { - children: referredPatientProvider + children: model .listMyReferredPatientModel .map((item) { return MyReferredPatientWidget( myReferredPatientModel: item, + model:model ); }).toList(), ), @@ -59,6 +51,6 @@ class MyReferredPatient extends StatelessWidget { ], ), ), - ); + )); } } diff --git a/lib/widgets/doctor/my_referred_patient_widget.dart b/lib/widgets/doctor/my_referred_patient_widget.dart index c4ad4f29..d9adaf3b 100644 --- a/lib/widgets/doctor/my_referred_patient_widget.dart +++ b/lib/widgets/doctor/my_referred_patient_widget.dart @@ -1,27 +1,22 @@ -import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/referred_view_model.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:flutter/material.dart'; - -import 'package:doctor_app_flutter/config/size_config.dart'; - -import 'package:doctor_app_flutter/providers/referred_patient_provider.dart'; - import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/cupertino.dart'; - -import 'package:provider/provider.dart'; +import 'package:flutter/material.dart'; class MyReferredPatientWidget extends StatefulWidget { final MyReferredPatientModel myReferredPatientModel; + final ReferredPatientViewModel model; - MyReferredPatientWidget({Key key, this.myReferredPatientModel}); + MyReferredPatientWidget({Key key, this.myReferredPatientModel, this.model}); @override _MyReferredPatientWidgetState createState() => @@ -293,23 +288,17 @@ class _MyReferredPatientWidgetState extends State { child: Button( onTap: () async { try { - setState(() { - _isLoading = true; - }); - await Provider.of(context, listen: false).verify(widget.myReferredPatientModel); - setState(() { - _isLoading = false; - }); + + await widget.model.verify(widget.myReferredPatientModel); + DrAppToastMsg.showSuccesToast('Verify Successfully'); } catch (e) { - setState(() { - _isLoading = false; - }); + DrAppToastMsg.showErrorToast(e); } }, title: TranslationBase.of(context).verify, - loading: _isLoading, + loading: widget.model.state == ViewState.BusyLocal, ), ) ], From 58de54997ae8369e9d8dc108f3ff5640f05c91d0 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 8 Dec 2020 17:26:10 +0200 Subject: [PATCH 04/14] refactor search medicine Service --- lib/config/localized_values.dart | 6 +- lib/core/service/medicine_service.dart | 50 +++++ lib/core/viewModel/medicine_view_model.dart | 38 ++++ lib/locator.dart | 4 + lib/main.dart | 4 +- lib/providers/medicine_provider.dart | 78 -------- lib/screens/dashboard_screen.dart | 6 +- .../doctor/my_referred_patient_screen.dart | 4 +- .../medicine/medicine_search_screen.dart | 180 +++++++++--------- .../medicine/pharmacies_list_screen.dart | 94 +++++---- 10 files changed, 233 insertions(+), 231 deletions(-) create mode 100644 lib/core/service/medicine_service.dart create mode 100644 lib/core/viewModel/medicine_view_model.dart delete mode 100644 lib/providers/medicine_provider.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f9022bd3..037e9622 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -223,10 +223,10 @@ const Map> localizedValues = { 'endcall': {'en': 'End Call', 'ar': 'إنهاء المكالمة'}, 'transfertoadmin': {'en': 'Transfer to admin', 'ar': 'نقل إلى المسؤول'}, "searchMedicineImageCaption": { - 'en': 'Type or speak the medicine name to search', - 'ar': ' اكتب أو انطق اسم الدواء للبحث' + 'en': 'Type the medicine name to search', + 'ar': ' اكتب اسم الدواء للبحث' }, - "type": {'en': 'Type or Speak', 'ar': 'اكتب أو تحدث '}, + "type": {'en': 'Type ', 'ar': 'اكتب'}, "fromDate": {'en': 'From Date', 'ar': 'من تاريخ'}, "toDate": {'en': 'To Date', 'ar': 'الى تاريخ'}, "searchPatientImageCaptionTitle": { diff --git a/lib/core/service/medicine_service.dart b/lib/core/service/medicine_service.dart new file mode 100644 index 00000000..5eeb1ce6 --- /dev/null +++ b/lib/core/service/medicine_service.dart @@ -0,0 +1,50 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/doctor/request_schedule.dart'; +import 'package:doctor_app_flutter/models/pharmacies/pharmacies_List_request_model.dart'; +import 'package:doctor_app_flutter/models/pharmacies/pharmacies_items_request_model.dart'; + +class MedicineService extends BaseService { + var _pharmacyItemsList = []; + var _pharmaciesList = []; + get pharmacyItemsList => _pharmacyItemsList; + get pharmaciesList => _pharmaciesList; + + PharmaciesItemsRequestModel _itemsRequestModel = + PharmaciesItemsRequestModel(); + PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); + + RequestSchedule _requestSchedule = RequestSchedule(); + + Future getMedicineItem(String itemName) async { + _itemsRequestModel.pHRItemName = itemName; + await baseAppClient.post( + PHARMACY_ITEMS_URL, + onSuccess: (dynamic response, int statusCode) { + _pharmacyItemsList.clear(); + _pharmacyItemsList = response['ListPharmcy_Region_enh']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _itemsRequestModel.toJson(), + ); + } + + Future getPharmaciesList(int itemId) async { + _listRequestModel.itemID = itemId; + await baseAppClient.post( + PHARMACY_LIST_URL, + onSuccess: (dynamic response, int statusCode) { + _pharmaciesList.clear(); + _pharmaciesList = response['PharmList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _listRequestModel.toJson(), + ); + } +} diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart new file mode 100644 index 00000000..72f4d0ab --- /dev/null +++ b/lib/core/viewModel/medicine_view_model.dart @@ -0,0 +1,38 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/hospitals_model.dart'; +import 'package:doctor_app_flutter/core/service/doctor_reply_service.dart'; +import 'package:doctor_app_flutter/core/service/hospital/hospitals_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; +import 'package:doctor_app_flutter/core/service/schedule_service.dart'; +import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class MedicineViewModel extends BaseViewModel { + MedicineService _medicineService = locator(); + get pharmacyItemsList => _medicineService.pharmacyItemsList; + get pharmaciesList => _medicineService.pharmaciesList; + + + Future getMedicineItem(String itemName) async { + setState(ViewState.Busy); + await _medicineService.getMedicineItem(itemName); + if (_medicineService.hasError) { + error = _medicineService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPharmaciesList(int itemId) async { + setState(ViewState.Busy); + await _medicineService.getPharmaciesList(itemId); + if (_medicineService.hasError) { + error = _medicineService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 47fce510..f9ba83be 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -2,11 +2,13 @@ import 'package:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/hospital/hospitals_service.dart'; +import 'core/service/medicine_service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/hospital_view_model.dart'; +import 'core/viewModel/medicine_view_model.dart'; import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; @@ -21,6 +23,7 @@ void setupLocator() { locator.registerLazySingleton(() => ScheduleService()); locator.registerLazySingleton(() => ReferralPatientService()); locator.registerLazySingleton(() => ReferredPatientService()); + locator.registerLazySingleton(() => MedicineService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -28,4 +31,5 @@ void setupLocator() { locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ReferralPatientViewModel()); locator.registerFactory(() => ReferredPatientViewModel()); + locator.registerFactory(() => MedicineViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index 3b32e732..4628a5f8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,4 @@ import 'package:doctor_app_flutter/providers/livecare_provider.dart'; -import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; @@ -9,8 +8,8 @@ import 'package:provider/provider.dart'; import './config/size_config.dart'; import './providers/auth_provider.dart'; -import './providers/patients_provider.dart'; import './providers/hospital_provider.dart'; +import './providers/patients_provider.dart'; import './routes.dart'; import 'config/config.dart'; import 'locator.dart'; @@ -43,7 +42,6 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider( create: (context) => LiveCareProvider(), ), - ChangeNotifierProvider(create: (context) => MedicineProvider(),), ], child: Consumer( builder: (context,projectProvider,child) => MaterialApp( diff --git a/lib/providers/medicine_provider.dart b/lib/providers/medicine_provider.dart deleted file mode 100644 index 99674f18..00000000 --- a/lib/providers/medicine_provider.dart +++ /dev/null @@ -1,78 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/models/pharmacies/pharmacies_List_request_model.dart'; -import 'package:doctor_app_flutter/models/pharmacies/pharmacies_items_request_model.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; -import 'package:flutter/cupertino.dart'; - -class MedicineProvider with ChangeNotifier { - DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - - var pharmacyItemsList = []; - var pharmaciesList = []; - bool isFinished = true; - bool hasError = false; - String errorMsg = ''; - BaseAppClient baseAppClient = BaseAppClient(); - - PharmaciesItemsRequestModel _itemsRequestModel = - PharmaciesItemsRequestModel(); - PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); - - clearPharmacyItemsList() { - pharmacyItemsList.clear(); - notifyListeners(); - } - - getMedicineItem(String itemName) async { - _itemsRequestModel.pHRItemName = itemName; - resetDefaultValues(); - pharmacyItemsList.clear(); - notifyListeners(); - try { - await baseAppClient.post(PHARMACY_ITEMS_URL, - onSuccess: (dynamic response, int statusCode) { - pharmacyItemsList = response['ListPharmcy_Region_enh']; - hasError = false; - isFinished = true; - errorMsg = "Done"; - }, onFailure: (String error, int statusCode) { - isFinished = true; - hasError = true; - errorMsg = error; - }, body: _itemsRequestModel.toJson()); - notifyListeners(); - } catch (error) { - throw error; - } - } - - getPharmaciesList(int itemId) async { - resetDefaultValues(); - try { - _listRequestModel.itemID = itemId; - isFinished = false; - await baseAppClient.post(PHARMACY_LIST_URL, - onSuccess: (dynamic response, int statusCode) { - pharmaciesList = response['PharmList']; - hasError = false; - isFinished = true; - errorMsg = "Done"; - }, onFailure: (String error, int statusCode) { - isFinished = true; - hasError = true; - errorMsg = error; - }, body: _listRequestModel.toJson()); - notifyListeners(); - } catch (error) { - throw error; - } - } - - resetDefaultValues() { - isFinished = false; - hasError = false; - errorMsg = ''; - notifyListeners(); - } -} diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index bb1f8252..32de96a7 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -6,7 +6,6 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/providers/auth_provider.dart'; import 'package:doctor_app_flutter/providers/hospital_provider.dart'; -import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -744,10 +743,7 @@ class _DashboardScreenState extends State { context, MaterialPageRoute( builder: (context) => - ChangeNotifierProvider( - create: (_) => MedicineProvider(), - child: MedicineSearchScreen(), - ), + MedicineSearchScreen(), ), ); }, diff --git a/lib/screens/doctor/my_referred_patient_screen.dart b/lib/screens/doctor/my_referred_patient_screen.dart index 5fd18cd0..cd9112e2 100644 --- a/lib/screens/doctor/my_referred_patient_screen.dart +++ b/lib/screens/doctor/my_referred_patient_screen.dart @@ -13,8 +13,8 @@ class MyReferredPatient extends StatelessWidget { Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getMyReferredPatient(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, appBarTitle: TranslationBase.of(context).myReferredPatient, body: model.listMyReferredPatientModel.length == 0 ? Center( diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 764c1b34..3a2ff96c 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -2,8 +2,9 @@ import 'dart:math'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/providers/medicine_provider.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -14,10 +15,9 @@ import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_recognition_result.dart'; import 'package:speech_to_text/speech_to_text.dart'; @@ -40,7 +40,6 @@ class _MedicineSearchState extends State { final myController = TextEditingController(); Helpers helpers = new Helpers(); bool _hasSpeech = false; - MedicineProvider _medicineProvider; String _currentLocaleId = ""; bool _isInit = true; final SpeechToText speech = SpeechToText(); @@ -57,12 +56,6 @@ class _MedicineSearchState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - if (_isInit) { - _medicineProvider = Provider.of(context); - // requestPermissions(); - // initSpeechState(); - } - _isInit = false; } void requestPermissions() async { @@ -92,7 +85,8 @@ class _MedicineSearchState extends State { @override Widget build(BuildContext context) { - return AppScaffold( + return BaseView( + builder: (_, model, w) => AppScaffold( appBarTitle: TranslationBase.of(context).searchMedicine, body: FractionallySizedBox( widthFactor: 0.97, @@ -140,7 +134,7 @@ class _MedicineSearchState extends State { controller: myController, onSaved: (value) {}, onFieldSubmitted: (value) { - searchMedicine(context); + searchMedicine(context, model); }, textInputAction: TextInputAction.search, // TODO return it back when it needed @@ -165,109 +159,115 @@ class _MedicineSearchState extends State { child: Wrap( alignment: WrapAlignment.center, children: [ + // TODO change it secondary button and add loading AppButton( title: TranslationBase.of(context).search, onPressed: () { - searchMedicine(context); + searchMedicine(context, model); }, ), ], ), ), - Container( - margin: EdgeInsets.only( - left: SizeConfig.heightMultiplier * 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).youCanFind + - _medicineProvider.pharmacyItemsList.length - .toString() + - " " + - TranslationBase.of(context).itemsInSearch, - fontWeight: FontWeight.bold, - ), - ], - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.35, - child: Container( - child: !_medicineProvider.isFinished - ? DrAppCircularProgressIndeicator() - : _medicineProvider.hasError - ? Center( - child: Text( - _medicineProvider.errorMsg, - style: TextStyle( - color: - Theme.of(context).errorColor), - ), - ) - : ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: - _medicineProvider.pharmacyItemsList == - null - ? 0 - : _medicineProvider - .pharmacyItemsList.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: MedicineItemWidget( - label: _medicineProvider - .pharmacyItemsList[index] - ["ItemDescription"], - url: _medicineProvider - .pharmacyItemsList[index] - ["ImageSRCUrl"], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - PharmaciesListScreen( - itemID: _medicineProvider + + NetworkBaseView( + baseViewModel: model, + child: Column( + children: [ + Container( + margin: EdgeInsets.only( + left: SizeConfig.heightMultiplier * 2), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase + .of(context) + .youCanFind + + model.pharmacyItemsList.length + .toString() + + " " + + TranslationBase + .of(context) + .itemsInSearch, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + Container( + height: MediaQuery + .of(context) + .size + .height * 0.35, + child: Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: + model.pharmacyItemsList == + null + ? 0 + : model + .pharmacyItemsList.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: MedicineItemWidget( + label: model + .pharmacyItemsList[index] + ["ItemDescription"], + url: model + .pharmacyItemsList[index] + ["ImageSRCUrl"], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PharmaciesListScreen( + itemID: model .pharmacyItemsList[ index]["ItemID"], - url: _medicineProvider + url: model .pharmacyItemsList[ index]["ImageSRCUrl"]), - ), + ), + ); + }, ); - }, - ); - }, - ), - ), - ), + }, + ), + ), + ), + ], + )), ], ), ), - ], - ), - ), - )); + ], + ), + ), + ),),); } - searchMedicine(context) { + searchMedicine(context, MedicineViewModel model) { FocusScope.of(context).unfocus(); if (myController.text.isNullOrEmpty()) { - _medicineProvider.clearPharmacyItemsList(); - helpers.showErrorToast(TranslationBase.of(context).typeMedicineName) ; + helpers.showErrorToast(TranslationBase + .of(context) + .typeMedicineName); //"Type Medicine Name") return; } if (myController.text.length < 3) { - _medicineProvider.clearPharmacyItemsList(); - helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); + helpers.showErrorToast(TranslationBase + .of(context) + .moreThan3Letter); return; } - _medicineProvider.getMedicineItem(myController.text); + model.getMedicineItem(myController.text); } startVoiceSearch() { @@ -292,7 +292,7 @@ class _MedicineSearchState extends State { lastStatus = ''; myController.text = reconizedWord; Future.delayed(const Duration(seconds: 2), () { - searchMedicine(context); + // searchMedicine(context); }); }); } diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index dd0a3649..d55916b2 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -2,14 +2,14 @@ import 'dart:convert'; import 'dart:typed_data'; import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/providers/medicine_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; @@ -34,7 +34,6 @@ class PharmaciesListScreen extends StatefulWidget { class _PharmaciesListState extends State { var _data; Helpers helpers = new Helpers(); - MedicineProvider _medicineProvider; ProjectProvider projectsProvider; bool _isInit = true; @@ -43,47 +42,38 @@ class _PharmaciesListState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - if (_isInit) { - _medicineProvider = Provider.of(context); - pharmaciesList(); - } _isInit = false; } @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - return AppScaffold( + return BaseView( + onModelReady: (model) => model.getPharmaciesList(widget.itemID), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, appBarTitle: TranslationBase.of(context).pharmaciesList, - body: !_medicineProvider.isFinished - ? DrAppCircularProgressIndeicator() - : _medicineProvider.hasError - ? Center( - child: Text( - _medicineProvider.errorMsg, - style: TextStyle( - color: Theme.of(context).errorColor), - ), - ) - :Container( + body: Container( height: SizeConfig.screenHeight, child: ListView( shrinkWrap: true, scrollDirection: Axis.vertical, physics: const AlwaysScrollableScrollPhysics(), children: [ - _medicineProvider.pharmaciesList.length >0 ?RoundedContainer( - child: Row( - children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: BorderRadius.all( - Radius.circular(7)), - child: widget.url != null ?Image.network( - widget.url, - height: - SizeConfig.imageSizeMultiplier * + model.pharmaciesList.length > 0 + ? RoundedContainer( + child: Row( + children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(7)), + child: widget.url != null + ? Image.network( + widget.url, + height: + SizeConfig.imageSizeMultiplier * 21, width: SizeConfig.imageSizeMultiplier * @@ -110,7 +100,7 @@ class _PharmaciesListState extends State { fontWeight: FontWeight.bold, ), AppText( - _medicineProvider.pharmaciesList[0]["ItemDescription"], + model.pharmaciesList[0]["ItemDescription"], marginLeft: 10, marginTop: 0, marginRight: 10, @@ -125,7 +115,7 @@ class _PharmaciesListState extends State { fontWeight: FontWeight.bold, ), AppText( - _medicineProvider.pharmaciesList[0]["SellingPrice"] + model.pharmaciesList[0]["SellingPrice"] .toString(), marginLeft: 10, marginTop: 0, @@ -161,7 +151,8 @@ class _PharmaciesListState extends State { child: ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - itemCount: _medicineProvider.pharmaciesList == null ? 0 : _medicineProvider.pharmaciesList.length, + itemCount: model.pharmaciesList == null ? 0 : model + .pharmaciesList.length, itemBuilder: (BuildContext context, int index) { return RoundedContainer( child: Row( @@ -170,13 +161,14 @@ class _PharmaciesListState extends State { flex: 1, child: ClipRRect( borderRadius: - BorderRadius.all(Radius.circular(7)), + BorderRadius.all(Radius.circular(7)), child: Image.network( - _medicineProvider.pharmaciesList[index]["ProjectImageURL"], + model + .pharmaciesList[index]["ProjectImageURL"], height: - SizeConfig.imageSizeMultiplier * 15, + SizeConfig.imageSizeMultiplier * 15, width: - SizeConfig.imageSizeMultiplier * 15, + SizeConfig.imageSizeMultiplier * 15, fit: BoxFit.cover, ), ), @@ -184,7 +176,8 @@ class _PharmaciesListState extends State { Expanded( flex: 4, child: AppText( - _medicineProvider.pharmaciesList[index]["LocationDescription"], + model + .pharmaciesList[index]["LocationDescription"], margin: 10, ), ), @@ -202,8 +195,10 @@ class _PharmaciesListState extends State { Icons.call, color: Colors.red, ), - onTap: () => launch("tel://" + - _medicineProvider.pharmaciesList[index]["PhoneNumber"]), + onTap: () => + launch("tel://" + + model + .pharmaciesList[index]["PhoneNumber"]), ), ), Padding( @@ -216,11 +211,13 @@ class _PharmaciesListState extends State { onTap: () { MapsLauncher.launchCoordinates( double.parse( - _medicineProvider.pharmaciesList[index]["Latitude"]), + model + .pharmaciesList[index]["Latitude"]), double.parse( - _medicineProvider.pharmaciesList[index]["Longitude"]), - _medicineProvider.pharmaciesList[index] - ["LocationDescription"]); + model + .pharmaciesList[index]["Longitude"]), + model.pharmaciesList[index] + ["LocationDescription"]); }, ), ), @@ -233,13 +230,10 @@ class _PharmaciesListState extends State { }), ), ) - ]), - )); + ]), + ),),); } - pharmaciesList() async { - _medicineProvider.getPharmaciesList(widget.itemID); - } Image imageFromBase64String(String base64String) { return Image.memory(base64Decode(base64String)); From b9bf315199fbcc976c0cd86810ac6cce5ccfbe54 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 8 Dec 2020 17:26:46 +0200 Subject: [PATCH 05/14] fast fix --- lib/core/service/medicine_service.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/core/service/medicine_service.dart b/lib/core/service/medicine_service.dart index 5eeb1ce6..df23172f 100644 --- a/lib/core/service/medicine_service.dart +++ b/lib/core/service/medicine_service.dart @@ -14,7 +14,6 @@ class MedicineService extends BaseService { PharmaciesItemsRequestModel(); PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel(); - RequestSchedule _requestSchedule = RequestSchedule(); Future getMedicineItem(String itemName) async { _itemsRequestModel.pHRItemName = itemName; From 6bbc629060c64c119eab1dd3dd924f9048226c65 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 8 Dec 2020 17:40:20 +0200 Subject: [PATCH 06/14] patients out and patients in screens design updates --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 9 +- lib/screens/patients/patients_screen.dart | 181 ++++++++++------------ lib/util/translations_delegate_base.dart | 14 +- 4 files changed, 94 insertions(+), 114 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 6549ada5..8af0a4a5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -100,8 +100,8 @@ var SERVICES_PATIANT2 = [ "List_MyReferralPatient" ]; var SERVICES_PATIANT_HEADER = [ - "OutPatient", - "InPatient", + "Search Out-Patient", + "Search In-Patient", "Discharge", "Referred", "Referral Discharge", diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f9022bd3..78e85967 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -6,7 +6,6 @@ const Map> localizedValues = { 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, 'theDoctor': {'en': 'Doctor', 'ar': 'الطبيب'}, 'reply': {'en': 'Reply', 'ar': 'رد'}, - 'time': {'en': 'Time', 'ar': 'الوقت'}, 'fileNo': {'en': 'File No:', 'ar': 'رقم الملف:'}, 'mobileNo': {'en': 'Mobile No', 'ar': 'رقم الموبايل'}, @@ -242,11 +241,11 @@ const Map> localizedValues = { 'en': 'You don\'t have any Items', 'ar': 'لا يوجد اي نتائج' }, - 'typeMedicineName': { - 'en': 'Type Medicine Name', - 'ar': 'اكتب اسم الدواء' - },'moreThan3Letter': { + 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, + 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' }, + 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, + 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, }; diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index a4766f0a..6ffc1f49 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -323,6 +323,8 @@ class _PatientsScreenState extends State { Container( child: lItems == null ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Container( child: Center( @@ -349,7 +351,7 @@ class _PatientsScreenState extends State { ? _locationBar(context) : Container(), ), - SizedBox(height: 10.0), + SizedBox(height: 18.5), Container( width: SizeConfig.screenWidth * 0.9, height: SizeConfig.screenHeight * 0.05, @@ -361,23 +363,22 @@ class _PatientsScreenState extends State { decoration: buildInputDecoration( context, TranslationBase.of(context) - .search), + .searchPatient), ), ), SizedBox( height: 10.0, ), Divider( - thickness: 1, - color: Colors.grey, + thickness: 0.5, + color: Color(0xffCCCCCC), ), Container( decoration: BoxDecoration( color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), - margin: - EdgeInsets.fromLTRB(15, 0, 15, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), child: (responseModelList.length > 0) ? Column( // mainAxisAlignment: MainAxisAlignment.center, @@ -394,22 +395,15 @@ class _PatientsScreenState extends State { MainAxisAlignment .start, children: [ - Container( + Padding( + padding: EdgeInsets + .only( + left: + 12.0), + child: + Container( decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment( - -1, - -1), - end: Alignment( - 1, - 1), - colors: [ - Colors - .grey[100], - Colors - .grey[200], - ]), boxShadow: [ BoxShadow( color: Color.fromRGBO( @@ -425,7 +419,9 @@ class _PatientsScreenState extends State { ], borderRadius: BorderRadius.all( - Radius.circular(50.0)), + Radius.circular(35.0)), + color: Color( + 0xffCCCCCC), ), width: 70, height: 70, @@ -436,8 +432,12 @@ class _PatientsScreenState extends State { .male : DoctorApp .female_icon, - size: 80, - )), + size: 70, + color: Colors + .white, + ), + ), + ), ], ), @@ -447,13 +447,22 @@ class _PatientsScreenState extends State { Expanded( child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ Column( children: [ + SizedBox( + height: + 10.0, + ), Padding( - padding: EdgeInsets - .only( - top: 10.5), + padding: EdgeInsets.symmetric( + vertical: + 5.5, + horizontal: + 22.5), child: AppText( item.firstName + @@ -466,8 +475,6 @@ class _PatientsScreenState extends State { FontWeight.bold, backGroundcolor: Colors.white, - textAlign: - TextAlign.left, ), ), ], @@ -475,7 +482,7 @@ class _PatientsScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment - .spaceEvenly, + .spaceAround, children: [ Column( crossAxisAlignment: @@ -483,18 +490,6 @@ class _PatientsScreenState extends State { .start, children: < Widget>[ - SizedBox( - height: - 15, - ), - SizedBox( - height: - 0, - ), - SizedBox( - height: - 3.5, - ), Wrap( children: [ AppText( @@ -534,21 +529,6 @@ class _PatientsScreenState extends State { ? Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: Hexcolor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), SizedBox( width: 3.5, ), @@ -560,12 +540,12 @@ class _PatientsScreenState extends State { ), ), SizedBox( - height: 25.5, + height: 0.5, ) ], ) : SizedBox( - height: 15, + height: 5, ), ], ), @@ -580,7 +560,7 @@ class _PatientsScreenState extends State { Widget>[ SizedBox( height: - 20.5, + 0.5, ), SizedBox( height: @@ -589,7 +569,7 @@ class _PatientsScreenState extends State { Wrap( children: [ AppText( - TranslationBase.of(context).age, + TranslationBase.of(context).age2, fontSize: 1.8 * SizeConfig.textMultiplier, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, @@ -609,7 +589,7 @@ class _PatientsScreenState extends State { Wrap( children: [ AppText( - TranslationBase.of(context).gender, + TranslationBase.of(context).gender2, fontSize: 1.8 * SizeConfig.textMultiplier, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, @@ -631,21 +611,6 @@ class _PatientsScreenState extends State { ? Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: Hexcolor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), SizedBox( width: 3.5, ), @@ -722,10 +687,15 @@ class _PatientsScreenState extends State { Widget _locationBar(BuildContext _context) { return Expanded( child: Container( - height: MediaQuery.of(context).size.height * 0.065, - width: SizeConfig.screenWidth * 0.95, + height: MediaQuery.of(context).size.height * 0.0619, + width: SizeConfig.screenWidth * 0.94, decoration: BoxDecoration( - color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), + color: Color(0Xffffffff), + borderRadius: BorderRadius.circular(12.5), + border: Border.all( + width: 0.5, + ), + ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisSize: MainAxisSize.max, @@ -735,26 +705,33 @@ class _PatientsScreenState extends State { return Column(mainAxisSize: MainAxisSize.min, children: [ InkWell( child: Center( - child: Container( - height: 40, - width: 90, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3.0), - color: _isActive ? Hexcolor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - - fontWeight: FontWeight.bold, - ), + child: Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 0.058, + width: SizeConfig.screenWidth * 0.2334, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(12.5), + topRight: Radius.circular(12.5), + topLeft: Radius.circular(9.5), + bottomLeft: Radius.circular(9.5)), + color: + _isActive ? Hexcolor("#B8382B") : Colors.white, ), - )), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + + fontWeight: FontWeight.normal, + ), + ), + )), + ), ), onTap: () { print(_locations.indexOf(item)); @@ -768,11 +745,13 @@ class _PatientsScreenState extends State { _isActive ? Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10), + topRight: Radius.circular(10)), color: Colors.white), alignment: Alignment.center, - height: 3, - width: 90, + height: 1, + width: SizeConfig.screenWidth * 0.23, ) : Container() ]); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7351ed01..1ea3be74 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -57,10 +57,8 @@ class TranslationBase { String get outPatients => localizedValues['outPatients'][locale.languageCode]; String get searchPatient => localizedValues['searchPatient'][locale.languageCode]; - String get searchAbout => - localizedValues['searchAbout'][locale.languageCode]; - String get patient => - localizedValues['patient'][locale.languageCode]; + String get searchAbout => localizedValues['searchAbout'][locale.languageCode]; + String get patient => localizedValues['patient'][locale.languageCode]; String get labResult => localizedValues['labResult'][locale.languageCode]; String get todayStatistics => localizedValues['todayStatistics'][locale.languageCode]; @@ -271,8 +269,12 @@ class TranslationBase { localizedValues['searchPatientImageCaptionBody'][locale.languageCode]; String get welcome => localizedValues['welcome'][locale.languageCode]; - String get typeMedicineName => localizedValues['typeMedicineName'][locale.languageCode]; - String get moreThan3Letter => localizedValues['moreThan3Letter'][locale.languageCode]; + String get typeMedicineName => + localizedValues['typeMedicineName'][locale.languageCode]; + String get moreThan3Letter => + localizedValues['moreThan3Letter'][locale.languageCode]; + String get gender2 => localizedValues['gender2'][locale.languageCode]; + String get age2 => localizedValues['age2'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 5ed9aea5a71b4674b9b73c396301b6e9a1b34b94 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 9 Dec 2020 08:53:10 +0200 Subject: [PATCH 07/14] fix HexColor library error --- lib/landing_page.dart | 2 +- lib/main.dart | 2 +- lib/screens/dashboard_screen.dart | 34 +++++++++---------- .../patients/patient_search_screen.dart | 20 +++++------ lib/screens/patients/patients_screen.dart | 8 ++--- .../profile/insurance_approvals_screen.dart | 2 +- .../profile/patient_orders_screen.dart | 2 +- .../profile/progress_note_screen.dart | 2 +- .../profile/refer_patient_screen.dart | 2 +- .../profile/vital_sign/vital_sign_item.dart | 4 +-- lib/screens/settings/settings_screen.dart | 4 +-- lib/widgets/auth/auth_header.dart | 6 ++-- lib/widgets/auth/change_password.dart | 8 ++--- lib/widgets/auth/known_user_login.dart | 10 +++--- lib/widgets/auth/login_form.dart | 4 +-- lib/widgets/auth/show_timer_text.dart | 2 +- lib/widgets/auth/verfiy_account.dart | 2 +- lib/widgets/auth/verification_methods.dart | 2 +- lib/widgets/doctor/doctor_reply_widget.dart | 2 +- lib/widgets/doctor/lab_result_widget.dart | 6 ++-- .../profile_general_info_content_widget.dart | 4 +-- .../profile/profile_header_widget.dart | 2 +- .../profile/profile_medical_info_widget.dart | 2 +- .../profile/profile_status_info_widget.dart | 4 +-- .../patients/vital_sign_details_wideget.dart | 4 +-- lib/widgets/shared/Text.dart | 2 +- lib/widgets/shared/app_button.dart | 4 +-- lib/widgets/shared/app_buttons_widget.dart | 2 +- lib/widgets/shared/app_scaffold_widget.dart | 2 +- lib/widgets/shared/app_text_form_field.dart | 4 +-- .../shared/card_with_bgNew_widget.dart | 2 +- lib/widgets/shared/card_with_bg_widget.dart | 6 ++-- 32 files changed, 81 insertions(+), 81 deletions(-) diff --git a/lib/landing_page.dart b/lib/landing_page.dart index c79d29d9..f67957d3 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -39,7 +39,7 @@ class _LandingPageState extends State { return Scaffold( appBar: AppBar( elevation: 0, - backgroundColor: Hexcolor('#515B5D'), + backgroundColor: HexColor('#515B5D'), textTheme: TextTheme( headline6: TextStyle(color: Colors.white)), diff --git a/lib/main.dart b/lib/main.dart index 3b32e732..31715b8a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -62,7 +62,7 @@ class MyApp extends StatelessWidget { theme: ThemeData( primarySwatch: Colors.grey, primaryColor: Colors.grey, - buttonColor: Hexcolor('#B8382C'), + buttonColor: HexColor('#B8382C'), fontFamily: 'WorkSans', dividerColor: Colors.grey[350], backgroundColor: Color.fromRGBO(255,255,255, 1) diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 6b2bd275..b1224ee6 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -84,7 +84,7 @@ class _DashboardScreenState extends State { children: [ Container( height: 140, - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), width: double.infinity, child: FractionallySizedBox( widthFactor: 0.9, @@ -223,7 +223,7 @@ class _DashboardScreenState extends State { bottom: 19, child: Container( decoration: BoxDecoration( - color: Hexcolor("#DED8CF"), + color: HexColor("#DED8CF"), borderRadius: BorderRadius.all( Radius.circular(10.0), ), @@ -251,20 +251,20 @@ class _DashboardScreenState extends State { AppText("38", fontSize: SizeConfig.textMultiplier * 3.7, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), fontWeight: FontWeight.bold,), AppText(TranslationBase .of(context) .outPatients, fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 1.4, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), ), ], ), circularStrokeCap: CircularStrokeCap.butt, backgroundColor: Colors.blueGrey[100], - progressColor: Hexcolor('#B8382C'), + progressColor: HexColor('#B8382C'), ), ), Container( @@ -278,7 +278,7 @@ class _DashboardScreenState extends State { border: TableBorder.symmetric( inside: BorderSide( width: 0.5, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), ), ), children: [ @@ -292,13 +292,13 @@ class _DashboardScreenState extends State { TranslationBase.of(context).arrived, fontSize: SizeConfig.textMultiplier * 1.5, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), ), AppText( "23", fontSize: SizeConfig.textMultiplier * 2.7, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), fontWeight: FontWeight.bold, ), SizedBox( @@ -314,13 +314,13 @@ class _DashboardScreenState extends State { TranslationBase.of(context).er, fontSize: SizeConfig.textMultiplier * 1.5, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), ), AppText( "03", fontSize: SizeConfig.textMultiplier * 2.7, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), fontWeight: FontWeight.bold, ), SizedBox( @@ -343,13 +343,13 @@ class _DashboardScreenState extends State { TranslationBase.of(context).notArrived, fontSize: SizeConfig.textMultiplier * 1.5, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), ), AppText( "15", fontSize: SizeConfig.textMultiplier * 2.7, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), fontWeight: FontWeight.bold, ), ], @@ -365,13 +365,13 @@ class _DashboardScreenState extends State { TranslationBase.of(context).walkIn, fontSize: SizeConfig.textMultiplier * 1.5, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), ), AppText( "04", fontSize: SizeConfig.textMultiplier * 2.7, - color: Hexcolor('#5D4C35'), + color: HexColor('#5D4C35'), fontWeight: FontWeight.bold, ), ], @@ -555,7 +555,7 @@ class _DashboardScreenState extends State { ), ), imageName: '4.png', - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), hasBorder: false, width: MediaQuery .of(context) @@ -609,7 +609,7 @@ class _DashboardScreenState extends State { ), ), imageName: '5.png', - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), hasBorder: false, width: MediaQuery .of(context) @@ -1020,7 +1020,7 @@ class DashboardItem extends StatelessWidget { .height * 0.35, decoration: BoxDecoration( - color: !hasBorder ? color != null ? color : Hexcolor('#050705') + color: !hasBorder ? color != null ? color : HexColor('#050705') .withOpacity(opacity) : Colors .white, borderRadius: BorderRadius.circular(6.0), diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index ac5cbd84..44420140 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -176,7 +176,7 @@ class _PatientSearchScreenState extends State { side: BorderSide( width: 1.0, style: BorderStyle.solid, - color: Hexcolor("#CCCCCC")), + color: HexColor("#CCCCCC")), borderRadius: BorderRadius.all(Radius.circular(6.0)), ), @@ -255,7 +255,7 @@ class _PatientSearchScreenState extends State { borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC"))), + width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( labelText: @@ -285,7 +285,7 @@ class _PatientSearchScreenState extends State { borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC"))), + width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( labelText: @@ -315,7 +315,7 @@ class _PatientSearchScreenState extends State { borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC"))), + width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( labelText: TranslationBase.of(context).lastName, @@ -340,7 +340,7 @@ class _PatientSearchScreenState extends State { borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC"))), + width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( labelText: @@ -370,7 +370,7 @@ class _PatientSearchScreenState extends State { borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC"))), + width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( labelText: @@ -397,7 +397,7 @@ class _PatientSearchScreenState extends State { borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, color: Hexcolor("#CCCCCC"))), + width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5), child: AppTextFormField( labelText: @@ -423,7 +423,7 @@ class _PatientSearchScreenState extends State { side: BorderSide( width: 1.0, style: BorderStyle.solid, - color: Hexcolor("#CCCCCC")), + color: HexColor("#CCCCCC")), borderRadius: BorderRadius.all(Radius.circular(6.0)), ), @@ -505,12 +505,12 @@ class _PatientSearchScreenState extends State { Radius.circular(6.0)), border: Border.all( width: 1.0, - color: Hexcolor("#CCCCCC"))), + color: HexColor("#CCCCCC"))), height: 25, width: 25, child: Checkbox( value: true, - checkColor: Hexcolor("#2A930A"), + checkColor: HexColor("#2A930A"), activeColor: Colors.white, onChanged: (bool newValue) {}), ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index a4766f0a..d112b225 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -539,7 +539,7 @@ class _PatientsScreenState extends State { width: 60, decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), - color: Hexcolor("#20A169"), + color: HexColor("#20A169"), ), child: AppText( item.startTime, @@ -636,7 +636,7 @@ class _PatientsScreenState extends State { width: 60, decoration: BoxDecoration( borderRadius: BorderRadius.circular(25), - color: Hexcolor("#20A169"), + color: HexColor("#20A169"), ), child: AppText( item.startTime, @@ -711,7 +711,7 @@ class _PatientsScreenState extends State { hintStyle: TextStyle(fontSize: 1.66 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), @@ -740,7 +740,7 @@ class _PatientsScreenState extends State { width: 90, decoration: BoxDecoration( borderRadius: BorderRadius.circular(3.0), - color: _isActive ? Hexcolor("#B8382B") : Colors.white, + color: _isActive ? HexColor("#B8382B") : Colors.white, ), child: Center( child: Text( diff --git a/lib/screens/patients/profile/insurance_approvals_screen.dart b/lib/screens/patients/profile/insurance_approvals_screen.dart index 51619dc9..d6786a4b 100644 --- a/lib/screens/patients/profile/insurance_approvals_screen.dart +++ b/lib/screens/patients/profile/insurance_approvals_screen.dart @@ -447,7 +447,7 @@ class _InsuranceApprovalsState extends State { hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), diff --git a/lib/screens/patients/profile/patient_orders_screen.dart b/lib/screens/patients/profile/patient_orders_screen.dart index 05cdbfea..5b30b487 100644 --- a/lib/screens/patients/profile/patient_orders_screen.dart +++ b/lib/screens/patients/profile/patient_orders_screen.dart @@ -174,7 +174,7 @@ class _PatientsOrdersState extends State { hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(50.0)), diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index aba49d7b..25b14874 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -174,7 +174,7 @@ class _ProgressNoteState extends State { hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart index e12a9240..6ab2bbdb 100644 --- a/lib/screens/patients/profile/refer_patient_screen.dart +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -428,7 +428,7 @@ class _ReferPatientState extends State { width: 90, decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), - color: _isActive ? Hexcolor("#B8382B") : Colors.white, + color: _isActive ? HexColor("#B8382B") : Colors.white, ), child: Center( child: Text( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart index d84d8ca0..1e0ce2cf 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart @@ -48,7 +48,7 @@ class VitalSignItem extends StatelessWidget { des, style: TextStyle( fontSize: 1.7 * SizeConfig.textMultiplier, - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), fontWeight: FontWeight.bold), ), ), @@ -71,7 +71,7 @@ class VitalSignItem extends StatelessWidget { new TextSpan( text: ' ${unit}', style: TextStyle( - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), ), ), ], diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index c205f49d..631d639e 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -34,7 +34,7 @@ class SettingsScreen extends StatelessWidget { child: AnimatedContainer( duration: Duration(milliseconds: 350), decoration: BoxDecoration( - color: !projectsProvider.isArabic ? Hexcolor('#58434F') : Colors.transparent, + color: !projectsProvider.isArabic ? HexColor('#58434F') : Colors.transparent, border: Border(right: BorderSide(color: Colors.grey[200], width: 2.0)) ), child: Center(child: AppText(TranslationBase.of(context).lanEnglish, color: !projectsProvider.isArabic ? Colors.white : Colors.grey[500])) @@ -47,7 +47,7 @@ class SettingsScreen extends StatelessWidget { child: AnimatedContainer( duration: Duration(milliseconds: 350), decoration: BoxDecoration( - color: projectsProvider.isArabic ? Hexcolor('#58434F') : Colors.transparent, + color: projectsProvider.isArabic ? HexColor('#58434F') : Colors.transparent, border: Border(right: BorderSide(color: Colors.grey[200], width: 2.0)) ), child: Center(child: AppText(TranslationBase.of(context).lanArabic, color: projectsProvider.isArabic ? Colors.white : Colors.grey[500],)) diff --git a/lib/widgets/auth/auth_header.dart b/lib/widgets/auth/auth_header.dart index fb2cf322..8ab79b5c 100644 --- a/lib/widgets/auth/auth_header.dart +++ b/lib/widgets/auth/auth_header.dart @@ -108,7 +108,7 @@ class AuthHeader extends StatelessWidget { Text( text2, style: TextStyle( - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), fontSize: textFontSize, fontWeight: FontWeight.w800), ) @@ -156,7 +156,7 @@ class AuthHeader extends StatelessWidget { fontSize: SizeConfig.isMobile ? 26 : SizeConfig.realScreenWidth * 0.030, fontWeight: FontWeight.w800, - color: Hexcolor('#B8382C')), + color: HexColor('#B8382C')), ), ); } @@ -172,7 +172,7 @@ class AuthHeader extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w800, fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029, - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), ), ); } diff --git a/lib/widgets/auth/change_password.dart b/lib/widgets/auth/change_password.dart index 020c0472..3eb9b975 100644 --- a/lib/widgets/auth/change_password.dart +++ b/lib/widgets/auth/change_password.dart @@ -30,7 +30,7 @@ class ChangePassword extends StatelessWidget { TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), @@ -69,7 +69,7 @@ class ChangePassword extends StatelessWidget { TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), @@ -98,7 +98,7 @@ class ChangePassword extends StatelessWidget { TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), @@ -137,7 +137,7 @@ class ChangePassword extends StatelessWidget { ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))), + side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), ), SizedBox( height: 10, diff --git a/lib/widgets/auth/known_user_login.dart b/lib/widgets/auth/known_user_login.dart index 317d7e39..a3330285 100644 --- a/lib/widgets/auth/known_user_login.dart +++ b/lib/widgets/auth/known_user_login.dart @@ -97,7 +97,7 @@ class _KnownUserLoginState extends State { Container( decoration: BoxDecoration( border: Border.all( - color: Hexcolor('#CCCCCC'), + color: HexColor('#CCCCCC'), ), borderRadius: BorderRadius.circular(50)), margin: const EdgeInsets.fromLTRB(0, 20.0, 30, 0), @@ -111,7 +111,7 @@ class _KnownUserLoginState extends State { // color: Colors.green, // border color shape: BoxShape.circle, border: - Border.all(color: Hexcolor('#CCCCCC'))), + Border.all(color: HexColor('#CCCCCC'))), child: CircleAvatar( child: Image.asset( 'assets/images/dr_avatar.png', @@ -129,7 +129,7 @@ class _KnownUserLoginState extends State { _loggedUser['List_MemberInformation'][0] ['MemberName'], style: TextStyle( - color: Hexcolor('515A5D'), + color: HexColor('515A5D'), fontSize: 2.5 * SizeConfig.textMultiplier, fontWeight: FontWeight.w800), @@ -137,7 +137,7 @@ class _KnownUserLoginState extends State { Text( 'ENT Spec', style: TextStyle( - color: Hexcolor('515A5D'), + color: HexColor('515A5D'), fontSize: 1.5 * SizeConfig.textMultiplier), ) @@ -203,7 +203,7 @@ class _KnownUserLoginState extends State { ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))), + side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), ), SizedBox( height: 10, diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index b87cc800..dbdb853d 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -159,7 +159,7 @@ class _LoginFormState extends State { padding: const EdgeInsets.all(0.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))), + side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), child: Container( padding: const EdgeInsets.all(10.0), height: 50, @@ -199,7 +199,7 @@ class _LoginFormState extends State { hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + borderSide: BorderSide(color: HexColor('#CCCCCC')), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), diff --git a/lib/widgets/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart index 1b77fd9a..c3f7a142 100644 --- a/lib/widgets/auth/show_timer_text.dart +++ b/lib/widgets/auth/show_timer_text.dart @@ -78,7 +78,7 @@ class _ShowTimerTextState extends State { timerText, style: TextStyle( fontSize: 3.0 * SizeConfig.textMultiplier, - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), fontWeight: FontWeight.bold), ), ), diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 8a43a42f..b4b5e31b 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -227,7 +227,7 @@ class _VerifyAccountState extends State { borderRadius: BorderRadius.circular(10), side: BorderSide( width: 0.5, - color: Hexcolor('#CCCCCC'))), + color: HexColor('#CCCCCC'))), ), buildSizedBox(20), ShowTimerText(model: model), diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 6360c352..22fc5779 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -222,7 +222,7 @@ class _VerificationMethodsState extends State { decoration: BoxDecoration( border: Border.all( width: 1, - color: Hexcolor( + color: HexColor( '#CCCCCC') // <--- border width here ), borderRadius: BorderRadius.all(Radius.circular(10))), diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 51f0e94d..e9126ba3 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -28,7 +28,7 @@ class _DoctorReplyWidgetState extends State { margin: EdgeInsets.symmetric(vertical: 10.0), width: double.infinity, decoration: BoxDecoration( - color: Hexcolor('#FFFFFF'), + color: HexColor('#FFFFFF'), borderRadius: BorderRadius.all( Radius.circular(20.0), ), diff --git a/lib/widgets/doctor/lab_result_widget.dart b/lib/widgets/doctor/lab_result_widget.dart index 3f6facce..8b2ab0c4 100644 --- a/lib/widgets/doctor/lab_result_widget.dart +++ b/lib/widgets/doctor/lab_result_widget.dart @@ -81,7 +81,7 @@ class _LabResultWidgetState extends State { Expanded( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -98,7 +98,7 @@ class _LabResultWidgetState extends State { ), Expanded( child: Container( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), child: Center( child: Texts( TranslationBase.of(context).value, @@ -109,7 +109,7 @@ class _LabResultWidgetState extends State { Expanded( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), diff --git a/lib/widgets/patients/profile/profile_general_info_content_widget.dart b/lib/widgets/patients/profile/profile_general_info_content_widget.dart index 7ef4c8f2..713a98e1 100644 --- a/lib/widgets/patients/profile/profile_general_info_content_widget.dart +++ b/lib/widgets/patients/profile/profile_general_info_content_widget.dart @@ -30,11 +30,11 @@ class ProfileGeneralInfoContentWidget extends StatelessWidget { title, fontSize: SizeConfig.textMultiplier * 3, fontWeight: FontWeight.w700, - color: Hexcolor('#58434F'), + color: HexColor('#58434F'), ), AppText( info, - color: Hexcolor('#707070'), + color: HexColor('#707070'), fontSize: SizeConfig.textMultiplier * 2, ) ], diff --git a/lib/widgets/patients/profile/profile_header_widget.dart b/lib/widgets/patients/profile/profile_header_widget.dart index 1a5aec8a..df958106 100644 --- a/lib/widgets/patients/profile/profile_header_widget.dart +++ b/lib/widgets/patients/profile/profile_header_widget.dart @@ -33,7 +33,7 @@ class ProfileHeaderWidget extends StatelessWidget { des: patient.patientId.toString(), height: SizeConfig.heightMultiplier * 17, width: SizeConfig.heightMultiplier * 17, - color: Hexcolor('#58434F')), + color: HexColor('#58434F')), ); } } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 679d266d..092edb02 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -114,7 +114,7 @@ class CircleAvatarWidget extends StatelessWidget { decoration: new BoxDecoration( // color: Colors.green, // border color shape: BoxShape.circle, - border: Border.all(color: Hexcolor('#B7831A'), width: 1.5)), + border: Border.all(color: HexColor('#B7831A'), width: 1.5)), child: CircleAvatar( radius: SizeConfig.imageSizeMultiplier * 12, child: Image.asset(url), diff --git a/lib/widgets/patients/profile/profile_status_info_widget.dart b/lib/widgets/patients/profile/profile_status_info_widget.dart index c8983f83..d616c36f 100644 --- a/lib/widgets/patients/profile/profile_status_info_widget.dart +++ b/lib/widgets/patients/profile/profile_status_info_widget.dart @@ -32,11 +32,11 @@ class ProfileStatusInfoWidget extends StatelessWidget { 'Insurance approval', fontSize: SizeConfig.textMultiplier * 3, fontWeight: FontWeight.w700, - color: Hexcolor('#58434F'), + color: HexColor('#58434F'), ), AppText( 'Approved', - color: Hexcolor('#707070'), + color: HexColor('#707070'), fontSize: SizeConfig.textMultiplier * 2.5, ) ], diff --git a/lib/widgets/patients/vital_sign_details_wideget.dart b/lib/widgets/patients/vital_sign_details_wideget.dart index 166680ca..41af8e1d 100644 --- a/lib/widgets/patients/vital_sign_details_wideget.dart +++ b/lib/widgets/patients/vital_sign_details_wideget.dart @@ -54,7 +54,7 @@ class _VitalSignDetailsWidgetState extends State { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -71,7 +71,7 @@ class _VitalSignDetailsWidgetState extends State { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart index 95b55127..9f6dfdf1 100644 --- a/lib/widgets/shared/Text.dart +++ b/lib/widgets/shared/Text.dart @@ -226,7 +226,7 @@ class _TextsState extends State { }, child: Text(hidden ? "Read More" : "Read less", style: _getFontStyle().copyWith( - color: Hexcolor('#FF0000'), + color: HexColor('#FF0000'), fontWeight: FontWeight.w800, fontFamily: "WorkSans" ) diff --git a/lib/widgets/shared/app_button.dart b/lib/widgets/shared/app_button.dart index 32f5b139..984d4350 100644 --- a/lib/widgets/shared/app_button.dart +++ b/lib/widgets/shared/app_button.dart @@ -95,7 +95,7 @@ class _ButtonState extends State