diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 591d3059..82a8a341 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -241,7 +241,7 @@ class _PatientSearchScreenState extends State { //_patientSearchFormValues. = value; }, ), - (!(_selectedType == '3' || _selectedType == '5')) + (!(_selectedType == '2' || _selectedType == '4')) ? DynamicElements(_patientSearchFormValues) : SizedBox( height: 0, diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index f49e4417..91c15022 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -33,8 +33,19 @@ class PatientsScreen extends StatefulWidget { class _PatientsScreenState extends State { List litems; + // final List parsed; + List parsed; + //********** + List date; + List unfilterDate; + //*********** List responseModelList; + List responseModelList2; + + + + List _locations = ['Today', 'Tomorrow', 'Next Week']; int _activeLocation = 0; @@ -60,7 +71,7 @@ class _PatientsScreenState extends State { 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 { 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 { _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 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 { 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: [ Container( child: litems == null ? Column() - : Column( + : + Column( children: [ Padding( padding: EdgeInsets.only( @@ -111,50 +159,56 @@ class _PatientsScreenState extends State { 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: [ - 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: [ + 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(), + ), ), ], ))