toastly 0.1.0
toastly: ^0.1.0 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);
}
}
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,
),
);
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 |