@ -46,6 +46,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
bool isFormSubmitted = false ;
bool isFormSubmitted = false ;
FocusNode _nodeText1 = FocusNode ( ) ;
FocusNode _nodeText2 = FocusNode ( ) ;
FocusNode _nodeText3 = FocusNode ( ) ;
var _patientSearchFormValues = PatientModel (
var _patientSearchFormValues = PatientModel (
FirstName: " 0 " ,
FirstName: " 0 " ,
MiddleName: " 0 " ,
MiddleName: " 0 " ,
@ -110,374 +114,383 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
projectsProvider = Provider . of ( context ) ;
projectsProvider = Provider . of ( context ) ;
return AppScaffold (
return GestureDetector (
appBarTitle: TranslationBase . of ( context ) . searchPatient ,
onTap: ( ) {
body: ListView (
FocusScope . of ( context ) . requestFocus ( new FocusNode ( ) ) ;
children: < Widget > [
} ,
RoundedContainer (
child: AppScaffold (
child: Column (
appBarTitle: TranslationBase . of ( context ) . searchPatient ,
children: < Widget > [
body: ListView (
Column (
children: < Widget > [
children: < Widget > [
RoundedContainer (
Container (
child: Column (
child: Icon (
children: < Widget > [
DoctorApp . search_patient_1 ,
Column (
size: 100 ,
children: < Widget > [
color: Colors . black ,
Container (
) ,
child: Icon (
margin: EdgeInsets . only ( top: 10 ) ,
DoctorApp . search_patient_1 ,
) ,
size: 100 ,
Padding (
color: Colors . black ,
padding: const EdgeInsets . only ( top: 12.0 ) ,
) ,
child: AppText (
margin: EdgeInsets . only ( top: 10 ) ,
TranslationBase . of ( context )
. searchPatientImageCaptionTitle
. toUpperCase ( ) ,
fontWeight: FontWeight . bold ,
fontSize: SizeConfig . heightMultiplier * 2.5 ,
) ,
) ,
) ,
Padding (
Padding (
padding: const EdgeInsets . only ( top: 12.0 ) ,
padding: const EdgeInsets . only ( top: 5.0 ) ,
child: AppText (
child: AppText (
TranslationBase . of ( context )
TranslationBase . of ( context )
. searchPatientImageCaptionTitle
. searchPatientImageCaptionBody ,
. toUpperCase ( ) ,
fontSize: SizeConfig . heightMultiplier * 2 ,
fontWeight: FontWeight . bold ,
fontSize: SizeConfig . heightMultiplier * 2.5 ,
) ,
) ,
) ,
)
Padding (
] ,
padding: const EdgeInsets . only ( top: 5.0 ) ,
) ,
child: AppText (
Container (
TranslationBase . of ( context )
padding: EdgeInsets . all ( 15 ) ,
. searchPatientImageCaptionBody ,
width: SizeConfig . screenWidth * 1 ,
fontSize: SizeConfig . heightMultiplier * 2 ,
child: Form (
key: _formKey ,
autovalidate: _autoValidate ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
SizedBox (
height: 5 ,
) ,
) ,
Container (
)
height: 40.0 ,
] ,
decoration: ShapeDecoration (
) ,
shape: RoundedRectangleBorder (
Container (
side: BorderSide (
padding: EdgeInsets . all ( 15 ) ,
width: 1.0 ,
width: SizeConfig . screenWidth * 1 ,
style: BorderStyle . solid ,
child: Form (
color: HexColor ( " #CCCCCC " ) ) ,
key: _formKey ,
borderRadius:
autovalidate: _autoValidate ,
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
child: Column (
) ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
SizedBox (
height: 5 ,
) ,
) ,
width: double . infinity ,
Container (
child: Padding (
height: 40.0 ,
padding: EdgeInsets . only (
decoration: ShapeDecoration (
top: SizeConfig . widthMultiplier * 0.9 ,
shape: RoundedRectangleBorder (
bottom: SizeConfig . widthMultiplier * 0.9 ,
side: BorderSide (
right: SizeConfig . widthMultiplier * 3 ,
width: 1.0 ,
left: SizeConfig . widthMultiplier * 3 ) ,
style: BorderStyle . solid ,
child: Row (
color: HexColor ( " #CCCCCC " ) ) ,
mainAxisSize: MainAxisSize . max ,
borderRadius:
children: < Widget > [
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
Expanded (
) ,
/ / add Expanded to have your dropdown button fill remaining space
) ,
child: DropdownButtonHideUnderline (
width: double . infinity ,
child: DropdownButton (
child: Padding (
isExpanded: true ,
padding: EdgeInsets . only (
value: _selectedType ,
top: SizeConfig . widthMultiplier * 0.9 ,
iconSize: 25 ,
bottom: SizeConfig . widthMultiplier * 0.9 ,
elevation: 16 ,
right: SizeConfig . widthMultiplier * 3 ,
selectedItemBuilder:
left: SizeConfig . widthMultiplier * 3 ) ,
( BuildContext context ) {
child: Row (
return PATIENT_TYPE . map ( ( item ) {
mainAxisSize: MainAxisSize . max ,
return Row (
children: < Widget > [
mainAxisSize: MainAxisSize . max ,
Expanded (
children: < Widget > [
/ / add Expanded to have your dropdown button fill remaining space
! projectsProvider . isArabic
child: DropdownButtonHideUnderline (
? AppText (
child: DropdownButton (
item [ ' text ' ] ,
isExpanded: true ,
fontSize: SizeConfig
value: _selectedType ,
. textMultiplier *
iconSize: 25 ,
2.1 ,
elevation: 16 ,
)
selectedItemBuilder:
: AppText (
( BuildContext context ) {
item [ ' text_ar ' ] ,
return PATIENT_TYPE . map ( ( item ) {
fontSize: SizeConfig
return Row (
. textMultiplier *
mainAxisSize: MainAxisSize . max ,
2.1 ,
children: < Widget > [
) ,
! 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 ( ) ;
} ) . 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 ( ) ,
) ) ,
) ,
] ,
) ,
) ,
) ,
) ,
) ,
SizedBox (
SizedBox (
height: 10 ,
height: 10 ,
) ,
) ,
Container (
Container (
decoration: BoxDecoration (
decoration: BoxDecoration (
borderRadius:
borderRadius:
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
border: Border . all (
border: Border . all (
width: 1.0 , color: HexColor ( " #CCCCCC " ) ) ) ,
width: 1.0 , color: HexColor ( " #CCCCCC " ) ) ) ,
padding: EdgeInsets . only ( top: 5 ) ,
padding: EdgeInsets . only ( top: 5 ) ,
child: AppTextFormField (
child: AppTextFormField (
labelText:
labelText:
TranslationBase . of ( context ) . firstName ,
TranslationBase . of ( context ) . firstName ,
borderColor: Colors . white ,
borderColor: Colors . white ,
onSaved: ( value ) {
onSaved: ( value ) {
value = = null | | value = = ' '
value = = null | | value = = ' '
? _patientSearchFormValues . setFirstName =
? _patientSearchFormValues . setFirstName =
" 0 "
" 0 "
: _patientSearchFormValues . setFirstName =
: _patientSearchFormValues . setFirstName =
value ;
value ;
if ( value ! = null & &
if ( value ! = null & &
value . toString ( ) . trim ( ) . isEmpty ) {
value . toString ( ) . trim ( ) . isEmpty ) {
_patientSearchFormValues . setFirstName = " 0 " ;
_patientSearchFormValues . setFirstName = " 0 " ;
}
}
} ,
} ,
/ / validator: ( value ) {
/ / validator: ( value ) {
/ / return TextValidator ( ) . validateName ( value ) ;
/ / return TextValidator ( ) . validateName ( value ) ;
/ / } ,
/ / } ,
inputFormatter: ONLY_LETTERS ) ,
inputFormatter: ONLY_LETTERS ) ,
) ,
) ,
SizedBox (
SizedBox (
height: 10 ,
height: 10 ,
) ,
) ,
Container (
Container (
decoration: BoxDecoration (
decoration: BoxDecoration (
borderRadius:
borderRadius:
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
border: Border . all (
border: Border . all (
width: 1.0 , color: HexColor ( " #CCCCCC " ) ) ) ,
width: 1.0 , color: HexColor ( " #CCCCCC " ) ) ) ,
padding: EdgeInsets . only ( top: 5 ) ,
padding: EdgeInsets . only ( top: 5 ) ,
child: AppTextFormField (
child: AppTextFormField (
labelText:
TranslationBase . of ( context ) . middleName ,
borderColor: Colors . white ,
onSaved: ( value ) {
value = = null | | value = = ' '
? _patientSearchFormValues . setMiddleName =
" 0 "
: _patientSearchFormValues . setMiddleName =
value ;
if ( value ! = null & & value
. toString ( )
. trim ( )
. isEmpty ) {
_patientSearchFormValues . setMiddleName =
" 0 " ;
}
} ,
/ / validator: ( value ) {
/ / return TextValidator ( ) . validateName ( value ) ;
/ / } ,
inputFormatter: ONLY_LETTERS ) ,
) ,
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 ) . lastName ,
borderColor: Colors . white ,
onSaved: ( value ) {
value = = null | | value = = ' '
? _patientSearchFormValues . setLastName =
" 0 "
: _patientSearchFormValues . setLastName =
value ;
if ( value ! = null & & value
. toString ( )
. trim ( )
. isEmpty ) {
_patientSearchFormValues . setLastName = " 0 " ;
}
} ,
inputFormatter: ONLY_LETTERS ) ,
) ,
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:
labelText:
TranslationBase . of ( context ) . middleName ,
TranslationBase . of ( context ) . phoneNumber ,
borderColor: Colors . white ,
onSaved: ( value ) {
value = = null | | value = = ' '
? _patientSearchFormValues . setMiddleName =
" 0 "
: _patientSearchFormValues . setMiddleName =
value ;
if ( value ! = null & & value
. toString ( )
. trim ( )
. isEmpty ) {
_patientSearchFormValues . setMiddleName =
" 0 " ;
}
} ,
/ / validator: ( value ) {
/ / return TextValidator ( ) . validateName ( value ) ;
/ / } ,
inputFormatter: ONLY_LETTERS ) ,
) ,
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 ) . lastName ,
borderColor: Colors . white ,
borderColor: Colors . white ,
textInputType: TextInputType . number ,
textInputAction: TextInputAction . done ,
inputFormatter: ONLY_NUMBERS ,
focusNode: _nodeText1 ,
onSaved: ( value ) {
onSaved: ( value ) {
value = = null | | value = = ' '
value = = null | | value = = ' '
? _patientSearchFormValues . setLastName =
? _patientSearchFormValues
" 0 "
. setPatientMobileNumber = " 0 "
: _patientSearchFormValues . setLastName =
: _patientSearchFormValues
value ;
. setPatientMobileNumber = value ;
if ( value ! = null & & value
if ( value ! = null & & value
. toString ( )
. toString ( )
. trim ( )
. trim ( )
. isEmpty ) {
. isEmpty ) {
_patientSearchFormValues . setLastName = " 0 " ;
_patientSearchFormValues
. setPatientMobileNumber = " 0 " ;
}
}
} ,
} ,
inputFormatter: ONLY_LETTERS ) ,
) ,
) ,
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 ) . phoneNumber ,
borderColor: Colors . white ,
textInputType: TextInputType . number ,
inputFormatter: ONLY_NUMBERS ,
onSaved: ( value ) {
value = = null | | value = = ' '
? _patientSearchFormValues
. setPatientMobileNumber = " 0 "
: _patientSearchFormValues
. setPatientMobileNumber = value ;
if ( value ! = null & & value
. toString ( )
. trim ( )
. isEmpty ) {
_patientSearchFormValues
. setPatientMobileNumber = " 0 " ;
}
} ,
) ,
) ,
) ,
SizedBox (
SizedBox (
height: 10 ,
height: 10 ,
) ,
) ,
Container (
Container (
decoration: BoxDecoration (
decoration: BoxDecoration (
borderRadius:
borderRadius:
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
BorderRadius . all ( Radius . circular ( 6.0 ) ) ,
border: Border . all (
border: Border . all (
width: 1.0 , color: HexColor ( " #CCCCCC " ) ) ) ,
width: 1.0 , color: HexColor ( " #CCCCCC " ) ) ) ,
padding: EdgeInsets . only ( top: 5 ) ,
padding: EdgeInsets . only ( top: 5 ) ,
child: AppTextFormField (
child: AppTextFormField (
labelText:
TranslationBase . of ( context ) . patientID ,
borderColor: Colors . white ,
textInputType: TextInputType . number ,
inputFormatter: ONLY_NUMBERS ,
focusNode: _nodeText2 ,
onSaved: ( value ) {
value = = null | | value = = ' '
? _patientSearchFormValues . setPatientID =
0
: _patientSearchFormValues . setPatientID =
int . parse ( value ) ;
if ( value ! = null & & value
. trim ( )
. toString ( )
. isEmpty ) {
_patientSearchFormValues . setPatientID = 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:
labelText:
TranslationBase . of ( context ) . patientID ,
TranslationBase . of ( context ) . patient File ,
borderColor: Colors . white ,
borderColor: Colors . white ,
textInputType: TextInputType . number ,
textInputType: TextInputType . number ,
focusNode: _nodeText3 ,
inputFormatter: ONLY_NUMBERS ,
inputFormatter: ONLY_NUMBERS ,
onSaved: ( value ) {
onSaved: ( value ) { } ,
value = = null | | value = = ' '
) ,
? _patientSearchFormValues . setPatientID =
0
: _patientSearchFormValues . setPatientID =
int . parse ( value ) ;
if ( value ! = null & & value
. trim ( )
. toString ( )
. isEmpty ) {
_patientSearchFormValues . setPatientID = 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 ) . patientFile ,
borderColor: Colors . white ,
textInputType: TextInputType . number ,
inputFormatter: ONLY_NUMBERS ,
onSaved: ( value ) { } ,
) ,
) ,
) ,
( ! ( _selectedType = = ' 2 ' | | _selectedType = = ' 4 ' ) )
( ! ( _selectedType = = ' 2 ' | | _selectedType = = ' 4 ' ) )
? DynamicElements ( _patientSearchFormValues , isFormSubmitted )
? DynamicElements ( _patientSearchFormValues , isFormSubmitted )
: SizedBox (
: SizedBox (
height: 0 ,
height: 0 ,
) ,
) ,
SizedBox (
SizedBox (
height: 10 ,
height: 10 ,
) ,
) ,
SizedBox (
SizedBox (
height: 10 ,
height: 10 ,
) ,
) ,
Container (
Container (
child: Row (
child: Row (
mainAxisAlignment: MainAxisAlignment . start ,
mainAxisAlignment: MainAxisAlignment . start ,
children: < Widget > [
children: < Widget > [
Container (
Container (
decoration: BoxDecoration (
decoration: BoxDecoration (
borderRadius: BorderRadius . all (
borderRadius: BorderRadius . all (
Radius . circular ( 6.0 ) ) ,
Radius . circular ( 6.0 ) ) ,
border: Border . all (
border: Border . all (
width: 1.0 ,
width: 1.0 ,
color: HexColor ( " #CCCCCC " ) ) ) ,
color: HexColor ( " #CCCCCC " ) ) ) ,
height: 25 ,
height : 25 ,
width: 25 ,
width: 25 ,
child: Checkbox (
child: Checkbox (
value: onlyArrived ,
value: onlyArrived ,
checkColor: HexColor ( " #2A930A " ) ,
checkColor: HexColor ( " #2A930A " ) ,
activeColor: Colors . white ,
activeColor: Colors . white ,
onChanged: ( bool newValue ) {
onChanged: ( bool newValue ) {
setState ( ( ) {
setState ( ( ) {
onlyArrived = newValue ;
onlyArrived = newValue ;
} ) ;
} ) ;
} ) ,
} ) ,
) ,
) ,
SizedBox (
SizedBox (
width: 12 ,
width: 12 ,
) ,
) ,
AppText (
AppText (
TranslationBase . of ( context )
TranslationBase . of ( context )
. onlyArrivedPatient ,
. onlyArrivedPatient ,
fontSize: SizeConfig . textMultiplier * 2 ) ,
fontSize: SizeConfig . textMultiplier * 2 ) ,
] ) ) ,
] ) ) ,
SizedBox (
SizedBox (
height: 10 ,
height: 10 ,
) ,
) ,
] ,
] ,
) ,
) ,
) ,
) ,
)
)
],
] ,
) ,
) ,
) ,
) ,
Container (
Container (
margin: EdgeInsets . all ( SizeConfig . widthMultiplier * 5 ) ,
margin: EdgeInsets . all ( SizeConfig . widthMultiplier * 5 ) ,
child: Wrap (
child: Wrap (
alignment: WrapAlignment . center ,
alignment: WrapAlignment . center ,
children: < Widget > [
children: < Widget > [
AppButton (
AppButton (
title: TranslationBase . of ( context ) . search ,
title: TranslationBase . of ( context ) . search ,
onPressed: ( ) {
onPressed: ( ) {
_validateInputs ( ) ;
_validateInputs ( ) ;
} ,
} ,
) ,
) ,
] ,
] ,
) ,
) ,
) ,
) ,
] ,
] ,
)) ,
) ) ;
) ;
}
}
}
}