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;
},
),
(!(_selectedType == '3' || _selectedType == '5'))
(!(_selectedType == '2' || _selectedType == '4'))
? DynamicElements(_patientSearchFormValues)
: SizedBox(
height: 0,

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

Loading…
Cancel
Save