flash_notification 0.0.5 copy "flash_notification: ^0.0.5" to clipboard
flash_notification: ^0.0.5 copied to clipboard

A lightweight and customizable Flutter package for displaying temporary, toast-like notifications.

Flash Notification #

A lightweight and customizable Flutter package for displaying temporary, toast-like notifications.

Flash notification Flash notification

Features #

  • 🎯 Dismissible: Can be dismissed by tapping on it
  • 🎨 Customizable: Change colors, text styles, border radius, and more
  • πŸ”£ Icon Support: Include optional icons in your notifications
  • πŸ“± Flexible Positioning: Show notifications at different screen positions
  • πŸ–±οΈ Interaction: Add tap callbacks for notification interaction

Getting started #

Add the package to your pubspec.yaml:

dependencies:
  flash_notification: ^0.0.1  # Replace with actual version

Then run:

flutter pub get

Usage #

Basic Usage #

// Using the static method
FlashNotification.show(
  context: context,
  message: 'Hello, world!',
);

// Or using the context extension
context.showFlashNotification(
  message: 'Hello, world!',
);

With Custom Styling #

FlashNotification.show(
  context: context,
  message: 'Operation completed successfully!',
  backgroundColor: Colors.green,
  textStyle: TextStyle(
    color: Colors.white,
    fontWeight: FontWeight.bold,
  ),
  radius: BorderRadius.circular(10),
);

With an Icon #

FlashNotification.show(
  context: context,
  message: 'New notification received',
  icon: Icon(Icons.notifications, color: Colors.white),
);

Custom Position #

FlashNotification.show(
  context: context,
  message: 'Positioned at the bottom',
  position: FlashNotificationPosition(
    bottom: 20,
    left: 20,
    right: 20,
  ),
);

With Custom Duration #

FlashNotification.show(
  context: context,
  message: 'I will stay longer',
  duration: Duration(seconds: 5),
);

Manual Dismissal #

// Manually hide a notification
FlashNotification.hideCurrentNotification();

// Or using the context extension
context.hideFlashNotification();

Example Project #

For a complete working example, check the example directory.

Contributing #

Contributions are welcome! If you find a bug or want a feature:

  1. Check if an issue already exists
  2. Create a new issue if needed
  3. Fork the repo
  4. Create your feature branch (git checkout -b feature/amazing-feature)
  5. Commit your changes (git commit -m 'Add some amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Additional information #

License #

This project is licensed under the MIT License - see the LICENSE file for details.

2
likes
160
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight and customizable Flutter package for displaying temporary, toast-like notifications.

Homepage
View/report issues

Topics

#notifications #toast #snackbar

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flash_notification