showLoading<T> static method

Future<T?> showLoading<T>({
  1. String msg = 'loading...',
  2. SmartDialogController? controller,
  3. Alignment? alignment,
  4. bool? clickMaskDismiss,
  5. SmartAnimationType? animationType,
  6. List<SmartNonAnimationType>? nonAnimationTypes,
  7. AnimationBuilder? animationBuilder,
  8. bool? usePenetrate,
  9. bool? useAnimation,
  10. Duration? animationTime,
  11. Color? maskColor,
  12. Widget? maskWidget,
  13. VoidCallback? onDismiss,
  14. VoidCallback? onMask,
  15. Duration? displayTime,
  16. bool? backDismiss,
  17. WidgetBuilder? builder,
})

loading dialog

msg:loading msg (Use the builder param, this param will be invalid)

controller:this controller can be used to refresh the layout of the custom loading

alignment:control the location of the dialog, For details, please refer to the description of alignment parameters in SmartConfigLoading

clickMaskDismiss:true(loading will be closed after click mask),false(not close)

animationType:For details, please refer to the SmartAnimationType comment

nonAnimationTypes:For different scenes, the pop-up animation can be dynamically closed. For details, please refer to SmartNonAnimationType

animationBuilder:Support highly custom animation, please refer to AnimationBuilder description for details

usePenetrate:true(the click event will penetrate mask), false(not penetration)

useAnimation:true(use the animation),false(not use)

animationTime:animation duration

maskColor:the color of the mask,it is invalid if maskWidget set the value

maskWidget:highly customizable mask

onDismiss:This callback will be triggered when the dialog is closed

onMask:This callback will be triggered when the mask is clicked

displayTime:Controls the display time of the dialog on the screen; the default is null, if it is null, it means that the param will not control the dialog to close

backDismiss:true(the back event will close the loading but not close the page), false(the back event not close the loading and not close page), you still can use the dismiss method to close the loading

builder:the custom loading

loading弹窗

msg:loading 的信息(使用builder参数,该参数将失效)

controller:可使用该控制器来刷新自定义的loading的布局

alignment:控制弹窗的位置, 详细请参照SmartConfigLoading中alignment参数说明

clickMaskDismiss:true(点击遮罩后,将关闭loading),false(不关闭)

animationType:具体可参照SmartAnimationType注释

nonAnimationTypes:对于不同的场景, 可动态关闭弹窗动画, 具体请参照SmartNonAnimationType

animationBuilder:支持高度自定义动画, 具体可参照AnimationBuilder说明

usePenetrate:true(点击事件将穿透遮罩),false(不穿透)

useAnimation:true(使用动画),false(不使用)

animationTime:动画持续时间

maskColor:遮罩颜色,如果给maskWidget设置了值,该参数将会失效

maskWidget:可高度定制遮罩

onDismiss:在dialog被关闭的时候,该回调将会被触发

onMask:点击遮罩时,该回调将会被触发

displayTime:控制弹窗在屏幕上显示时间; 默认为null, 为null则代表该参数不会控制弹窗关闭

backDismiss:true(返回事件将关闭loading,但是不会关闭页面),false(返回事件不会关闭loading,也不会关闭页面), 你仍然可以使用dismiss方法来关闭loading

builder:自定义loading

Implementation

static Future<T?> showLoading<T>({
  String msg = 'loading...',
  SmartDialogController? controller,
  Alignment? alignment,
  bool? clickMaskDismiss,
  SmartAnimationType? animationType,
  List<SmartNonAnimationType>? nonAnimationTypes,
  AnimationBuilder? animationBuilder,
  bool? usePenetrate,
  bool? useAnimation,
  Duration? animationTime,
  Color? maskColor,
  Widget? maskWidget,
  VoidCallback? onDismiss,
  VoidCallback? onMask,
  Duration? displayTime,
  bool? backDismiss,
  WidgetBuilder? builder,
}) {
  return DialogProxy.instance.showLoading<T>(
    widget: DialogScope(
      controller: controller,
      builder: (context) {
        return builder != null
            ? builder(context)
            : DialogProxy.instance.loadingBuilder(msg);
      },
    ),
    alignment: alignment ?? config.loading.alignment,
    clickMaskDismiss: clickMaskDismiss ?? config.loading.clickMaskDismiss,
    animationType: animationType ?? config.loading.animationType,
    nonAnimationTypes: nonAnimationTypes ?? config.loading.nonAnimationTypes,
    animationBuilder: animationBuilder,
    usePenetrate: usePenetrate ?? config.loading.usePenetrate,
    useAnimation: useAnimation ?? config.loading.useAnimation,
    animationTime: animationTime ?? config.loading.animationTime,
    maskColor: maskColor ?? config.loading.maskColor,
    maskWidget: maskWidget ?? config.loading.maskWidget,
    onDismiss: onDismiss,
    onMask: onMask,
    displayTime: displayTime,
    backDismiss: backDismiss ?? config.loading.backDismiss,
  );
}