showText static method

CancelFunc showText({
  1. required String text,
  2. WrapAnimation? wrapAnimation = nilWrapAnimation,
  3. WrapAnimation? wrapToastAnimation = nilWrapAnimation,
  4. Color backgroundColor = nilColor,
  5. Color contentColor = nilColor,
  6. BorderRadiusGeometry borderRadius = nilBorderRadius,
  7. TextStyle textStyle = nilTextStyle,
  8. AlignmentGeometry? align = nilAlignment,
  9. EdgeInsetsGeometry contentPadding = nilEdgeInsets,
  10. Duration? duration = nilDuration,
  11. Duration? animationDuration = nilDuration,
  12. Duration? animationReverseDuration = nilDuration,
  13. BackButtonBehavior? backButtonBehavior = nilBackButtonBehavior,
  14. VoidCallback? onClose = nilVoidCallback,
  15. Object enableKeyboardSafeArea = nil,
  16. Object clickClose = nil,
  17. Object crossPage = nil,
  18. Object onlyOne = nil,
})

Display a standard text Toast. text - The text to be displayed. contentColor - Background color of the ToastContent area. borderRadius - BorderRadius of the ToastContent area. textStyle - Text style. contentPadding - Padding of the ToastContent area. align - Alignment of the ToastContent area within the MainContent area. wrapAnimation - See showAnimationWidget.wrapAnimation, default value is null. wrapToastAnimation - See showAnimationWidget.wrapToastAnimation, default value is textAnimation. animationDuration - See showAnimationWidget.animationDuration. animationReverseDuration - See showAnimationWidget.animationReverseDuration. backgroundColor - See showEnhancedWidget.backgroundColor. duration - See showEnhancedWidget.duration. onlyOne - See showEnhancedWidget.onlyOne. clickClose - See showEnhancedWidget.clickClose. crossPage - See showEnhancedWidget.crossPage. onClose - See showEnhancedWidget.onClose. backButtonBehavior - See showEnhancedWidget.backButtonBehavior. enableKeyboardSafeArea - See showEnhancedWidget.enableKeyboardSafeArea.

显示一个标准文本Toast text 需要显示的文本 contentColor ToastContent区域背景颜色 borderRadius ToastContent区域圆角 textStyle 字体样式 contentPadding ToastContent区域的内补 align ToastContent区域在MainContent区域的对齐 wrapAnimation 请看showAnimationWidget.wrapAnimation,默认值为null wrapToastAnimation 请看showAnimationWidget.wrapToastAnimation,默认值为textAnimation animationDuration 请看showAnimationWidget.animationDuration animationReverseDuration 请看showAnimationWidget.animationReverseDuration backgroundColor 请看showEnhancedWidget.backgroundColor duration 请看showEnhancedWidget.duration onlyOne 请看showEnhancedWidget.onlyOne clickClose 请看showEnhancedWidget.clickClose crossPage 请看showEnhancedWidget.crossPage onClose 请看showEnhancedWidget.onClose backButtonBehavior 请看showEnhancedWidget.backButtonBehavior enableKeyboardSafeArea 请看showEnhancedWidget.enableKeyboardSafeArea

Implementation

static CancelFunc showText({
  required String text,
  WrapAnimation? wrapAnimation = nilWrapAnimation,
  WrapAnimation? wrapToastAnimation = nilWrapAnimation,
  Color backgroundColor = nilColor,
  Color contentColor = nilColor,
  BorderRadiusGeometry borderRadius = nilBorderRadius,
  TextStyle textStyle = nilTextStyle,
  AlignmentGeometry? align = nilAlignment,
  EdgeInsetsGeometry contentPadding = nilEdgeInsets,
  Duration? duration = nilDuration,
  Duration? animationDuration = nilDuration,
  Duration? animationReverseDuration = nilDuration,
  BackButtonBehavior? backButtonBehavior = nilBackButtonBehavior,
  VoidCallback? onClose = nilVoidCallback,
  /*bool*/ Object enableKeyboardSafeArea = nil,
  /*bool*/ Object clickClose = nil,
  /*bool*/ Object crossPage = nil,
  /*bool*/ Object onlyOne = nil,
}) {
  var o = defaultOption.text;

  wrapAnimation = returnFirstIfNotNil(wrapAnimation, o.wrapAnimation);
  wrapToastAnimation = returnFirstIfNotNil(wrapToastAnimation, o.wrapToastAnimation);
  backgroundColor = returnFirstIfNotNil(backgroundColor, o.backgroundColor);
  contentColor = returnFirstIfNotNil(contentColor, o.contentColor);
  borderRadius = returnFirstIfNotNil(borderRadius, o.borderRadius);
  textStyle = returnFirstIfNotNil(textStyle, o.textStyle);
  align = returnFirstIfNotNil(align, o.align);
  contentPadding = returnFirstIfNotNil(contentPadding, o.contentPadding);
  duration = returnFirstIfNotNil(duration, o.duration);
  animationDuration = returnFirstIfNotNil(animationDuration, o.animationDuration);
  animationReverseDuration = returnFirstIfNotNil(animationReverseDuration, o.animationReverseDuration);
  backButtonBehavior = returnFirstIfNotNil(backButtonBehavior, o.backButtonBehavior);
  onClose = returnFirstIfNotNil(onClose, o.onClose);
  enableKeyboardSafeArea = returnFirstIfNotNil(enableKeyboardSafeArea, o.enableKeyboardSafeArea);
  clickClose = returnFirstIfNotNil(clickClose, o.clickClose);
  crossPage = returnFirstIfNotNil(crossPage, o.crossPage);
  onlyOne = returnFirstIfNotNil(onlyOne, o.onlyOne);

  assert(isNilOr<bool>([enableKeyboardSafeArea, clickClose, crossPage, onlyOne]), 'Must be of bool type');

  return showCustomText(
      wrapAnimation: wrapAnimation,
      wrapToastAnimation: wrapToastAnimation,
      duration: duration,
      animationDuration: animationDuration,
      animationReverseDuration: animationReverseDuration,
      crossPage: crossPage,
      backgroundColor: backgroundColor,
      clickClose: clickClose,
      backButtonBehavior: backButtonBehavior,
      onClose: onClose,
      enableKeyboardSafeArea: enableKeyboardSafeArea,
      ignoreContentClick: true,
      onlyOne: onlyOne,
      align: align,
      toastBuilder: (_) => TextToast(
            contentPadding: contentPadding,
            contentColor: contentColor,
            borderRadius: borderRadius,
            textStyle: textStyle,
            text: text,
          ));
}