From 994b43a59093c47088c85d2407cab574fbae7097 Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Mon, 24 Jan 2022 13:07:39 +0200 Subject: [PATCH] Fix the form in prescription screen --- .../doctor_replay/doctor_reply_screen.dart | 12 +- .../In_patient/in_patient_screen.dart | 11 +- .../out_patient/out_patient_screen.dart | 11 +- .../referral/patient_referral_screen.dart | 17 +-- .../prescription/add_prescription_form.dart | 16 ++- lib/util/helpers.dart | 100 ---------------- lib/util/tab_helper.dart | 113 ++++++++++++++++++ .../shared/dialogs/dailog-list-select.dart | 2 +- 8 files changed, 151 insertions(+), 131 deletions(-) create mode 100644 lib/util/tab_helper.dart diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart index 1583161a..685c4903 100644 --- a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import 'package:doctor_app_flutter/util/tab_helper.dart'; import 'all_doctor_questions.dart'; import 'not_replaied_Doctor_Questions.dart'; @@ -72,7 +72,7 @@ class _DoctorReplyScreenState extends State preferredSize: Size.fromHeight( MediaQuery.of(context).size.height * 0.070), child: Container( - color: Helpers.getBgTabColor(), + color: TabHelper.getBgTabColor(), child: TabBar( isScrollable: false, controller: _tabController, @@ -136,8 +136,8 @@ Widget tabWidget( return Center( child: Container( - height: Helpers.getTabHeight(context), - decoration: Helpers.getBoxTabsBoxDecoration( + height: TabHelper.getTabHeight(context), + decoration: TabHelper.getBoxTabsBoxDecoration( isActive: isActive, isFirst: isFirst, isMiddle: isMiddle, @@ -146,9 +146,9 @@ Widget tabWidget( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Helpers.getTabText(title: title, isActive: isActive), + TabHelper.getTabText(title: title, isActive: isActive), if (counter != -1) - Helpers.getTabCounter(isActive: isActive, counter: counter) + TabHelper.getTabCounter(isActive: isActive, counter: counter) ], ), ), diff --git a/lib/screens/patients/In_patient/in_patient_screen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart index a2ef497a..5f7aecf2 100644 --- a/lib/screens/patients/In_patient/in_patient_screen.dart +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../util/tab_helper.dart'; import '../DischargedPatientPage.dart'; import 'in_patient_list_page.dart'; @@ -123,7 +124,7 @@ class _InPatientScreenState extends State color: Colors.white), child: Container( margin: EdgeInsets.only(top: 9), - color: Helpers.getBgTabColor(), + color: TabHelper.getBgTabColor(), child: TabBar( isScrollable: false, controller: _tabController, @@ -214,8 +215,8 @@ class _InPatientScreenState extends State return Center( child: Container( - height: Helpers.getTabHeight(context), - decoration: Helpers.getBoxTabsBoxDecoration( + height: TabHelper.getTabHeight(context), + decoration: TabHelper.getBoxTabsBoxDecoration( isActive: isActive, isFirst: isFirst, isMiddle: isMiddle, @@ -224,9 +225,9 @@ class _InPatientScreenState extends State child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Helpers.getTabText(title: title, isActive: isActive), + TabHelper.getTabText(title: title, isActive: isActive), if (counter != -1) - Helpers.getTabCounter(isActive: isActive, counter: counter) + TabHelper.getTabCounter(isActive: isActive, counter: counter) ], ), ), diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index d6db782d..619bf32d 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -21,6 +21,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../../../util/tab_helper.dart'; import 'filter_date_page.dart'; // ignore: must_be_immutable @@ -102,8 +103,8 @@ class _OutPatientsScreenState extends State { children: [ Container( // color: Colors.red, - height: Helpers.getTabHeight(context), - color: Helpers.getBgTabColor(), + height: TabHelper.getTabHeight(context), + color: TabHelper.getBgTabColor(), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -138,7 +139,7 @@ class _OutPatientsScreenState extends State { child: Center( child: Container( height: screenSize.height * 0.070, - decoration: Helpers.getBoxTabsBoxDecoration( + decoration: TabHelper.getBoxTabsBoxDecoration( isActive: _isActive, isFirst: _times.indexOf(item) == 0, isLast: @@ -150,12 +151,12 @@ class _OutPatientsScreenState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Helpers.getTabText( + TabHelper.getTabText( title: item, isActive: _isActive), _isActive && _activeLocation != 0 && model.state == ViewState.Idle - ? Helpers.getTabCounter( + ? TabHelper.getTabCounter( isActive: _isActive, counter: model.filterData.length) : Container(), diff --git a/lib/screens/patients/profile/referral/patient_referral_screen.dart b/lib/screens/patients/profile/referral/patient_referral_screen.dart index 687f1463..c620de1c 100644 --- a/lib/screens/patients/profile/referral/patient_referral_screen.dart +++ b/lib/screens/patients/profile/referral/patient_referral_screen.dart @@ -10,6 +10,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../util/tab_helper.dart'; import '../../ReferralDischargedPatientPage.dart'; import 'my-referral-inpatient-screen.dart'; @@ -60,8 +61,8 @@ class _PatientReferralScreen extends State Size.fromHeight(MediaQuery.of(context).size.height * 0.070), child: Center( child: Container( - height: Helpers.getTabHeight(context), - color: Helpers.getBgTabColor(), + height: TabHelper.getTabHeight(context), + color: TabHelper.getBgTabColor(), child: Center( child: TabBar( isScrollable: false, @@ -75,36 +76,36 @@ class _PatientReferralScreen extends State unselectedLabelColor: Colors.grey[800], tabs: [ Container( - decoration: Helpers.getBoxTabsBoxDecoration( + decoration: TabHelper.getBoxTabsBoxDecoration( isActive: index == 0, isFirst: true, projectViewModel: projectsProvider), child: Center( - child: Helpers.getTabText( + child: TabHelper.getTabText( title: TranslationBase.of(context) .myReferredPatient, isActive: index == 0)), ), Center( child: Container( - decoration: Helpers.getBoxTabsBoxDecoration( + decoration: TabHelper.getBoxTabsBoxDecoration( isActive: index == 1, isMiddle: true, projectViewModel: projectsProvider), child: Center( - child: Helpers.getTabText( + child: TabHelper.getTabText( title: TranslationBase.of(context).referral, isActive: index == 1)), ), ), Center( child: Container( - decoration: Helpers.getBoxTabsBoxDecoration( + decoration: TabHelper.getBoxTabsBoxDecoration( isActive: index == 2, isLast: true, projectViewModel: projectsProvider), child: Center( - child: Helpers.getTabText( + child: TabHelper.getTabText( title: TranslationBase.of(context).discharged, isActive: index == 2), ), diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index a8ee8cb8..f79f9ba3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -405,16 +405,22 @@ class _PrescriptionFormWidgetState extends State { AppText( _selectedMedication?.description ?? "", - bold: true, + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 15.0, ), Container( child: Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ + SizedBox(width: 6,), AppText( TranslationBase.of(context) .orderType, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w500, ), + SizedBox(width: 18,), Radio( activeColor: Color(0xFFB9382C), @@ -429,8 +435,6 @@ class _PrescriptionFormWidgetState extends State { ], ), ), - SizedBox( - height: spaceBetweenTextFileds), Container( width: double.infinity, child: Row( @@ -441,7 +445,7 @@ class _PrescriptionFormWidgetState extends State { .width * 0.35, child: AppTextFieldCustom( - //height: 40, + height: 38, validationError: strengthError, hintText: 'Strength', @@ -480,7 +484,7 @@ class _PrescriptionFormWidgetState extends State { element: model .itemMedicineListUnit .length == - 1 + 1 ? model .itemMedicineListUnit[0] : units, diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 3d9a0b1d..a91f36b1 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -327,107 +327,7 @@ class Helpers { return kpi; } - static getBoxTabsBoxDecoration( - {bool isFirst = false, - bool isMiddle = false, - bool isLast = false, - bool isActive = false, - double radius = 6.0, - ProjectViewModel projectViewModel}) { - return BoxDecoration( - color: isActive ? AppGlobal.appRedColor : Color(0xFFEAEAEA), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.only( - topRight: projectViewModel.isArabic - ? Radius.circular(isActive - ? isLast || isMiddle - ? radius - : 0 - : 0) - : Radius.circular(isActive - ? isFirst || isMiddle - ? radius - : 0 - : 0), - topLeft: projectViewModel.isArabic - ? Radius.circular(isActive - ? isFirst || isMiddle - ? radius - : 0 - : 0) - : Radius.circular(isActive - ? isLast || isMiddle - ? radius - : 0 - : 0), - bottomRight: projectViewModel.isArabic - ? Radius.circular(isActive - ? isLast || isMiddle - ? radius - : 0 - : 0) - : Radius.circular(isActive - ? isFirst || isMiddle - ? radius - : 0 - : 0), - bottomLeft: projectViewModel.isArabic - ? Radius.circular(isActive - ? isFirst || isMiddle - ? radius - : 0 - : 0) - : Radius.circular(isActive - ? isLast || isMiddle - ? radius - : 0 - : 0)), - ); - } - - static getBgTabColor() { - return Color(0xFFEAEAEA); - } - - static getTabText({ - String title, - bool isActive = false, - }) { - return AppText( - title, - fontSize: SizeConfig.textMultiplier * 1.8, - color: isActive ? Colors.white : AppGlobal.appTextColor, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ); - } - - static getTabHeight(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return screenSize.height * 0.07; - } - static getTabCounter({bool isActive: false, int counter}) { - return Container( - margin: EdgeInsets.all(4), - width: 15, - height: 15, - decoration: BoxDecoration( - color: isActive ? Colors.white : AppGlobal.appRedColor, - shape: BoxShape.circle, - ), - child: Center( - child: FittedBox( - child: AppText( - "$counter", - fontSize: SizeConfig.textMultiplier * 1.5, - color: !isActive ? Colors.white : AppGlobal.appRedColor, - fontWeight: FontWeight.w700, - ), - ), - ), - ); - } static String convertToTitleCase(String text) { if (text == null) { diff --git a/lib/util/tab_helper.dart b/lib/util/tab_helper.dart new file mode 100644 index 00000000..c4a023d4 --- /dev/null +++ b/lib/util/tab_helper.dart @@ -0,0 +1,113 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; + +import '../config/config.dart'; +import '../config/size_config.dart'; +import '../core/viewModel/project_view_model.dart'; +import '../widgets/shared/app_texts_widget.dart'; + +class TabHelper { + + static getBoxTabsBoxDecoration( + {bool isFirst = false, + bool isMiddle = false, + bool isLast = false, + bool isActive = false, + double radius = 6.0, + ProjectViewModel projectViewModel}) { + return BoxDecoration( + color: isActive ? AppGlobal.appRedColor : Color(0xFFEAEAEA), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.only( + topRight: projectViewModel.isArabic + ? Radius.circular(isActive + ? isLast || isMiddle + ? radius + : 0 + : 0) + : Radius.circular(isActive + ? isFirst || isMiddle + ? radius + : 0 + : 0), + topLeft: projectViewModel.isArabic + ? Radius.circular(isActive + ? isFirst || isMiddle + ? radius + : 0 + : 0) + : Radius.circular(isActive + ? isLast || isMiddle + ? radius + : 0 + : 0), + bottomRight: projectViewModel.isArabic + ? Radius.circular(isActive + ? isLast || isMiddle + ? radius + : 0 + : 0) + : Radius.circular(isActive + ? isFirst || isMiddle + ? radius + : 0 + : 0), + bottomLeft: projectViewModel.isArabic + ? Radius.circular(isActive + ? isFirst || isMiddle + ? radius + : 0 + : 0) + : Radius.circular(isActive + ? isLast || isMiddle + ? radius + : 0 + : 0)), + ); + } + + static getBgTabColor() { + return Color(0xFFEAEAEA); + } + + static getTabText({ + String title, + bool isActive = false, + }) { + return AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.8, + color: isActive ? Colors.white : AppGlobal.appTextColor, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ); + } + + static getTabHeight(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return screenSize.height * 0.07; + } + + static getTabCounter({bool isActive: false, int counter}) { + return Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : AppGlobal.appRedColor, + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : AppGlobal.appRedColor, + fontWeight: FontWeight.w700, + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index bebd644d..1030e2f9 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -104,7 +104,7 @@ class _ListSelectDialogState extends State { .selectedValue[widget.attributeValueId] .toString(), value: item[widget.attributeValueId].toString(), - activeColor: Colors.blue.shade700, + activeColor: Color(0xFFB9382C), selected: item[widget.attributeValueId] .toString() == widget.selectedValue[widget.attributeValueId]