buildRefreshNoDataWidget function

Widget buildRefreshNoDataWidget(
  1. {BaseViewState viewState,
  2. Widget busyWidget,
  3. ViewStateWidgetBuilder emptyWidgetBuilder,
  4. ViewStateWidgetBuilder errorWidgetBuilder,
  5. bool showErrorWidget = true,
  6. bool showEmptyWidget = true,
  7. bool showBusyWidget = true}
)

Implementation

Widget buildRefreshNoDataWidget({BaseViewState viewState, Widget busyWidget, ViewStateWidgetBuilder emptyWidgetBuilder,  ViewStateWidgetBuilder errorWidgetBuilder, bool showErrorWidget = true, bool showEmptyWidget = true, bool showBusyWidget = true}){
  if(viewState.isError){
    if(viewState.httpError?.httpErrorType == HttpErrorType.EmptyDataError && showEmptyWidget){
      if(emptyWidgetBuilder != null){
        return emptyWidgetBuilder.call(viewState);
      }else {
        return emptyWidget.call(viewState);
      }
    }else{
      if(showErrorWidget){
        if(emptyWidgetBuilder != null){
          return errorWidgetBuilder.call(viewState);
        }else {
          return errorWidget.call(viewState);
        }
      }else{
        return null;
      }
    }
  }else if (viewState.isBusy && showBusyWidget) {
    return busyWidget??pageLoading;
  }else{
    return null;
  }
}