VooToast
A super developer-friendly toast notification package for Flutter with global access, extensive customizations, and responsive platform-specific defaults.
Features
- π Global Access - Show toasts from anywhere without context
- π¨ Highly Customizable - Extensive styling and animation options
- π± Platform Aware - Automatic positioning based on platform
- π― Type Safe - Fully typed with strong type constraints
- π¬ Rich Animations - Multiple built-in animations
- π¦ Queue Management - Smart queuing system
- ποΈ Clean Architecture - Following best practices
- βοΈ Atomic Design - Well-organized component structure
Installation
Add to your pubspec.yaml
:
dependencies:
voo_toast: ^0.0.1
Quick Start
1. Wrap your app with VooToastOverlay
import 'package:voo_toast/voo_toast.dart';
MaterialApp(
home: VooToastOverlay(
child: YourApp(),
),
)
2. Show toasts from anywhere
// Simple toasts
VooToast.showSuccess(message: 'Operation successful!');
VooToast.showError(message: 'Something went wrong');
VooToast.showWarning(message: 'Please review your input');
VooToast.showInfo(message: 'New update available');
// With title
VooToast.showSuccess(
title: 'Success',
message: 'Your file has been saved',
);
// With actions
VooToast.showInfo(
message: 'Item deleted',
actions: [
ToastAction(
label: 'UNDO',
onPressed: () => restoreItem(),
),
],
);
Configuration
Initialize with custom configuration:
VooToastController.init(
config: ToastConfig(
defaultDuration: Duration(seconds: 4),
maxToasts: 5,
queueMode: true,
preventDuplicates: true,
mobilePosition: ToastPosition.bottom,
webPosition: ToastPosition.topRight,
successColor: Colors.green,
errorColor: Colors.red,
),
);
Toast Types
success
- Green themed success messageserror
- Red themed error messageswarning
- Orange themed warning messagesinfo
- Blue themed informational messagescustom
- Fully customizable toasts
Positions
- Top:
top
,topLeft
,topCenter
,topRight
- Center:
center
,centerLeft
,centerRight
- Bottom:
bottom
,bottomLeft
,bottomCenter
,bottomRight
- Auto: Platform-specific positioning
Animations
none
- No animationfade
- Fade in/outslideIn
- Slide from positionslideInFromTop/Bottom/Left/Right
- Directional slidesbounce
- Bounce effectscale
- Scale in/outrotate
- Rotation effect
Custom Toasts
VooToast.showCustom(
content: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.purple, Colors.pink],
),
),
child: Text('Custom styled toast!'),
),
duration: Duration(seconds: 5),
);
Platform-Specific Behavior
The package automatically adjusts based on screen size:
- Mobile (<600px): Bottom position, touch-friendly
- Tablet (600-900px): Top-right position
- Web/Desktop (>900px): Top-right position, compact sizing
API Reference
VooToast (Global Controller)
showSuccess()
- Show success toastshowError()
- Show error toastshowWarning()
- Show warning toastshowInfo()
- Show info toastshowCustom()
- Show custom toastdismiss(toastId)
- Dismiss specific toastdismissAll()
- Dismiss all toastsclearQueue()
- Clear queued toasts
ToastConfig
Configuration options for toast behavior and styling.
Toast
Main toast entity with all properties.
ToastAction
Action button for interactive toasts.
Example
See the example folder for a complete sample application.
License
MIT License