my_toastify 1.1.2 copy "my_toastify: ^1.1.2" to clipboard
my_toastify: ^1.1.2 copied to clipboard

A customizable toast notification system for Flutter. Supports banners, snackbars, and advanced styling.

my_toastify #

pub package   GitHub license   Buy Me A Coffee

A beautiful, customizable toast notification system for Flutter.
Supports banners, snackbars, custom icons, actions, and multiple stacking positions.


Toastify Demo

🚀 Features #

  • Overlay-based toast notifications
  • Top or bottom stacking
  • Two styles: snackBarStyle & bannerStyle
  • Custom icons, actions, and colors
  • Auto-dismiss with animation
  • Multiple toasts at once
  • Swipe-to-dismiss gesture
  • Customize toast animation

đŸ“Ļ 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
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
duration Duration 3 seconds Auto dismiss time
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: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'),
          ),
        ),
      ),
    );
  }
}

âš™ī¸ 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)),
    ),
);

đŸŽžī¸ 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

Copyright (ÂŠī¸) 2025 Thant Zin

7
likes
160
points
15
downloads

Publisher

verified publisherdevthantzin.com

Weekly Downloads

A customizable toast notification system for Flutter. Supports banners, snackbars, and advanced styling.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on my_toastify