my_toastify
A beautiful, customizable toast notification system for Flutter.
Supports banners, snackbars, custom icons, actions, and multiple stacking positions.
đ Features
- Overlay-based toast notifications
- Top or bottom stacking
- Three styles: snackBar, banner, and minimal
- Optional width + alignment controls for web and desktop layouts
- Custom icons, actions, and colors
- Auto-dismiss with animation
- Multiple toasts at once
- Swipe-to-dismiss gesture
- Customize toast animation
đŦ Animated examples
These GIFs show every demo in the example app. Run the app to try the controls yourself.
Minimal success card
Use ToastStyle.minimal for compact, theme-aware feedback.

Top success snackbar
Set ToastPosition.top with ToastStyle.snackBar for a success message.

Bottom error snackbar
Use ToastType.error at the bottom for failed actions.

Top info banner
Combine ToastType.info, ToastPosition.top, and ToastStyle.banner for announcements.

Bottom warning banner
Use ToastType.warning in a bottom banner for attention-worthy updates.

Half-width bottom-right banner
Set widthFactor: 0.5 and horizontalAlignment: ToastHorizontalAlignment.end on wide screens.

Centered 60% banner
Set widthFactor: 0.6 and horizontalAlignment: ToastHorizontalAlignment.center.

Right-aligned snackbar with max width
Set maxWidth: 420 and horizontalAlignment: ToastHorizontalAlignment.end.

Countdown with pause
Set showProgressBar: true; hover or press and hold to pause the countdown.

Custom leading icon
Pass a widget to leading to replace the default toast icon.

Banner with action
Pass a button to action to let users respond from the toast.

Border and shadow styling
Use borderColor and boxShadow to customize the toast surface.

Persistent toast with cancel action
Set isAutoDismissible: false and dismiss the returned ID with Toastify.dismissById.

đĻ Installation
$ flutter pub add my_toastify
đ§ API Reference
ToastDetails
| Property | Type | Default | Description |
|---|---|---|---|
| toastId | String | Unique ID generated | Toast identifier for dismissing by ID |
| message | String | â | Message text displayed in toast |
| title | String? | null | Optional title above message |
| type | ToastType | ToastType.info | Defines color/icon scheme |
| position | ToastPosition | ToastPosition.bottom | Where toast appears |
| style | ToastStyle | ToastStyle.snackBar | Toast UI layout, including minimal |
| titleTextStyle | TextStyle? | textTheme.titleMedium | Custom title style |
| messageTextStyle | TextStyle? | textTheme.bodyMedium | Custom message style |
| leading | Widget? | null | Optional icon widget |
| action | Widget? | null | Optional action button |
| backgroundColor | Color? | null | Override default color |
| borderColor | Color? | null | Adds custom border |
| boxShadow | List | null | Shadow customization |
| widthFactor | double? | null | Fraction of available width to occupy |
| maxWidth | double? | null | Maximum toast width |
| horizontalAlignment | ToastHorizontalAlignment | stretch | Horizontal placement within overlay |
| duration | Duration | 3 seconds | Auto dismiss time |
| showProgressBar | bool | false | Show a countdown bar for auto-dismiss |
| pauseOnInteraction | bool | true | Pause countdown on hover or long-press |
| onDismiss | VoidCallback? | null | Callback when toast is dismissed |
| isAutoDismissible | bool | true | Set false to prevent automatic dismissal |
| animationDuration | Duration | 500ms | Duration of entrance/exit animation |
| appearCurve | Curve | Curves.easeOutBack | Curve for show animation |
| dismissCurve | Curve | Curves.easeIn | Curve for dismiss animation |
đĄ Example Usage
import 'package:flutter/material.dart';
import 'package:my_toastify/my_toastify.dart';
void main() {
runApp(const ToastifyDemo());
}
class ToastifyDemo extends StatelessWidget {
const ToastifyDemo({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Toastify Example')),
body: Center(
child: ElevatedButton(
onPressed: () {
Toastify.show(
context,
title: 'Success',
message: 'Profile updated successfully!',
type: ToastType.success,
position: ToastPosition.top,
style: ToastStyle.banner,
);
},
child: const Text('Show Toast'),
),
),
),
);
}
}
âŗ Countdown and pause
Show the remaining display time, and let users pause it by hovering (desktop/web) or pressing and holding (touch):
Toastify.show(
context,
message: 'You can pause this countdown.',
duration: const Duration(seconds: 5),
showProgressBar: true,
);
⨠Minimal style
Use a compact card that follows the app's light or dark theme. The icon and
countdown use the toast type's accent color. The card defaults to a 420-pixel
maximum width; set maxWidth to change it.
Toastify.show(
context,
title: 'Saved',
message: 'Your changes are ready.',
type: ToastType.success,
style: ToastStyle.minimal,
showProgressBar: true,
);
âī¸ Advanced Usage Examples
â With Leading Icon
Toastify.show(
context,
title: 'Upload Complete',
message: 'Your photo has been uploaded successfully.',
type: ToastType.success,
position: ToastPosition.bottom,
style: ToastStyle.snackBar,
leading: const Icon(Icons.check_circle, color: Colors.white),
);
đĢī¸ With Shadow
Toastify.show(
context,
title: 'File Saved',
message: 'Document saved to local storage.',
type: ToastType.success,
position: ToastPosition.bottom,
style: ToastStyle.snackBar,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
);
đĒ With Action Button
Toastify.show(
context,
title: 'Undo Action',
message: 'File deleted successfully.',
type: ToastType.success,
position: ToastPosition.bottom,
style: ToastStyle.snackBar,
action: TextButton(
onPressed: () {
debugPrint('Undo pressed');
},
child: const Text('Undo', style: TextStyle(color: Colors.white)),
),
);
đŦ Without Title
Toastify.show(
context,
message: 'Settings have been updated.',
type: ToastType.info,
position: ToastPosition.bottom,
style: ToastStyle.snackBar,
);
đ With onDismiss Callback
Toastify.show(
context,
title: 'Info',
message: 'This toast will print when dismissed.',
type: ToastType.info,
onDismiss: () {
debugPrint('Toast was dismissed!');
},
);
âšī¸ Non-Auto-Dismiss Toast with Action and dismissById
late final String toastId;
toastId = Toastify.show(
context,
title: 'Upload File',
message: 'Uploading in progress...',
type: ToastType.info,
position: ToastPosition.bottom,
style: ToastStyle.snackBar,
isAutoDismissible: false,
action: TextButton(
onPressed: () {
Toastify.dismissById(toastId);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Upload canceled")),
);
},
child: const Text('CANCEL', style: TextStyle(color: Colors.white)),
),
);
đ Half-width bottom-right banner on web
Toastify.show(
context,
title: 'Web Layout',
message: 'Half-width banner pinned to the bottom-right on web.',
type: ToastType.info,
position: ToastPosition.bottom,
style: ToastStyle.banner,
widthFactor: kIsWeb ? 0.5 : null,
horizontalAlignment: kIsWeb
? ToastHorizontalAlignment.end
: ToastHorizontalAlignment.stretch,
);
đī¸ Animation Control Examples (v1.1.0)
Smooth Fade Animation
Toastify.show(
context,
title: "Smooth Animation",
message: "Custom fade-in and fade-out animation.",
type: ToastType.success,
appearCurve: Curves.easeOut,
dismissCurve: Curves.easeIn,
animationDuration: const Duration(milliseconds: 300),
);
Bounce-In Entrance
Toastify.show(
context,
title: "Bounce In",
message: "This toast uses a bounce entrance.",
type: ToastType.info,
appearCurve: Curves.bounceOut,
dismissCurve: Curves.easeInExpo,
animationDuration: const Duration(milliseconds: 450),
);
â¤ī¸ Author
Created by Thant Zin
- GitHub Home: https://github.com/tz-thantzin
- Repository: https://github.com/tz-thantzin/my_toastify
Copyright (Šī¸) 2025 Thant Zin
Libraries
- my_toastify
- A beautiful, highly customizable toast/notification system for Flutter.