From 8980fc03aac2f88d751c655ac4e94bb144b1e94c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 12 Aug 2020 10:45:38 +0300 Subject: [PATCH] Finish Patient search design --- lib/client/app_client.dart | 17 - lib/config/localized_values.dart | 15 +- lib/interceptor/http_interceptor.dart | 65 --- lib/providers/patients_provider.dart | 1 - .../patients/patient_search_screen.dart | 505 +++++++++++------- lib/util/translations_delegate_base.dart | 21 +- lib/widgets/patients/dynamic_elements.dart | 43 +- lib/widgets/shared/app_buttons_widget.dart | 2 +- lib/widgets/shared/app_text_form_field.dart | 20 +- 9 files changed, 372 insertions(+), 317 deletions(-) delete mode 100644 lib/client/app_client.dart delete mode 100644 lib/interceptor/http_interceptor.dart diff --git a/lib/client/app_client.dart b/lib/client/app_client.dart deleted file mode 100644 index 89b62722..00000000 --- a/lib/client/app_client.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/interceptor/http_interceptor.dart'; -import 'package:http/http.dart'; - -// OWNER : Ibrahim albitar -// DATE : 22-04-2020 -// DESCRIPTION : Custom App client to pin base url for all srvices - -class AppClient { - static Client client = HttpInterceptor().getClient(); - - static Future post(dynamic path, {dynamic body}) async { - String _fullUrl = BASE_URL + path; - final response = await client.post(_fullUrl, body: body); - return response; - } -} diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 15d68f32..9d7d73c9 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -221,8 +221,15 @@ const Map> localizedValues = { 'en': 'Type or speak the medicine name to search', 'ar': ' اكتب أو انطق اسم الدواء للبحث' }, - "type": { - 'en': 'Type or Speak', - 'ar': 'اكتب أو تحدث ' - } + "type": {'en': 'Type or Speak', 'ar': 'اكتب أو تحدث '}, + "fromDate": {'en': 'From Date', 'ar': 'من تاريخ'}, + "toDate": {'en': 'To Date', 'ar': 'الى تاريخ'}, + "searchPatientImageCaptionTitle": { + 'en': 'SEARCH PATIENT', + 'ar': 'البحث عن المريض' + }, + "searchPatientImageCaptionBody": { + 'en': 'Add Details Of Patient To search', + 'ar': ' أضف تفاصيل المريض للبحث' + }, }; diff --git a/lib/interceptor/http_interceptor.dart b/lib/interceptor/http_interceptor.dart deleted file mode 100644 index 958be49c..00000000 --- a/lib/interceptor/http_interceptor.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'dart:convert'; - -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/providers/auth_provider.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_interceptor.dart'; - -import '../providers/auth_provider.dart'; -import '../util/dr_app_shared_pref.dart'; -import 'package:doctor_app_flutter/config/config.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -List publicUrls = [ - LOGIN_URL, - SELECT_DEVICE_IMEI, - MEMBER_CHECK_ACTIVATION_CODE_NEW, - SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE -]; - -class HttpInterceptor extends InterceptorContract { - Client getClient() { - return HttpClientWithInterceptor.build(interceptors: [this]); - } - - Future interceptRequest({RequestData data}) async { - print('RequestData ${data.body}'); - print('RequestData ${data.url}'); - try { - data.headers["Content-Type"] = "application/json"; - data.headers["Accept"] = "application/json"; - // if (publicUrls.contains(data.url)) { - // var loggedUserInfo = await sharedPref.getObj(LOGGED_IN_USER); - // var token = await sharedPref.getString(TOKEN); - // // print("token"+token); - // // print('loggedUserInfo${loggedUserInfo["LogInTokenID"]}'); - // // // the sevices handel the token in differat name so I ask to be change - // // // we must change the imple - // var body = json.decode(data.body); - // body['LogInTokenID']=token; - // data.body = json.encode(body); - - // // data.body['LogInTokenID'] = ''; - // } else { - // if (data.body['LogInTokenID']) { - // data.body['LogInTokenID'] = ''; - // } - // if (data.body['TokenID']) { - // data.body['TokenID'] = ''; - // } - // } - } catch (e) { - print(e); - } - - // print('data.body${data.body}'); - return data; - } - - @override - Future interceptResponse({ResponseData data}) async { - // print('ResponseData ${data.body}'); - return data; - } -} diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 15c9e1e4..805b48dd 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:doctor_app_flutter/client/app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index e60bd238..2a36c216 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -1,26 +1,27 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/routes.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:flutter/material.dart'; +import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; +import '../../config/config.dart'; import '../../config/size_config.dart'; +import '../../lookups/patient_lookup.dart'; +import '../../models/doctor/doctor_profile_model.dart'; +import '../../widgets/patients/dynamic_elements.dart'; import '../../widgets/shared/app_buttons_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/app_text_form_field.dart'; import '../../widgets/shared/app_texts_widget.dart'; import '../../widgets/shared/rounded_container_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; - -import '../../lookups/patient_lookup.dart'; -import '../../widgets/patients/dynamic_elements.dart'; -import '../../config/config.dart'; -import '../../models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -126,10 +127,35 @@ class _PatientSearchScreenState extends State { RoundedContainer( child: Column( children: [ - Icon( - Icons.search, - size: SizeConfig.imageSizeMultiplier * 15, + Column( + children: [ + Container( + child: Icon( + DoctorApp.search_patient, + size: 100, + color: Colors.black, + ), + margin: EdgeInsets.only(top: 10), + ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: AppText( + TranslationBase.of(context).searchPatientImageCaptionTitle.toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: SizeConfig.heightMultiplier * 2.5, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 5.0), + child: AppText( + TranslationBase.of(context) + .searchPatientImageCaptionBody, + fontSize: SizeConfig.heightMultiplier * 2, + ), + ) + ], ), + Container( padding: EdgeInsets.all(15), width: SizeConfig.screenWidth * 1, @@ -143,20 +169,18 @@ class _PatientSearchScreenState extends State { height: 5, ), Container( + height: 40.0, decoration: ShapeDecoration( shape: RoundedRectangleBorder( side: BorderSide( width: 1.0, style: BorderStyle.solid, - color: Color(0xff707070)), + color: Hexcolor("#CCCCCC")), borderRadius: - BorderRadius.all(Radius.circular(5.0)), + BorderRadius.all(Radius.circular(6.0)), ), ), - // margin: 0, - // showBorder: true, - // raduis: 30, - // borderColor: Color(0xff707070), + width: double.infinity, child: Padding( padding: EdgeInsets.only( @@ -171,53 +195,54 @@ class _PatientSearchScreenState extends State { // add Expanded to have your dropdown button fill remaining space child: DropdownButtonHideUnderline( child: DropdownButton( - isExpanded: true, - value: _selectedType, - iconSize: 40, - 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(), + )), ), ], ), @@ -226,134 +251,212 @@ class _PatientSearchScreenState extends State { SizedBox( height: 10, ), - AppTextFormField( - hintText: TranslationBase.of(context).firstName, - onSaved: (value) { - value == null - ? _patientSearchFormValues.setFirstName = - "0" - : _patientSearchFormValues.setFirstName = - value; + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: Hexcolor("#CCCCCC")) + ), + padding: EdgeInsets.only(top: 5), + child: AppTextFormField( - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setFirstName = "0"; - } - }, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_LETTERS), - SizedBox( - height: 10, + labelText: TranslationBase + .of(context) + .firstName, + borderColor: Colors.white, + + onSaved: (value) { + value == null + ? _patientSearchFormValues.setFirstName = + "0" + : _patientSearchFormValues.setFirstName = + value; + + if (value + .toString() + .trim() + .isEmpty) { + _patientSearchFormValues.setFirstName = "0"; + } + }, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_LETTERS), ), - AppTextFormField( - hintText: TranslationBase.of(context).middleName, - onSaved: (value) { - value == null - ? _patientSearchFormValues.setMiddleName = - "0" - : _patientSearchFormValues.setMiddleName = - value; - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setMiddleName = "0"; - } - }, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_LETTERS), SizedBox( height: 10, ), - AppTextFormField( - hintText: TranslationBase.of(context).lastName, - onSaved: (value) { - value == null - ? _patientSearchFormValues.setLastName = "0" - : _patientSearchFormValues.setLastName = - value; - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setLastName = "0"; - } - }, - inputFormatter: ONLY_LETTERS), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: Hexcolor("#CCCCCC")) + ), + padding: EdgeInsets.only(top: 5), + child: AppTextFormField( + labelText: TranslationBase + .of(context) + .middleName, + borderColor: Colors.white, + onSaved: (value) { + value == null + ? _patientSearchFormValues.setMiddleName = + "0" + : _patientSearchFormValues.setMiddleName = + value; + if (value + .toString() + .trim() + .isEmpty) { + _patientSearchFormValues.setMiddleName = + "0"; + } + }, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_LETTERS), + ), SizedBox( height: 10, ), - AppTextFormField( - textInputType: TextInputType.number, - hintText: TranslationBase.of(context).phoneNumber, - // validator: (value) { - // return TextValidator().validateMobile(value); - // }, - inputFormatter: ONLY_NUMBERS, - onSaved: (value) { - value == null - ? _patientSearchFormValues - .setPatientMobileNumber = "0" - : _patientSearchFormValues - .setPatientMobileNumber = value; - - if (value.toString().trim().isEmpty) { - _patientSearchFormValues - .setPatientMobileNumber = "0"; - } - }, + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: Hexcolor("#CCCCCC")) + ), + padding: EdgeInsets.only(top: 5), + child: AppTextFormField( + labelText: TranslationBase + .of(context) + .lastName, + borderColor: Colors.white, + onSaved: (value) { + value == null + ? + _patientSearchFormValues.setLastName = "0" + : _patientSearchFormValues.setLastName = + value; + if (value + .toString() + .trim() + .isEmpty) { + _patientSearchFormValues.setLastName = "0"; + } + }, + inputFormatter: ONLY_LETTERS), ), SizedBox( height: 10, ), - AppTextFormField( + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: Hexcolor("#CCCCCC")) + ), + padding: EdgeInsets.only(top: 5), + child: AppTextFormField( + labelText: TranslationBase + .of(context) + .phoneNumber, + borderColor: Colors.white, textInputType: TextInputType.number, - hintText: TranslationBase.of(context).patientID, - // inputFormatter: ONLY_NUMBERS, onSaved: (value) { - // _patientSearchFormValues.PatientID = 89000; - value == null - ? _patientSearchFormValues.setPatientID = 0 - : _patientSearchFormValues.setPatientID = - int.parse(value); - if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setPatientID = 0; + ? _patientSearchFormValues + .setPatientMobileNumber = "0" + : _patientSearchFormValues + .setPatientMobileNumber = value; + + if (value + .toString() + .trim() + .isEmpty) { + _patientSearchFormValues + .setPatientMobileNumber = "0"; } - }), + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: Hexcolor("#CCCCCC")) + ), + padding: EdgeInsets.only(top: 5), + child: AppTextFormField( + labelText: TranslationBase + .of(context) + .patientID, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + onSaved: (value) { + value == null + ? + _patientSearchFormValues.setPatientID = 0 + : _patientSearchFormValues.setPatientID = + int.parse(value); + if (value + .toString() + .trim() + .isEmpty) { + _patientSearchFormValues.setPatientID = 0; + } + }), + ), SizedBox( height: 10, ), - AppTextFormField( - textInputType: TextInputType.number, - hintText: TranslationBase.of(context).patientFile, - // validator: (value) { - // return TextValidator().validateIdNumber(value); - // }, - inputFormatter: ONLY_NUMBERS, - onSaved: (value) { - //_patientSearchFormValues. = value; - }, + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: Hexcolor("#CCCCCC")) + ), + padding: EdgeInsets.only(top: 5), + child: AppTextFormField( + labelText: TranslationBase + .of(context) + .patientFile, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + onSaved: (value) {}, + ), ), (!(_selectedType == '2' || _selectedType == '4')) ? DynamicElements(_patientSearchFormValues) : SizedBox( - height: 0, - ), + height: 0, + ), SizedBox( height: 10, ), Container( - // margin: 0, - // showBorder: true, - // raduis: 30, - // borderColor: Color(0xff707070), + height: 40.0, decoration: ShapeDecoration( shape: RoundedRectangleBorder( side: BorderSide( width: 1.0, style: BorderStyle.solid, - color: Color(0xff707070)), + color: Hexcolor("#CCCCCC")), borderRadius: - BorderRadius.all(Radius.circular(5.0)), + BorderRadius.all(Radius.circular(6.0)), ), ), width: double.infinity, @@ -370,29 +473,29 @@ class _PatientSearchScreenState extends State { // add Expanded to have your dropdown button fill remaining space child: DropdownButtonHideUnderline( child: DropdownButton( - isExpanded: true, - value: _selectedLocation, - iconSize: 40, - 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(); @@ -414,25 +517,43 @@ class _PatientSearchScreenState extends State { value: item['val'], ); }).toList(), - )), + )), ), ], ), ), ), + SizedBox( + height: 10, + ), Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Checkbox( - value: true, - activeColor: Color(0xffFFDDD9), - onChanged: (bool newValue) {}), - 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/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index ea0b5b60..6e01b3c2 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -233,16 +233,35 @@ class TranslationBase { String get livecare => localizedValues['livecare'][locale.languageCode]; String get beingBad => localizedValues['beingBad'][locale.languageCode]; String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; + String get cancel => localizedValues['cancel'][locale.languageCode]; + String get done => localizedValues['done'][locale.languageCode]; - String get searchMedicineImageCaption => localizedValues['searchMedicineImageCaption'][locale.languageCode]; + + String get searchMedicineImageCaption => + localizedValues['searchMedicineImageCaption'][locale.languageCode]; + String get type => localizedValues['type'][locale.languageCode]; + String get resumecall => localizedValues['resumecall'][locale.languageCode]; + String get endcallwithcharge => localizedValues['endcallwithcharge'][locale.languageCode]; + String get endcall => localizedValues['endcall'][locale.languageCode]; + String get transfertoadmin => localizedValues['transfertoadmin'][locale.languageCode]; + + String get fromDate => localizedValues['toDate'][locale.languageCode]; + + String get toDate => localizedValues['toDate'][locale.languageCode]; + + String get searchPatientImageCaptionTitle => + localizedValues['searchPatientImageCaptionTitle'][locale.languageCode]; + + String get searchPatientImageCaptionBody => + localizedValues['searchPatientImageCaptionBody'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index 36808cb0..25d196d0 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -68,34 +69,17 @@ class _DynamicElementsState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'From', + hintText: TranslationBase.of(context).fromDate, controller: _fromDateController, - inputFormatter: ONLY_DATE, onTap: () { _presentDatePicker('_selectedFromDate'); }, - - // validator: (value) { - // return TextValidator().validateDate(_fromDateController.text); - // }, - /* - *@author: Amjad Amireh - *@Date:13/5/2020 - *@param: - *@return:check if field empty added static value - - *@desc: - */ onSaved: (value) { if (_fromDateController.text.toString().trim().isEmpty) { widget._patientSearchFormValues.From = "0"; } else { widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-"); - - - - // _fromDateController.text; } }, ), @@ -104,28 +88,23 @@ class _DynamicElementsState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'TO', + hintText: TranslationBase + .of(context) + .toDate, controller: _toDateController, onTap: () { _presentDatePicker('_selectedToDate'); }, - // validator: (value) { - // return TextValidator().validateDate(_toDateController.text); - // }, - /* - *@author: Amjad Amireh - *@Date:13/5/2020 - *@param: - *@return:check if field empty added static value - - *@desc: - */ inputFormatter: ONLY_DATE, onSaved: (value) { - if (_toDateController.text.toString().trim().isEmpty) { + if (_toDateController.text + .toString() + .trim() + .isEmpty) { widget._patientSearchFormValues.To = "0"; } else { - widget._patientSearchFormValues.To = _toDateController.text.replaceAll("/", "-"); + widget._patientSearchFormValues.To = + _toDateController.text.replaceAll("/", "-"); } }, ), diff --git a/lib/widgets/shared/app_buttons_widget.dart b/lib/widgets/shared/app_buttons_widget.dart index 53f4eda4..cc0d054e 100644 --- a/lib/widgets/shared/app_buttons_widget.dart +++ b/lib/widgets/shared/app_buttons_widget.dart @@ -15,7 +15,7 @@ class AppButton extends StatefulWidget { final double fontSize; final double padding; - AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 4}); + AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 5}); _AppButtonState createState() => _AppButtonState(); diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index 03d655ab..332d2219 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -22,7 +22,9 @@ class AppTextFormField extends FormField { FocusNode focusNode, TextInputAction textInputAction, ValueChanged onFieldSubmitted, - IconButton prefix}) + IconButton prefix, + String labelText, + borderColor}) : super( onSaved: onSaved, validator: validator, @@ -42,14 +44,24 @@ class AppTextFormField extends FormField { textInputAction: textInputAction, onFieldSubmitted: onFieldSubmitted, decoration: InputDecoration( - hintText: hintText,suffixIcon: prefix, - hintStyle: TextStyle(fontSize: SizeConfig.textMultiplier * 1.8,), + hintText: hintText, + suffixIcon: prefix, + hintStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.8,), contentPadding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + labelText: labelText, + labelStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7,), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(6)), - borderSide: BorderSide(color: Hexcolor("#CCCCCC")), + borderSide: BorderSide( + color: borderColor != null ? borderColor : Hexcolor( + "#CCCCCC")), ), focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: borderColor != null ? borderColor : Hexcolor( + "#CCCCCC")), borderRadius: BorderRadius.all(Radius.circular(6)), ) //BorderRadius.all(Radius.circular(20));