sososdk / flash

⚡️A highly customizable, powerful and easy-to-use alerting library for Flutter.

Home Page:https://sososdk.github.io/flash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

showToast in center or any other location

kevzzsk opened this issue · comments

How do you showToast in any other location?

Currently context.showToast() places the toast at a weird between center to bottom location.

edit:
Okay found a way to adjust the alignment with:

// Wrap with toast.
    child = Toast(
      child: child,
      navigatorKey: navigatorKey,
      alignment: Alignment.topCenter,
    );

but this works only on the init, so it is currently not possible to change the alignment on showToast. maybe add optional argument in showToast to specify the location of toast?

If this sounds good, I can send a PR

I added some optional parameters for 'Toast' in '2.0.2':

Future<T?> showToast<T>(
    Object message, {
    Duration duration = const Duration(seconds: 3),
    Alignment? alignment,
    EdgeInsets? margin,
    BorderRadius? borderRadius,
    Color? backgroundColor,
    TextStyle? textStyle,
    EdgeInsets? padding,
  })