diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 72b5c857..69cae394 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.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/bottom_nav_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -41,7 +42,13 @@ class _LandingPageState extends State { backgroundColor: Colors.grey[100], //textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), title: currentTab != 0 - ? Text(getText(currentTab).toUpperCase()) + ? AppText( + getText(currentTab), + letterSpacing: -1.44, + fontWeight: FontWeight.w700, + fontSize: 24.0, + color: Color(0xff2B353E), + ) : SizedBox(), leading: Builder( builder: (BuildContext context) { @@ -49,7 +56,7 @@ class _LandingPageState extends State { icon: Image.asset('assets/images/menu.png', height: 50, width: 50), iconSize: 15, - color: Colors.black, + color: Color(0xff2B353E), onPressed: () => Scaffold.of(context).openDrawer(), ); }, diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index fe6fd2db..2eefeb43 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -12,7 +12,6 @@ import '../../../../routes.dart'; class MyReferralPatientScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return BaseView( onModelReady: (model) => model.getPendingReferralPatients(), builder: (_, model, w) => AppScaffold( diff --git a/lib/screens/patients/profile/referral/patient_referral_screen.dart b/lib/screens/patients/profile/referral/patient_referral_screen.dart index f4459dba..7454bcde 100644 --- a/lib/screens/patients/profile/referral/patient_referral_screen.dart +++ b/lib/screens/patients/profile/referral/patient_referral_screen.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -45,8 +46,9 @@ class _PatientReferralScreen extends State @override Widget build(BuildContext context) { return AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).patientsreferral, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).patientsreferral, + ), body: Scaffold( extendBodyBehindAppBar: true, // backgroundColor: Colors.white, @@ -99,22 +101,20 @@ class _PatientReferralScreen extends State ), ), ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - ReferredPatientScreen(), - MyReferralInPatientScreen(), - ReferralDischargedPatientPage() - // MyReferredPatient(), - ], - ), - ) - ], - ), - )); + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + ReferredPatientScreen(), + MyReferralInPatientScreen(), + ReferralDischargedPatientPage() + // MyReferredPatient(), + ], + ), + ) + ], + ), + ); } } diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 6010a422..f9371834 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -23,7 +23,8 @@ import 'package:hexcolor/hexcolor.dart'; class PatientMakeReferralScreen extends StatefulWidget { // previous design page is: ReferPatientScreen @override - _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); + _PatientMakeReferralScreenState createState() => + _PatientMakeReferralScreenState(); } class _PatientMakeReferralScreenState extends State { @@ -56,8 +57,14 @@ class _PatientMakeReferralScreenState extends State { String arrivalType = routeArgs['arrivalType']; referToList = List(); - dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch}; - dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch}; + dynamic sameBranch = { + "id": 1, + "name": TranslationBase.of(context).sameBranch + }; + dynamic otherBranch = { + "id": 2, + "name": TranslationBase.of(context).otherBranch + }; referToList.add(sameBranch); referToList.add(otherBranch); @@ -103,25 +110,57 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? referralForm(model, screenSize) : PatientReferralItemWidget( - referralStatus: model.patientReferral[model.patientReferral.length - 1].referralStatus, - patientName: model.patientReferral[model.patientReferral.length - 1].patientName, - patientGender: - model.patientReferral[model.patientReferral.length - 1].patientDetails.gender, - referredDate: - model.patientReferral[model.patientReferral.length - 1].referredOn.split(" ")[0], - referredTime: - model.patientReferral[model.patientReferral.length - 1].referredOn.split(" ")[1], - patientID: "${model.patientReferral[model.patientReferral.length - 1].patientID}", - isSameBranch: - model.patientReferral[model.patientReferral.length - 1].isReferralDoctorSameBranch, + referralStatus: model + .patientReferral[ + model.patientReferral.length - 1] + .referralStatus, + patientName: model + .patientReferral[ + model.patientReferral.length - 1] + .patientName, + patientGender: model + .patientReferral[ + model.patientReferral.length - 1] + .patientDetails + .gender, + referredDate: model + .patientReferral[ + model.patientReferral.length - 1] + .referredOn + .split(" ")[0], + referredTime: model + .patientReferral[ + model.patientReferral.length - 1] + .referredOn + .split(" ")[1], + patientID: + "${model.patientReferral[model.patientReferral.length - 1].patientID}", + isSameBranch: model + .patientReferral[ + model.patientReferral.length - 1] + .isReferralDoctorSameBranch, isReferral: true, - remark: model.patientReferral[model.patientReferral.length - 1].remarksFromSource, - nationality: - model.patientReferral[model.patientReferral.length - 1].patientDetails.nationalityName, - nationalityFlag: model.patientReferral[model.patientReferral.length - 1].nationalityFlagUrl, - doctorAvatar: model.patientReferral[model.patientReferral.length - 1].doctorImageUrl, - referralDoctorName: - model.patientReferral[model.patientReferral.length - 1].referredByDoctorInfo, + remark: model + .patientReferral[ + model.patientReferral.length - 1] + .remarksFromSource, + nationality: model + .patientReferral[ + model.patientReferral.length - 1] + .patientDetails + .nationalityName, + nationalityFlag: model + .patientReferral[ + model.patientReferral.length - 1] + .nationalityFlagUrl, + doctorAvatar: model + .patientReferral[ + model.patientReferral.length - 1] + .doctorImageUrl, + referralDoctorName: model + .patientReferral[ + model.patientReferral.length - 1] + .referredByDoctorInfo, clinicDescription: null, ), ], @@ -140,22 +179,26 @@ class _PatientMakeReferralScreenState extends State { eventAction: "Submit Refer", ); if (_referTo == null) { - branchError = TranslationBase.of(context).fieldRequired; + branchError = + TranslationBase.of(context).fieldRequired; } else { branchError = null; } if (_selectedBranch == null) { - hospitalError = TranslationBase.of(context).fieldRequired; + hospitalError = + TranslationBase.of(context).fieldRequired; } else { hospitalError = null; } if (_selectedClinic == null) { - clinicError = TranslationBase.of(context).fieldRequired; + clinicError = + TranslationBase.of(context).fieldRequired; } else { clinicError = null; } if (_selectedDoctor == null) { - doctorError = TranslationBase.of(context).fieldRequired; + doctorError = + TranslationBase.of(context).fieldRequired; } else { doctorError = null; } @@ -166,10 +209,16 @@ class _PatientMakeReferralScreenState extends State { _selectedDoctor == null || _remarksController.text == null) return; model - .makeReferral(patient, appointmentDate.toIso8601String(), _selectedBranch['facilityId'], - _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text) + .makeReferral( + patient, + appointmentDate.toIso8601String(), + _selectedBranch['facilityId'], + _selectedClinic['ClinicID'], + _selectedDoctor['DoctorID'], + _remarksController.text) .then((_) { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).referralSuccessMsg); Navigator.pop(context); }); }, @@ -215,7 +264,8 @@ class _PatientMakeReferralScreenState extends State { GifLoaderDialogUtils.showMyDialog(context); await model .getClinics(_selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils.hideDialog(context)); + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -242,42 +292,47 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).hospital, - dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null, + dropDownText: _selectedBranch != null + ? _selectedBranch['facilityName'] + : null, enabled: false, isTextFieldHasSuffix: true, validationError: hospitalError, - onClick: - model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.branchesList, - attributeName: 'facilityName', - attributeValueId: 'facilityId', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() async { - _selectedBranch = selectedValue; - _selectedClinic = null; - _selectedDoctor = null; - GifLoaderDialogUtils.showMyDialog(context); - await model - .getClinics(_selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils.hideDialog(context)); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, + onClick: model.branchesList != null && + model.branchesList.length > 0 && + _referTo != null && + _referTo['id'] == 2 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.branchesList, + attributeName: 'facilityName', + attributeValueId: 'facilityId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() async { + _selectedBranch = selectedValue; + _selectedClinic = null; + _selectedDoctor = null; + GifLoaderDialogUtils.showMyDialog(context); + await model + .getClinics(_selectedBranch['facilityId']) + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, ), SizedBox( height: 10, @@ -285,11 +340,15 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).clinic, - dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null, + dropDownText: _selectedClinic != null + ? _selectedClinic['ClinicDescription'] + : null, enabled: false, isTextFieldHasSuffix: true, validationError: clinicError, - onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0 + onClick: _selectedBranch != null && + model.clinicsList != null && + model.clinicsList.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.clinicsList, @@ -304,8 +363,12 @@ class _PatientMakeReferralScreenState extends State { _selectedClinic = selectedValue; GifLoaderDialogUtils.showMyDialog(context); await model - .getClinicDoctors(patient, _selectedClinic['ClinicID'], _selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils.hideDialog(context)); + .getClinicDoctors( + patient, + _selectedClinic['ClinicID'], + _selectedBranch['facilityId']) + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -328,11 +391,14 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, - dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, + dropDownText: + _selectedDoctor != null ? _selectedDoctor['Name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: doctorError, - onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0 + onClick: _selectedClinic != null && + model.doctorsList != null && + model.doctorsList.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.doctorsList, @@ -357,9 +423,12 @@ class _PatientMakeReferralScreenState extends State { } : () { if (_selectedClinic == null) { - DrAppToastMsg.showErrorToast("You need to select a clinic first"); - } else if (model.doctorsList == null || model.doctorsList.length == 0) { - DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); + DrAppToastMsg.showErrorToast( + "You need to select a clinic first"); + } else if (model.doctorsList == null || + model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast( + "There is no doctors for this clinic"); } }, ), @@ -369,8 +438,9 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).date, - dropDownText: - appointmentDate != null ? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" : null, + dropDownText: appointmentDate != null + ? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" + : null, enabled: false, isTextFieldHasSuffix: true, suffixIcon: IconButton( diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index d2e495ee..cfa086b5 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -269,7 +269,7 @@ class PatientReferralItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - referralDoctorName, + referralDoctorName ?? "", fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 14.0,