搜索插件、代码仓与 APP 分类

status_alert 封面
插件详情v3.0.1

status_alert

显示类似苹果系统的自动隐藏状态提醒。非常适合在不中断用户流程的情况下通知用户。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
698
喜欢数
287
Pub 分数
160

安装插件

flutter pub add status_alert

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个Flutter包,显示系统风格的、自动隐藏的状态警报,灵感来自Apple的UI。这些不干扰的提示会在屏幕顶部短暂出现并自动消失,非常适合在不打断用户流程的情况下提供反馈。设计简洁、极简,支持Android、iOS、Web、macOS、Windows和Linux等多个平台。该包轻量且易于集成,提供流畅的动画效果和跨设备的可靠行为。

适合场景

  • 表单提交后显示成功消息
  • 显示临时错误通知
  • 提供对用户操作的反馈
  • 通知用户后台进程更新
  • 通过细微且非阻塞的提醒来提升用户体验

主要特点

  • 自动隐藏通知
  • 苹果风格的视觉设计
  • 跨平台兼容性
  • 平滑的淡入/淡出动画
  • 简单的 API,设置最少
  • 可配置的持续时间和位置

适合对象

  • 需要轻量级反馈的应用程序
  • 注重用户体验的开发者
  • 面向多平台的项目
  • 必须避免中断的 UI
  • 希望实现原生样式的警报的团队

使用建议

  • 不适合用于持久或关键的警报
  • 超出基础样式的定制有限
  • 需要正确的上下文以正确确定位置
  • 在复杂的 widget 树中可能无法按预期工作
  • 最适合用于短暂存在且非紧急的消息

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Status Alert for Flutter

Pub Version CI

Display Apple system-like self-hiding status alerts. Well suited for notifying users without interrupting their flow.

Installing

dependencies:
  status_alert: ^2.0.0
import 'package:status_alert/status_alert.dart';

Basic Usage

StatusAlert.show(
  context,
  duration: Duration(seconds: 2),
  title: 'Subscribed',
  subtitle: 'You will be notified of new posts',
  configuration: IconConfiguration(icon: Icons.done),
  maxWidth: 260,
);

Parameters

Parameter Type Default Description
title String? null Main text
subtitle String? null Secondary text
configuration PopupMediaConfiguration? null Icon or custom widget
duration Duration 1300ms How long the alert stays visible
backgroundColor Color? Theme-based Alert background
blurPower double 2.0 Background blur sigma
maxWidth double? null Max width on large screens
alignment Alignment center Alert position on screen
margin EdgeInsets all(40) Outer spacing
padding EdgeInsets all(30) Inner spacing
borderRadius BorderRadius circular(10) Corner radius
dismissOnBackgroundTap bool false Dismiss when background is tapped
onComplete VoidCallback? null Called after dismiss animation ends
titleOptions StatusAlertTextConfiguration? null Title text styling
subtitleOptions StatusAlertTextConfiguration? null Subtitle text styling

Media Configurations

Icon
StatusAlert.show(
  context,
  title: 'Done',
  configuration: IconConfiguration(
    icon: Icons.check_circle,
    color: Colors.green,
    size: 60,
  ),
);
Custom Widget (e.g. Rive animation)
StatusAlert.show(
  context,
  title: 'Loading',
  configuration: WidgetConfiguration(
    widget: RiveAnimation.asset('assets/animation.riv'),
  ),
);

Programmatic Control

// Show
StatusAlert.show(context, title: 'Saved');

// Hide manually
StatusAlert.hide();

// Check visibility
if (StatusAlert.isVisible) { ... }

onComplete Callback

Called after the alert finishes its dismiss animation:

StatusAlert.show(
  context,
  title: 'Uploaded',
  onComplete: () => Navigator.push(context, ...),
);

Migration from 1.x

1.x 2.x
FlareConfiguration Use WidgetConfiguration with a Rive widget
textScaleFactor in StatusAlertTextConfiguration Use textScaler
Dart SDK <3.0.0 Requires Dart >=3.0.0

Apple Podcasts vs Status Alert

License

This project is licensed under the Apache License 2.0 — see the LICENSE file for details.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。