showUpToast function

dynamic showUpToast({
  1. required BuildContext context,
  2. required String text,
  3. UpStyle? style,
  4. UpColorType? upColorType,
  5. bool isRounded = false,
  6. double borderRadius = 25.0,
  7. UpToastType upToastType = UpToastType.primary,
  8. EdgeInsetsGeometry? padding,
  9. Icon? icon,
  10. Duration? duration,
  11. double width = 300,
  12. double? height,
})

Implementation

showUpToast({
  required BuildContext context,
  required String text,
  UpStyle? style,
  UpColorType? upColorType,
  bool isRounded = false,
  double borderRadius = 25.0,
  UpToastType upToastType = UpToastType.primary,
  EdgeInsetsGeometry? padding,
  Icon? icon,
  Duration? duration,
  double width = 300,
  double? height,
}) {
  try {
    // FlutterToastr.show(text, context);

    removeAllQueuedToasts();
    fToast.init(context);

    fToast.showToast(
      child: _upToast(
        context,
        style,
        upColorType,
        text,
        isRounded,
        borderRadius,
        upToastType,
        icon,
        padding,
        width,
        height,
      ),

      gravity: ToastGravity.BOTTOM,
      toastDuration: duration ?? const Duration(seconds: 2),
      // positionedToastBuilder: (context, child) {
      //   return Positioned(
      //     child: child,
      //     top: 16.0,
      //     left: 16.0,
      //   );
      // }
    );
  } catch (e) {
    upConsole(UpConsoleLevel.error, e.toString());
  }
}