toastly 0.1.1 copy "toastly: ^0.1.1" to clipboard
toastly: ^0.1.1 copied to clipboard

A lightweight toast utility for Flutter apps with customizable icon, message, and animation.

๐Ÿฅฏ toastly #

A lightweight, customizable toast overlay for Flutter apps โ€” perfect for displaying quick feedback messages with optional icons, custom styling, and manual dismiss options.


โœจ Features #

  • ๐Ÿ”น Fully customizable toast content using any Widget
  • ๐Ÿ”น Manual or auto-dismiss behavior
  • ๐Ÿ”น Custom alignment
  • ๐Ÿ”น Configurable padding, colors, border radius, and elevation
  • ๐Ÿ”น Tap callback support

๐Ÿš€ Installation #

Add this to your pubspec.yaml:

dependencies:
  toastly: ^0.0.1

๐Ÿ› ๏ธ Usage #

1. Initialize once with vsync #

class _PageState extends State<Page>
    with SingleTickerProviderStateMixin {
  @override
  void initState() {
    super.initState();

    Toastly.init(vsync: this);
  }
}

or AnimationController #

class _PageState extends State<Page>
    with SingleTickerProviderStateMixin {
  late final _controller = AnimationController(vsync: this);

  @override
  void initState() {
    super.initState();

    Toastly.init(animationController: _controller);
  }
}

The default stackMode is ToastlyStackMode.replace, where each new toast replaces the previous one. You can also use ToastlyStackMode.queue, which adds each new toast to a queue and displays them one by one. #

class _PageState extends State<Page>
    with SingleTickerProviderStateMixin {
  @override
  void initState() {
    super.initState();

    Toastly.init(
      vsync: this,
      stackMode: ToastlyStackMode.queue,
    );
  }
}

Screen Recording 2025-05-03 at 14 06 18

2. Show a toast #

Toastly.instance.show(
  context: context,
  config: ToastlyConfig(
    message: const Text('Post saved!'),
    icon: const Icon(Icons.check_circle, color: Colors.green),
    alignment: Alignment.bottomCenter,
    autoDismiss: true,
    backgroundColor: Colors.white,
  ),
);

Screen Recording 2025-05-03 at 00 48 55

Field Type Description
message Widget Main toast content
icon Widget? Optional leading icon
alignment Alignment Toast position (top, bottom, center, etc.)
padding EdgeInsetsGeometry? Outer padding of the toast
backgroundColor Color? Toast background color
elevation double? Shadow elevation beneath the toast
autoDismiss bool Whether the toast dismisses automatically
dismissInSeconds int? Number of seconds before dismiss (if enabled)
closeItem Widget? Custom close button (top-right corner)
borderRadius BorderRadius? Corner rounding of the toast
animationType ToastAnimationType Toast animation: fade, slideUp, slideDown, scaleIn
shouldShowProgressBar bool Whether to show animated progress bar
progressBarColor Color? Color of the progress bar (if shown)
progressBarHeight double? Height of the progress bar
progressBarAlignment Alignment? Alignment of the progress bar inside the toast

๐Ÿงช Example App #

Check out the example folder for a complete working demo. #

1
likes
160
points
119
downloads

Publisher

verified publisherelidev.work

Weekly Downloads

A lightweight toast utility for Flutter apps with customizable icon, message, and animation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on toastly