Skip to main content

toastio 1.0.0 copy "toastio: ^1.0.0" to clipboard
toastio: ^1.0.0 copied to clipboard

A lightweight, animated Glassmorphism toast for Flutter with global and context-based APIs.

toastio #

A lightweight, animated Glassmorphism toast for Flutter.

Features #

  • Success, error, warning and info toast types
  • Global toast without passing BuildContext
  • Context-based API
  • Glassmorphism UI with blur
  • Smooth fade, slide and scale animations
  • Close button
  • Auto dismiss
  • Custom background and text colors
  • Custom icon and leading widget
  • Top, center and bottom positions
  • No GetX or other third-party dependencies

📸 Screenshots #

[Success Toast] [Error Toast] [Warning Toast]

[Info Toast] [Top Position Toast] [Toast with Image]

Installation #

Add the package to pubspec.yaml:

dependencies:
  toastio: ^1.0.0

Then run:

flutter pub get

Global setup #

Create a navigator key:

final navigatorKey = GlobalKey<NavigatorState>();

Initialize the package:

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  Toastio.initialize(navigatorKey);

  runApp(
    MaterialApp(
      navigatorKey: navigatorKey,
      home: const HomePage(),
    ),
  );
}

Now you can call a toast from anywhere:

Toastio.success('Profile updated');

Toastio.error(
  'Something went wrong',
  title: 'Error',
);

Toastio.warning('Please check your input');

Toastio.info('New message received');

Context API #

If you already have a BuildContext:

Toastio.show(
  context,
  'Saved successfully',
  type: ToastType.success,
);

Customization #

Toastio.showGlobal(
  'Custom toast',
  type: ToastType.info,
  title: 'Information',
  duration: const Duration(seconds: 4),
  bgColor: Colors.black,
  textColor: Colors.white,
  position: ToastPosition.bottom,
  showCloseButton: true,
);

Custom icon #

Toastio.showGlobal(
  'Upload complete',
  icon: const Icon(Icons.cloud_done),
);

Custom leading widget #

Toastio.showGlobal(
  'New message',
  leading: const CircleAvatar(
    radius: 12,
    child: Icon(Icons.person, size: 14),
  ),
);

Dismiss manually #

Toastio.dismiss();

Contributing #

Contributions are welcome! ❤️

If you have an idea, bug fix, improvement, or new feature, feel free to contribute.

How to contribute #

  1. Fork the repository
  2. Create a new branch
git checkout -b feature/my-feature
  1. Make your changes
  2. Test your changes
flutter test
  1. Commit your changes
git commit -m "Add my feature"
  1. Push your branch
git push origin feature/my-feature
  1. Open a Pull Request

Please keep contributions clean, focused, and consistent with the existing code style.

Issues & Suggestions #

Found a bug or have an idea?

Feel free to open an issue and share your feedback. Every suggestion and contribution is appreciated.

License #

MIT License.

1
likes
0
points
296
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight, animated Glassmorphism toast for Flutter with global and context-based APIs.

Repository (GitHub)
View/report issues

Topics

#toast #flutter #notification #snackbar #glassmorphism

License

unknown (license)

Dependencies

flutter

More

Packages that depend on toastio