resolveLoadingStateProperty function
EndlessStateProperty
resolveLoadingStateProperty({
- required PaginatedSearchBarBuilderStateProperty? loadingBuilderState,
- required Widget? loadingBuilder(
- BuildContext context
- required Set<
PaginatedSearchBarState> searchBarStates,
Implementation
EndlessStateProperty resolveLoadingStateProperty({
required PaginatedSearchBarBuilderStateProperty? loadingBuilderState,
required Widget? Function(BuildContext context)? loadingBuilder,
required Set<PaginatedSearchBarState> searchBarStates,
}) {
return EndlessStateProperty.resolveWith(
(context, listStates) {
final newSearchBarStates = resolveSearchStates(
listStates: listStates,
isFocused: searchBarStates.contains(PaginatedSearchBarState.focused),
);
if (loadingBuilderState != null) {
return loadingBuilderState.resolve(context, newSearchBarStates);
}
if (newSearchBarStates.contains(PaginatedSearchBarState.loading) &&
!newSearchBarStates.contains(PaginatedSearchBarState.searching)) {
if (loadingBuilder != null) {
return loadingBuilder(context);
}
return const EndlessDefaultLoadingIndicator();
}
return null;
},
);
}