Search filter name

merge-requests/45/head
Amjad Amireh 5 years ago
parent 96d3201ccc
commit 8457cbd5c3

@ -241,7 +241,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
//_patientSearchFormValues. = value; //_patientSearchFormValues. = value;
}, },
), ),
(!(_selectedType == '3' || _selectedType == '5')) (!(_selectedType == '2' || _selectedType == '4'))
? DynamicElements(_patientSearchFormValues) ? DynamicElements(_patientSearchFormValues)
: SizedBox( : SizedBox(
height: 0, height: 0,

@ -33,8 +33,19 @@ class PatientsScreen extends StatefulWidget {
class _PatientsScreenState extends State<PatientsScreen> { class _PatientsScreenState extends State<PatientsScreen> {
List<dynamic> litems; List<dynamic> litems;
// final List parsed;
List parsed;
//**********
List date;
List unfilterDate;
//***********
List<PatiantInformtion> responseModelList; List<PatiantInformtion> responseModelList;
List<PatiantInformtion> responseModelList2;
List<String> _locations = ['Today', 'Tomorrow', 'Next Week']; List<String> _locations = ['Today', 'Tomorrow', 'Next Week'];
int _activeLocation = 0; int _activeLocation = 0;
@ -60,7 +71,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
patientType = routeArgs['selectedType']; patientType = routeArgs['selectedType'];
patientTypetitle = SERVICES_PATIANT_HEADER[int.parse(patientType)]; patientTypetitle = SERVICES_PATIANT_HEADER[int.parse(patientType)];
print("**************patiant Type**************");
print(patientType); print(patientType);
if (_isInit) { if (_isInit) {
@ -71,9 +82,10 @@ class _PatientsScreenState extends State<PatientsScreen> {
int val2 = int.parse(patientType); int val2 = int.parse(patientType);
litems = res[SERVICES_PATIANT2[val2]]; litems = res[SERVICES_PATIANT2[val2]];
final List parsed = litems; parsed = litems;
responseModelList = new ModelResponse.fromJson(parsed).list; responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList2=responseModelList;
//******************** //********************
_isLoading = false; _isLoading = false;
_hasError = res['ErrorEndUserMessage']; _hasError = res['ErrorEndUserMessage'];
@ -86,6 +98,40 @@ class _PatientsScreenState extends State<PatientsScreen> {
_isInit = false; _isInit = false;
super.didChangeDependencies(); super.didChangeDependencies();
} }
/*
*@author: Amjad Amireh
*@Date:2/5/2020
*@param:
*@return:PatientsScreen Search textbox
*@desc:
*/
searchData(String str) {
var strExist = str.length > 0 ? true : false;
if (strExist) {
List<PatiantInformtion> filterData=[] ;
for (var i = 0; i < responseModelList2.length; i++) {
String firstName = responseModelList[i].firstName.toUpperCase();
String lastName = responseModelList[i].lastName.toUpperCase();
if (firstName.contains(str.toUpperCase())||lastName.contains(str.toUpperCase())) {
print("==========data done===========");
filterData.add(responseModelList[i]);
}
}
setState(() {
print("==========data good===========");
this.responseModelList = filterData;
});
} else {
setState(() {
print("==========no data===========");
this.responseModelList =this.responseModelList2;
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -95,11 +141,13 @@ class _PatientsScreenState extends State<PatientsScreen> {
appBarTitle: patientTypetitle, appBarTitle: patientTypetitle,
//***********Modify by amjad (create List view to insert all new data webservise in scroll )************* //***********Modify by amjad (create List view to insert all new data webservise in scroll )*************
body: Container( body: Container(
// margin: EdgeInsets.all(20),
child: ListView(scrollDirection: Axis.vertical, children: <Widget>[ child: ListView(scrollDirection: Axis.vertical, children: <Widget>[
Container( Container(
child: litems == null child: litems == null
? Column() ? Column()
: Column( :
Column(
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@ -111,50 +159,56 @@ class _PatientsScreenState extends State<PatientsScreen> {
width: SizeConfig.screenWidth * 0.80, width: SizeConfig.screenWidth * 0.80,
child: TextField( child: TextField(
controller: _controller, controller: _controller,
onSubmitted: (value) {
// fetch all the news related to the keyword onChanged: (String str){
if (value.isNotEmpty) { // print(str);
// vm.search(value); this.searchData(str);
}
}, },
decoration: decoration:
buildInputDecoration(context, 'Search patiant'), buildInputDecoration(context, 'Search patiant'),
), ),
), ),
Column( Container(
children: margin: EdgeInsets.fromLTRB(15, 0, 15, 0),
responseModelList.map((PatiantInformtion item) { child: Column(
return InkWell(
child: CardWithBgWidget( children:
widget: Column( responseModelList.map((PatiantInformtion item) {
crossAxisAlignment: CrossAxisAlignment.start, return InkWell(
children: <Widget>[ child: CardWithBgWidget(
AppText(
item.nationalityName, widget: Column(
fontSize: 2.5 * SizeConfig.textMultiplier,
), crossAxisAlignment: CrossAxisAlignment.start,
SizedBox( children: <Widget>[
height: 8, AppText(
), item.firstName,
AppText(item.lastName, fontSize: 2.5 * SizeConfig.textMultiplier,
fontSize: ),
2.5 * SizeConfig.textMultiplier), SizedBox(
SizedBox( height: 8,
height: 8, ),
), AppText(item.lastName,
AppText(item.middleName, fontSize:
fontSize: 2.5 * SizeConfig.textMultiplier),
2.5 * SizeConfig.textMultiplier), SizedBox(
], height: 8,
),
AppText(item.middleName,
fontSize:
2.5 * SizeConfig.textMultiplier),
],
),
), ),
), onTap: () {
onTap: () { Navigator.of(context).pushNamed(
Navigator.of(context).pushNamed( PATIENTS_PROFILE,
PATIENTS_PROFILE, arguments: {"patient": item});
arguments: {"patient": item}); },
}, );
); }).toList(),
}).toList(), ),
), ),
], ],
)) ))

Loading…
Cancel
Save