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

Beautiful, customizable notification banners for Flutter.

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:

Error Notification

Success Notification:

Success Notification

Getting started #

Installation #

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 an Overlay).
  • Only one notification is shown at a time; calling SwiftAlert.display replaces 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.

1
likes
140
points
10
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Beautiful, customizable notification banners for Flutter.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on swift_alert