loading method

Widget loading(
  1. NotifierBuilder<T?> widget, {
  2. Widget? onError(
    1. MError? error
    )?,
  3. Widget? onLoading,
  4. double? loadingIndicatorSize,
  5. AlignmentGeometry? alignment,
  6. Widget? onEmpty,
  7. String? emptyText,
  8. WidgetBuilder? onCustom,
  9. bool showLoading = true,
  10. bool showError = true,
  11. bool showEmpty = true,
  12. bool isStateless = false,
})

Implementation

Widget loading(
  NotifierBuilder<T?> widget, {
  Widget? Function(MError? error)? onError,
  Widget? onLoading,
  double? loadingIndicatorSize,
  AlignmentGeometry? alignment,
  Widget? onEmpty,
  String? emptyText,
  WidgetBuilder? onCustom,
  bool showLoading = true,
  bool showError = true,
  bool showEmpty = true,
  bool isStateless = false,
}) {
  showLoading = isStateless ? false : showLoading;
  showError = isStateless ? false : showError;
  showEmpty = isStateless ? false : showEmpty;
  return mobx(
    widget,
    onError: showError ? onError ?? _onError : (error) => Container(),
    onLoading: showLoading
        ? onLoading ??
            _onLoadingIndicator(
              size: loadingIndicatorSize,
              alignment: alignment,
            )
        : Container(),
    onEmpty: showEmpty
        ? onEmpty ??
            _onEmpty(
              emptyText: emptyText,
            )
        : Container(),
    onCustom: onCustom,
  );
}