I have pages in my app that show over 100 items (all gathered from Firebase) and to make it more user friendly, I have a search function on the page.
The search function itself works perfectly fine and uses a custom function (partially written by the AI, adjusted by me).
But there is a weird spacing issue happening in the search results. Basically, it is like all non valid results are still there, but invisible and very small.
The more items are hidden, the bigger the empty space.
On this example, you can see that the space between item 1 and 2 is the biggest. The spacing between item 2 and 3 somewhat less and the spacing between item 4 and 5 (at the bottom) is the way it's meant to be because in the original list, they are also underneath each other.
The custom function is below. Not sure how to fix this spacing issue and whether it's an issue caused by the custom function
bool? showSearchResult(
String? textSearchFor,
String? textSearchInName,
String? textSearchInLocation,
String? textSearchInDescription,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
bool containsValue = false;
containsValue = textSearchInName
?.toLowerCase()
.contains(textSearchFor?.toLowerCase() ?? "") ??
false;
if (containsValue) {
return containsValue;
}
containsValue = textSearchInDescription
?.toLowerCase()
.contains(textSearchFor?.toLowerCase() ?? "") ??
false;
if (containsValue) {
return containsValue;
}
containsValue = textSearchInLocation
?.toLowerCase()
.contains(textSearchFor?.toLowerCase() ?? "") ??
false;
return containsValue;
/// MODIFY CODE ONLY ABOVE THIS LINE
}