baseState method
Widget
baseState(
- NotifierBuilder<
T?> widget, { - Widget onEmptyWidget(
- String? errorMessage
- String? placeholderImagePath,
- String? placeholderEmptyTitle,
- void onReloadTap()?,
Implementation
Widget baseState(
NotifierBuilder<T?> widget, {
Widget Function(String? errorMessage)? onEmptyWidget,
String? placeholderImagePath,
String? placeholderEmptyTitle,
void Function()? onReloadTap,
}) {
return SimpleBuilder(
builder: (_) {
if (status.isLoading ||
status.isEmpty ||
status.isError ||
state.isEmptyOrNull) {
return onEmptyWidget != null
? onEmptyWidget(status.isEmpty
? (placeholderEmptyTitle ?? kEmptyList)
: status.errorMessage)
: BasePlaceholderView(
title: status.isLoading
? null
: (status.isEmpty
? (placeholderEmptyTitle ?? kEmptyList)
: status.errorMessage),
image: placeholderImagePath,
onTap: onReloadTap ??
() {
change(null, status: RxStatus.loading());
onRequestData();
},
);
}
return widget(state);
},
);
}