Skip to content

AramSemerjyan/toastly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🥯 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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages