From 25f902487cf92a3813def44dd94113a08d84656c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 24 Jan 2022 10:13:47 +0200 Subject: [PATCH 1/2] small fix in referal --- .../patients/profile/referral/referred-patient-screen.dart | 2 +- lib/widgets/patients/patient-referral-item-widget.dart | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 84b0d4ca..f1467f64 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -100,7 +100,7 @@ class _ReferredPatientScreenState extends State { ), isMonthShort: true ), - referredTime:AppDateUtils.getHour( + referredTime:model.state == ViewState.BusyLocal ?"":AppDateUtils.getHour( patientType == PatientType.IN_PATIENT? AppDateUtils.getDateTimeFromServerFormat( model.getReferredPatientItem(index).referralDate, diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index a4649c72..3487c4fa 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -160,7 +160,7 @@ class PatientReferralItemWidget extends StatelessWidget { ? TranslationBase.of(context).sameBranch : TranslationBase.of(context) .otherBranch - : " " + referralClinic, + : " " + Helpers.convertToTitleCase(referralClinic ?? ""), ), ], ), @@ -252,7 +252,7 @@ class PatientReferralItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - referralDoctorName ?? "", + Helpers.convertToTitleCase(referralDoctorName ?? ""), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 14.0, @@ -261,7 +261,8 @@ class PatientReferralItemWidget extends StatelessWidget { ), if (clinicDescription != null) AppText( - clinicDescription, + Helpers.convertToTitleCase(clinicDescription ?? "") + , fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 10.0, From 6905ed702e50c0feeed128ad82a4c533599a64ac Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 24 Jan 2022 13:04:06 +0200 Subject: [PATCH 2/2] first step form redesign pharmacy page --- lib/config/localized_values.dart | 4 +- .../medicine/medicine_search_screen.dart | 233 +++++++++--------- .../patient_search/patient_search_screen.dart | 2 +- lib/util/translations_delegate_base.dart | 4 +- .../medicine/medicine_item_widget.dart | 98 +++++--- lib/widgets/shared/app_scaffold_widget.dart | 3 +- 6 files changed, 182 insertions(+), 162 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5dc41d3e..253ffc67 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -84,8 +84,8 @@ const Map> localizedValues = { "ar": "المريض الذي حضر للموعد" }, "searchMedicineNameHere": {"en": "Search Medicine ", "ar": "ابحث هنا"}, - "youCanFind": {"en": "You Can Find ", "ar": "تستطيع ان تجد "}, - "itemsInSearch": {"en": "items in search", "ar": "عناصر في البحث"}, + "youCanFind": {"en": "You can find ", "ar": "تستطيع ان تجد "}, + "medicineSearchResult": {"en": "as a search result for", "ar": "كنتيجة بحث عن"}, "qr": {"en": "QR", "ar": "QR"}, "reader": {"en": "Reader", "ar": "قارىء رمز ال"}, "startScanning": {"en": "Start Scanning", "ar": "بدء المسح"}, diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index b0421609..a845bde2 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -1,12 +1,14 @@ import 'dart:math'; import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.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/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -18,6 +20,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_recognition_result.dart'; @@ -87,152 +90,140 @@ class _MedicineSearchState extends State { }); } - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - @override Widget build(BuildContext context) { return BaseView(onModelReady: (model) async { - // if (model.allMedicationList.length == 0) - // await model.getMedicationList(); }, builder: (_, model, w) { myController.text = model.searchText; return AppScaffold( // baseViewModel: model, isShowAppBar: true, - appBar: PatientSearchHeader( + appBar: BottomSheetTitle( title: TranslationBase.of(context).searchMedicine, ), //appBarTitle: TranslationBase.of(context).searchMedicine + "6", body: SingleChildScrollView( - child: FractionallySizedBox( - widthFactor: 0.97, - child: SingleChildScrollView( - child: Container( - // height: SizeConfig.screenHeight, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - FractionallySizedBox( - widthFactor: 0.9, - child: AppTextFieldCustomSearch( - hintText: - TranslationBase.of(context).searchMedicineNameHere, - searchController: myController, - onFieldSubmitted: (value) { - searchMedicine(context, model); - }, - marginTop: 5, - ), - ), - SizedBox( - height: 20, - ), - FractionallySizedBox( - widthFactor: 0.9, - child: Container( - child: Wrap( - alignment: WrapAlignment.center, - children: [ - // TODO change it secondary button and add loading - AppButton( - title: TranslationBase.of(context).search, - onPressed: () async { - await searchMedicine(context, model); - }, - ), - ], - ), - ), - ), - Container( - margin: - EdgeInsets.only(left: SizeConfig.heightMultiplier * 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + AppTextFieldCustomSearch( + hintText: + TranslationBase.of(context).searchMedicineNameHere, + searchController: myController, + onFieldSubmitted: (value) { + searchMedicine(context, model); + }, + marginTop: 5, + ), + Container( + margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 0), + + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( TranslationBase.of(context).youCanFind + (myController.text != '' ? model.pharmacyItemsList.length.toString() : '0') + " " + - TranslationBase.of(context).itemsInSearch, - fontWeight: FontWeight.bold, + TranslationBase.of(context).medicineSearchResult +" '${myController.text}'", + fontHeight: 1.4, + color: AppGlobal.appTextColor, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + letterSpacing: -0.9, ), - ], - ), + ), + ], ), - SizedBox( - height: 10, + ), + SizedBox( + height: 5, + ), + if (myController.text != '') + Container( + margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 0), + + height: MediaQuery.of(context).size.height * 0.6, + child: ListView.builder( + padding: const EdgeInsets.only(top: 20), + 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: model.pharmacyItemsList[index] + ["ImageSRCUrl"]), + settings: RouteSettings( + name: 'PharmaciesListScreen'), + ), + ); + }, + ); + }, + ), ), - if (myController.text != '') - Container( - height: MediaQuery.of(context).size.height * 0.6, - child: ListView.builder( - padding: const EdgeInsets.only(top: 20), + ], + )), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + title: TranslationBase.of(context).search, + onPressed: () async { + // onSubmitSearch(); + await searchMedicine(context, model); - 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: model.pharmacyItemsList[index] - ["ImageSRCUrl"]), - settings: RouteSettings( - name: 'PharmaciesListScreen'), - ), - ); - }, - ); - }, - ), + }, + color: AppGlobal.appRedColor, ), - ], + ), + ), ), - )), + SizedBox( + height: 5, + ), + ], ), ), + ); }); } diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index e1fdd033..94f18d81 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -117,7 +117,7 @@ class _PatientSearchScreenState extends State { onPressed: () { onSubmitSearch(); }, - color: Colors.red[800], + color: AppGlobal.appRedColor, ), ), ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 1cd4c79c..d58139b3 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -179,8 +179,8 @@ class TranslationBase { String get youCanFind => localizedValues['youCanFind'][locale.languageCode]; - String get itemsInSearch => - localizedValues['itemsInSearch'][locale.languageCode]; + String get medicineSearchResult => + localizedValues['medicineSearchResult'][locale.languageCode]; String get qr => localizedValues['qr'][locale.languageCode]; diff --git a/lib/widgets/medicine/medicine_item_widget.dart b/lib/widgets/medicine/medicine_item_widget.dart index 9768d4d1..8db9b036 100644 --- a/lib/widgets/medicine/medicine_item_widget.dart +++ b/lib/widgets/medicine/medicine_item_widget.dart @@ -1,34 +1,33 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import '../shared/app_texts_widget.dart'; import '../shared/rounded_container_widget.dart'; -/* - *@author: ibrahim albitar - *@Date:28/4/2020 - *@param: - *@return: - *@desc: - */ - class MedicineItemWidget extends StatefulWidget { final String label; final Color backgroundColor; final bool showBorder; + final bool showArrow; + final bool showPrice; final Color borderColor; final String url; + final String price; MedicineItemWidget( {@required this.label, this.backgroundColor = Colors.white, - this.showBorder = false, + this.showBorder = true, this.borderColor = Colors.white, - this.url}); + this.url, + this.showArrow = true, this.showPrice = false, this.price}); @override _MedicineItemWidgetState createState() => _MedicineItemWidgetState(); @@ -37,43 +36,72 @@ class MedicineItemWidget extends StatefulWidget { class _MedicineItemWidgetState extends State { @override Widget build(BuildContext context) { - return new RoundedContainer( - height: SizeConfig.heightMultiplier * 8, - child: Padding( - padding: const EdgeInsets.all(5.0), + return CardWithBgWidget( + // height: SizeConfig.heightMultiplier * 12.9, + bgColor: Colors.transparent, + hasBorder: false, + widget: Padding( + padding: const EdgeInsets.symmetric( + vertical: 4, + ), child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.start, children: [ if (widget.url != null) - Container( - height: 39, - width: 39, - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(7)), + ClipRRect( + borderRadius: BorderRadius.circular(20.0), child: Image.network( widget.url, - height: SizeConfig.imageSizeMultiplier * 15, - width: SizeConfig.imageSizeMultiplier * 15, - fit: BoxFit.cover, + height: 25, + width: 30, + errorBuilder: (BuildContext context, Object exception, + StackTrace stackTrace) { + return Text(''); + }, + )), + Expanded( + child: Center( + child: Padding( + padding: EdgeInsets.all(2.5), + child: Align( + alignment: Alignment.centerLeft, + child: Column( + crossAxisAlignment:CrossAxisAlignment.start, + children: [ + AppText( + Helpers.convertToTitleCase(widget.label ?? ''), + fontHeight: 1.4, + color: AppGlobal.appTextColor, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + letterSpacing: -0.33, + ), + if(widget.showPrice) + AppText( + Helpers.convertToTitleCase(widget.price ?? ''), + fontHeight: 1.4, + color: AppGlobal.appTextColor, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + letterSpacing: -0.33, + ), + ], + ), ), ), ), - Expanded( - child: Padding( - padding: EdgeInsets.all(5), - child: Align( - alignment: Alignment.centerLeft, - child: AppText(widget.label)))), - Icon(EvaIcons.eye) + ), + if(widget.showArrow) + Icon(EvaIcons.arrowForward) ], ), ), - backgroundColor: widget.backgroundColor, - showBorder: widget.showBorder, - borderColor: widget.borderColor, - margin: EdgeInsets.all(4), - raduis: 10, + // backgroundColor: widget.backgroundColor, + // showBorder: widget.showBorder, + // borderColor: widget.borderColor, + // // margin: 4.0, + // // margin: EdgeInsets.all(4), + // raduis: 10, ); } diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 880109cc..c214a040 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -49,7 +49,8 @@ class AppScaffold extends StatelessWidget { FocusScope.of(context).requestFocus(new FocusNode()); }, child: Scaffold( - backgroundColor: backgroundColor ?? Colors.white, + backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor + , drawer: drawer, extendBody: extendBody, bottomNavigationBar: bottomNavigationBar,