professional_toast 1.0.2 copy "professional_toast: ^1.0.2" to clipboard
professional_toast: ^1.0.2 copied to clipboard

A highly customizable, animated toast/snackbar-style notification package for Flutter with support for icons, colors, positions, stacking, actions, progress bars, RTL, and queuing.

professional_toast #

A highly customizable, animated toast notification package for Flutter.

Features #

  • Message, title, icon, colors, text styles — all customizable
  • Built-in semantic types: success, error, warning, info (with sensible default colors/icons), or fully custom
  • Position: top, bottom, center
  • Animation: fade, slide, scale, fadeSlide
  • Stacking — multiple toasts can be visible at once per position, each counting down independently, instead of overlapping
  • Optional strict queue: true mode for one-at-a-time playback instead
  • RTL support via textDirection, inherited automatically from your app's ambient locale
  • Optional countdown progress bar
  • Optional close (×) icon
  • Optional action button (e.g. "UNDO") with callback
  • Swipe-to-dismiss (configurable direction, or disabled)
  • Tap callback, dismiss callback
  • No BuildContext juggling — call from anywhere after one-time init()

Setup #

MaterialApp(
  builder: (context, child) {
    ProfessionalToast.init(context);
    return child!;
  },
  home: const HomePage(),
)

Usage #

// Quick semantic helpers
ProfessionalToast.success('Profile updated successfully');
ProfessionalToast.error('Could not connect to server');
ProfessionalToast.warning('Low battery');
ProfessionalToast.info('New update available');

// Fully custom
ProfessionalToast.show(
  'Item removed from cart',
  icon: Icons.delete,
  backgroundColor: Colors.black87,
  position: ToastPosition.top,
  animation: ToastAnimation.scale,
  showProgressBar: true,
  showCloseIcon: true,
  actionLabel: 'UNDO',
  onActionPressed: () {},
);

// Full control via ToastConfig
ProfessionalToast.showConfig(
  ToastConfig(
    message: 'Custom toast',
    duration: const Duration(seconds: 5),
    borderRadius: 20,
    dismissDirection: DismissDirection.up,
  ),
);

// Queue toasts so they show one at a time
ProfessionalToast.show('First', queue: true);
ProfessionalToast.show('Second', queue: true);

Customizable properties (ToastConfig) #

Property Type Description
message String Body text (required)
title String? Optional bold heading
type ToastType success/error/warning/info/custom
icon IconData? Overrides the default type icon
iconColor Color? Icon tint
backgroundColor Color? Toast background
textColor Color? Text/icon color
titleStyle / messageStyle TextStyle? Full style override
duration Duration Auto-dismiss time
position ToastPosition top/bottom/center
animation ToastAnimation fade/slide/scale/fadeSlide
borderRadius double Corner radius
elevation double Shadow depth
padding / margin EdgeInsets Spacing
maxWidth double? Cap toast width
showProgressBar bool Countdown bar
showCloseIcon bool Manual close (×)
actionLabel / onActionPressed String? / VoidCallback? Action button
onTap / onDismissed VoidCallback? Interaction callbacks
dismissDirection DismissDirection Swipe direction, or .none
boxShadow / border Custom decoration Full visual control

Project structure #

professional_toast/
├── lib/
│   ├── professional_toast.dart   # barrel export
│   └── src/
│       ├── toast_config.dart     # ToastConfig model
│       ├── toast_enums.dart      # ToastPosition, ToastAnimation, ToastType
│       ├── toast_widget.dart     # visual widget + animations
│       └── toast_service.dart    # ProfessionalToast API + overlay mgmt
├── example/
│   └── main.dart
└── pubspec.yaml

Publishing to pub.flutter-io.cn #

  1. Update homepage/repository in pubspec.yaml.
  2. Add a LICENSE file (e.g. MIT).
  3. Run dart pub publish --dry-run to validate, then dart pub publish.
3
likes
160
points
302
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A highly customizable, animated toast/snackbar-style notification package for Flutter with support for icons, colors, positions, stacking, actions, progress bars, RTL, and queuing.

Repository (GitHub)
View/report issues

Topics

#toast #notification #snackbar #ui #overlay

License

MIT (license)

Dependencies

flutter

More

Packages that depend on professional_toast