baseState method

Widget baseState(
  1. NotifierBuilder<T?> widget, {
  2. Widget onPlaceholderWidget()?,
  3. String? placeholderEmptyImagePath,
  4. String? placeholderEmptyTitle,
  5. String? placeholderEmptyMessage,
  6. void onReloadTap()?,
})

Implementation

Widget baseState(
  NotifierBuilder<T?> widget, {
  Widget Function()? onPlaceholderWidget,
  String? placeholderEmptyImagePath,
  String? placeholderEmptyTitle,
  String? placeholderEmptyMessage,
  void Function()? onReloadTap,
}) {
  return SimpleBuilder(
    builder: (_) {
      if (status.isLoading ||
          status.isEmpty ||
          status.isError ||
          state.isEmptyOrNull) {
        return onPlaceholderWidget != null
            ? onPlaceholderWidget()
            : BasePlaceholderView(
                title: getPlaceholderTitle(placeholderEmptyTitle),
                message: getPlaceholderMessage(placeholderEmptyMessage),
                image: placeholderEmptyImagePath,
                onTap: onReloadTap ??
                    () {
                      change(null, status: RxStatus.loading());
                      onRequestData();
                    },
              );
      }
      return widget(state);
    },
  );
}