SwiftAlert is a lightweight, customizable Flutter package for displaying beautiful top-of-screen notification alerts. It supports multiple notification types (success, error, info, warning), smooth animations, and easy integration with any Flutter app.
Features
- Show animated notification banners at the top of the screen
- Support for success, error, info, and warning types
- Customizable colors and icons per notification type
- Dismiss on tap or swipe
- Simple API: just call
SwiftAlert.display() - Works seamlessly with overlays
Screenshots
Error Notification:

Success Notification:

Getting started
Installation
From pub.dev (recommended):
Add this to your pubspec.yaml:
dependencies:
swift_alert: ^1.0.0 # Check pub.dev for the latest version
Then run:
flutter pub get
From GitHub (development):
dependencies:
swift_alert:
git:
url: https://github.com/Collins-01/Swift-Alert.git
Then run:
flutter pub get
Usage
Basic Example
import 'package:swift_alert/swift_alert.dart';
// In your widget (e.g., after a button press):
SwiftAlert.display(
context,
message: 'Profile updated successfully!',
type: NotificationType.success, // success, error, info, warning
);
Notification Types
NotificationType.success(green)NotificationType.error(red)NotificationType.info(blue)NotificationType.warning(yellow)
Customization
You can customize the message, duration, and notification type:
SwiftAlert.display(
context,
message: 'Custom message',
duration: Duration(seconds: 6),
type: NotificationType.warning,
);
Dismissing
Notifications can be dismissed by tapping or swiping up.
API Reference
See the Dart API docs for full details on all classes and methods.
Troubleshooting / FAQ
- If the alert does not show, ensure you are passing the correct
BuildContext(use a context from within a widget tree that has anOverlay). - Only one notification is shown at a time; calling
SwiftAlert.displayreplaces the previous alert. - For custom icons/colors, extend the enums or widget as needed.
Contributing & Support
For more information, see the GitHub repository.
Contributions are welcome! Please open issues or pull requests for bugs, features, or improvements.
For questions or help, open an issue on GitHub or reach out to the maintainer.
Libraries
- swift_alert
- SwiftAlert: Beautiful, customizable notification banners for Flutter.