fix patient_search_screen.dart

merge-requests/244/head
Elham Rababah 5 years ago
parent 0147e7e49b
commit fb035cd4c9

@ -68,21 +68,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
try { try {
/* Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile =
new DoctorProfileModel.fromJson(profile)*/;
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
_formKey.currentState.save(); _formKey.currentState.save();
/* sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType);
String token = await sharedPref.getString(TOKEN);
_patientSearchFormValues.TokenID = token;
_patientSearchFormValues.ProjectID = doctorProfile.projectID; //15
_patientSearchFormValues.DoctorID = doctorProfile.doctorID;
_patientSearchFormValues.ClinicID = doctorProfile.clinicID;*/
if ((_patientSearchFormValues.From == "0" || if ((_patientSearchFormValues.From == "0" ||
_patientSearchFormValues.To == "0") && _patientSearchFormValues.To == "0") &&
_selectedType == "7") { _selectedType == "7") {

@ -59,22 +59,49 @@ class _DynamicElementsState extends State<DynamicElements> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery
.of(context)
.size;
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,
),
)
;
}
return LayoutBuilder( return LayoutBuilder(
builder: (ctx, constraints) { builder: (ctx, constraints) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox(
height: 10,
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, onTap: ()=> _presentDatePicker('_selectedFromDate'),
hintText: TranslationBase.of(context).fromDate, hintText: TranslationBase.of(context).fromDate,
controller: _fromDateController, controller: _fromDateController,
inputFormatter: ONLY_DATE, inputFormatter: ONLY_DATE,
onTap: () {
_presentDatePicker('_selectedFromDate');
},
onSaved: (value) { onSaved: (value) {
if (_fromDateController.text.toString().trim().isEmpty) { if (_fromDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.From = "0"; widget._patientSearchFormValues.From = "0";
@ -82,12 +109,14 @@ class _DynamicElementsState extends State<DynamicElements> {
widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-"); widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-");
} }
}, },
readOnly: true,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, readOnly: true,
hintText: TranslationBase hintText: TranslationBase
.of(context) .of(context)
.toDate, .toDate,

@ -4,10 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
// OWNER : Ibrahim albitar
// DATE : 19-04-2020
// DESCRIPTION : Custom Text Form Field for app.
class AppTextFormField extends FormField<String> { class AppTextFormField extends FormField<String> {
AppTextFormField( AppTextFormField(
{FormFieldSetter<String> onSaved, {FormFieldSetter<String> onSaved,
@ -41,6 +37,7 @@ class AppTextFormField extends FormField<String> {
obscureText: obscureText, obscureText: obscureText,
focusNode: focusNode, focusNode: focusNode,
keyboardType: textInputType, keyboardType: textInputType,
readOnly: readOnly,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow( FilteringTextInputFormatter.allow(
RegExp(inputFormatter)), RegExp(inputFormatter)),

Loading…
Cancel
Save