Closed WaseemAbbasi22 closed 1 year ago
i need full object value i tried to change the type from string to dynamic but nothing changed alwasy got null values
onSuggestionTap: (SearchFieldListItem
print('selected item i got is ${selectedItem.item}');
},
i got null value
Hi @WaseemAbbasi22, Thanks for filing the issue. I see the issue in your code, you are not passing item parameters to SearchFieldListItem
return filter
.map((e) => SearchFieldListItem<String>(
item: e, // Pass the object you want to receive for the list item
searchLabel != null ? e.fullName : e.name!,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 4.0, horizontal: 5.0),
child: Text(searchLabel != null ? e.fullName : e.name!,
style: AppStyle.lightDarkTextStyle.copyWith(
fontSize: 1.8.h, fontWeight: FontWeight.normal)),
)))
.toList();
See this complete example for more details https://github.com/maheshmnj/searchfield/blob/master/example/lib/country_search.dart
Additionally I have updated the doc comments a little bit to clarify this.
Let me know if you have any further questions.
Thanks alot i got the point
I am using this package to show the dynamic list of object but it's just setting the value in the controller i didnot get back the suggestion tapped value onSuggestionCall give null value always
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Actual behavior What you actually saw instead of the expected behavior.
Screenshots If applicable, add screenshots to help explain your problem.
Code sample
Show code sample
```dart class LocationSearchAbleTextField extends StatelessWidget { final TextEditingController controller; final Function(dynamic val) onSuggestionItemTap; final ListAdditional context Add any other context about the problem here.