loading static method

String loading(
  1. String message, {
  2. String? title,
  3. ToastrPosition? position,
  4. ToastrShowMethod? showMethod,
  5. ToastrHideMethod? hideMethod,
  6. Duration? showDuration,
  7. Duration? hideDuration,
  8. bool? showCloseButton,
  9. VoidCallback? onTap,
  10. VoidCallback? onDismiss,
  11. Widget? content,
  12. double? maxWidth,
  13. EdgeInsets? margin,
  14. Color? accentColor,
  15. BoxDecoration? containerDecoration,
  16. ToastrTheme? theme,
  17. ToastrAction? action,
  18. bool? enableHapticFeedback,
  19. HapticFeedbackType? hapticFeedbackType,
  20. SwipeDismissDirection? swipeDismissDirection,
  21. Widget enterAnimationBuilder(
    1. Widget child,
    2. Animation<double> animation
    )?,
  22. Widget exitAnimationBuilder(
    1. Widget child,
    2. Animation<double> animation
    )?,
  23. bool? compact,
  24. BorderRadius? borderRadius,
  25. bool? avoidKeyboard,
  26. double? stackOverlap,
  27. bool? showCircularProgress,
  28. double? gutter,
  29. ToastrIconTheme? iconTheme,
})

Show a loading toastr with an animated spinner.

Loading toasts persist until manually dismissed or updated. Returns the toast ID — use it with dismiss or update.

final id = Toastr.loading('Uploading...');
await uploadFile();
Toastr.dismiss(id);

Implementation

static String loading(
  String message, {
  String? title,
  ToastrPosition? position,
  ToastrShowMethod? showMethod,
  ToastrHideMethod? hideMethod,
  Duration? showDuration,
  Duration? hideDuration,
  bool? showCloseButton,
  VoidCallback? onTap,
  VoidCallback? onDismiss,
  Widget? content,
  double? maxWidth,
  EdgeInsets? margin,
  Color? accentColor,
  BoxDecoration? containerDecoration,
  ToastrTheme? theme,
  ToastrAction? action,
  bool? enableHapticFeedback,
  HapticFeedbackType? hapticFeedbackType,
  SwipeDismissDirection? swipeDismissDirection,
  Widget Function(Widget child, Animation<double> animation)? enterAnimationBuilder,
  Widget Function(Widget child, Animation<double> animation)? exitAnimationBuilder,
  bool? compact,
  BorderRadius? borderRadius,
  bool? avoidKeyboard,
  double? stackOverlap,
  bool? showCircularProgress,
  double? gutter,
  ToastrIconTheme? iconTheme,
}) =>
    _showWithOptions(
      ToastrType.loading,
      message,
      title: title,
      duration: const Duration(days: 365),
      position: position,
      showMethod: showMethod,
      hideMethod: hideMethod,
      showDuration: showDuration,
      hideDuration: hideDuration,
      showProgressBar: false,
      showCloseButton: showCloseButton ?? false,
      preventDuplicates: false,
      onTap: onTap,
      onDismiss: onDismiss,
      content: content,
      maxWidth: maxWidth,
      margin: margin,
      accentColor: accentColor,
      containerDecoration: containerDecoration,
      theme: theme,
      action: action,
      enableHapticFeedback: enableHapticFeedback,
      hapticFeedbackType: hapticFeedbackType,
      swipeDismissDirection: swipeDismissDirection,
      enterAnimationBuilder: enterAnimationBuilder,
      exitAnimationBuilder: exitAnimationBuilder,
      compact: compact,
      borderRadius: borderRadius,
      avoidKeyboard: avoidKeyboard,
      stackOverlap: stackOverlap,
      showCircularProgress: showCircularProgress,
      gutter: gutter,
      iconTheme: iconTheme,
    );