resolveEmptyStateProperty function
EndlessStateProperty
resolveEmptyStateProperty({
- required PaginatedSearchBarBuilderStateProperty? emptyBuilderState,
- required Widget? emptyBuilder(
- BuildContext context
- required PaginatedSearchBarBuilderStateProperty? placeholderBuilderState,
- required Widget? placeholderBuilder(
- BuildContext context
- required Set<
PaginatedSearchBarState> searchBarStates, - required bool hasResolvedFirstSearchAboveMinLength,
Implementation
EndlessStateProperty resolveEmptyStateProperty({
required PaginatedSearchBarBuilderStateProperty? emptyBuilderState,
required Widget? Function(BuildContext context)? emptyBuilder,
required PaginatedSearchBarBuilderStateProperty? placeholderBuilderState,
required Widget? Function(BuildContext context)? placeholderBuilder,
required Set<PaginatedSearchBarState> searchBarStates,
required bool hasResolvedFirstSearchAboveMinLength,
}) {
return EndlessStateProperty.resolveWith(
(context, listStates) {
final newSearchBarStates = resolveSearchStates(
listStates: listStates,
isFocused: searchBarStates.contains(PaginatedSearchBarState.focused),
);
if (hasResolvedFirstSearchAboveMinLength) {
if (emptyBuilderState != null) {
return emptyBuilderState.resolve(
context,
newSearchBarStates,
);
}
if (emptyBuilder != null) {
return emptyBuilder(context);
}
return null;
}
if (placeholderBuilderState != null) {
return placeholderBuilderState.resolve(
context,
newSearchBarStates,
);
}
if (placeholderBuilder != null) {
return placeholderBuilder(context);
}
},
);
}