QuickAlert 是一个 Flutter 包,可让开发者快速显示带有预设类型(如成功、错误、警告、确认和加载)的动画化、可自定义的弹出对话框。它通过极少的代码即可简化用户反馈的展示过程,支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台。该包提供流畅的动画效果,并可通过单次方法调用轻松集成,非常适合需要即时视觉反馈的应用程序以提升用户体验。同时,也支持自定义对话框,适用于特殊使用场景。
适合场景
表单提交后显示成功消息
显示无效输入的错误警报
通过是/否提示确认操作
在异步操作期间指示加载状态
为特定的UI需求创建自定义警报设计
主要特点
预定义的警告类型(成功、错误、警告等)
用于视觉吸引力的动画过渡
对自定义对话框内容的支持
简单的单行调用
跨平台兼容性
轻量且易于集成
适合对象
初学者 Flutter 开发者
需要快速用户反馈的应用程序
表单和身份验证流程
频繁弹出提醒的交互式 UI
优先考虑快速实现的项目
使用建议
超出基础样式的定制有限
可能需要额外的样式设置以适应复杂布局
不太适合高度动态或持久的对话框
最适合临时通知
依赖外部动画库以实现效果
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
An instantly ready, full-featured alerts for development on any platform with flutter. Enabling you to complete projects and deploy quickly. With QuickAlert, you can display animated alert dialogs such as success, error, warning, confirm, loading or even a custom dialog.
Key Features 🔮
Easy To Use
The alerts are very flexible and can be customized very easily. In QuickAlert, the QuickAlert.show() triggers the alert, which informs the user about the situations that need acknowledgment.
Predefined Beautiful Alert Styles
Make use of the predefined alerts are very beautiful and can also be customized very easily. In QuickAlert there are 6 different types of alerts, they are Success, Error, Warning, Info, Confirm & Loading.
Predefined Title & Actions
In QuickAlert all the 6 different types of alerts have predefined title & actions matching the alert type.
Super Customizable
Build your custom alert with power of QuickAlert using the flutter widgets.
Change Animation
Set your favorite animation by choosing from scale, rotate, slideInDown, slideInUp, slideInLeft, slideInRight.
Set Auto close
Auto close the alert by setting auto close duration.
Set Overlay Tap to Dismiss
Control the alert's Barrier Dismissible Property by setting barrierDismissible to true or false.
And Many More...
QuickAlert Demo
Getting Started 🔥
Start by adding the library as a dependency to your project.
dependencies:quickalert:<latestversion>
Run the command get the dependency
$ flutter pub get
Import it in your dart code, you can use
import'package:quickalert/quickalert.dart';
To display alert use QuickAlert.show() and define the type of alert.
QuickAlert.show(
context: context,
type: QuickAlertType.success,
); // That's it to display an alert, use other properties to customize.
Examples ⚡
There is a detailed example project in the example folder. You can directly run and play on it. There are code snippets from example project below.