showToast function

ToastFuture showToast (
  1. String msg,
  2. {BuildContext context,
  3. Duration duration,
  4. ToastPosition position,
  5. TextStyle textStyle,
  6. EdgeInsetsGeometry textPadding,
  7. Color backgroundColor,
  8. double radius,
  9. VoidCallback onDismiss,
  10. TextDirection textDirection,
  11. bool dismissOtherToast,
  12. TextAlign textAlign,
  13. OKToastAnimationBuilder animationBuilder,
  14. Duration animationDuration,
  15. Curve animationCurve}
)

show toast with msg,

Implementation

ToastFuture showToast(
  String msg, {
  BuildContext context,
  Duration duration,
  ToastPosition position,
  TextStyle textStyle,
  EdgeInsetsGeometry textPadding,
  Color backgroundColor,
  double radius,
  VoidCallback onDismiss,
  TextDirection textDirection,
  bool dismissOtherToast,
  TextAlign textAlign,
  OKToastAnimationBuilder animationBuilder,
  Duration animationDuration,
  Curve animationCurve,
}) {
  context ??= _contextMap.values.first;

  final theme = _ToastTheme.of(context);
  textStyle ??= theme.textStyle ?? TextStyle(fontSize: 15.0);
  textAlign ??= theme.textAlign;
  textPadding ??= theme.textPadding;
  position ??= theme.position;
  backgroundColor ??= theme.backgroundColor;
  radius ??= theme.radius;
  textDirection ??= theme.textDirection ?? TextDirection.ltr;

  Widget widget = Container(
    margin: const EdgeInsets.all(50.0),
    decoration: BoxDecoration(
      color: backgroundColor,
      borderRadius: BorderRadius.circular(radius),
    ),
    padding: textPadding,
    child: ClipRect(
      child: Text(
        msg,
        style: textStyle,
        textAlign: textAlign,
      ),
    ),
  );

  return showToastWidget(
    widget,
    animationBuilder: animationBuilder,
    context: context,
    duration: duration,
    onDismiss: onDismiss,
    position: position,
    dismissOtherToast: dismissOtherToast,
    textDirection: textDirection,
    animationCurve: animationCurve,
  );
}