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

flutter_progress_hud 封面
插件详情v2.0.2

flutter_progress_hud

高度可定制的模态进度指示器,带有淡入淡出动画。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2.9万
喜欢数
131
Pub 分数
150

安装插件

flutter pub add flutter_progress_hud

插件介绍

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

一个高度可定制的Flutter模态进度指示器,显示带有平滑淡入淡出动画的加载覆盖层。它提供了一种简单的方法来在异步操作期间显示和隐藏加载状态,通过指示正在进行的过程来改善用户体验。HUD 可以通过不同的消息、颜色和形状进行自定义,并支持移动、Web 和桌面等多种平台。非常适合用于表单、API 调用或任何需要视觉反馈的操作。

适合场景

  • 在API请求期间显示加载状态
  • 显示表单提交进度
  • 增强数据获取过程中的用户体验
  • 在后台任务期间提供反馈
  • 在长时间运行的操作中指示处理状态

主要特点

  • 淡入和淡出动画
  • 可自定义的消息和外观
  • 支持多个平台
  • 简易的显示/隐藏方法
  • 可配置的覆盖颜色和不透明度
  • 跨设备的响应式设计

适合对象

  • 开发频繁使用异步操作的应用程序的开发者
  • 注重用户体验的团队
  • 需要一致加载指示器的项目
  • 针对多个平台的应用
  • 需要精美反馈的UI密集型应用程序

使用建议

  • 可能需要仔细管理,以避免与其他UI元素重叠
  • 自定义选项可能会增加简单用例的复杂性
  • 对非常频繁的显示/隐藏循环的性能影响
  • 不适用于非模态加载场景
  • 与第三方替代方案相比,内置主题有限

原始 README

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

pub package

Flutter Progress HUD

Highly customizable modal progress indicator with fade animation.

Preview

Usage

Wrap with ProgressHUD the widget on top of which you want to show the modal indicator.

ProgressHUD(
  child: HomePage(),
)

Get a reference of ProgressHUD

final progress = ProgressHUD.of(context);

Show indeterminate progress

progress.show();

Or a progress with text

progress.showWithText('Loading...');

Then dismiss

progress.dismiss();

Example (full)

ProgressHUD(
        child: Builder(
          builder: (context) => Center(
                child: Column(
                  children: <Widget>[
                    RaisedButton(
                      child: Text('Show for a second'),
                      onPressed: () {
                        final progress = ProgressHUD.of(context);
                        progress.show();
                        Future.delayed(Duration(seconds: 1), () {
                          progress.dismiss();
                        });
                      },
                    ),
                    RaisedButton(
                      child: Text('Show with text'),
                      onPressed: () {
                        final progress = ProgressHUD.of(context);
                        progress.showWithText('Loading...');
                        Future.delayed(Duration(seconds: 1), () {
                          progress.dismiss();
                        });
                      },
                    ),
                  ],
                ),
              ),
        ),
      ),

Customization

Attribute Name Default Value Description
indicatorColor Colors.white When using the default indicator widget, this is how you set its color
indicatorWidget A basic CircularProgressIndicator Custom indicator widget
backgroundColor Colors.black54 Indicator background color
backgroundRadius Radius.circular(8.0) Indicator background radius
borderColor Colors.white Indicator background border color
borderWidth 0.0 Indicator background border width
barrierEnabled true You can disable the modal barrier if you want to allow touches while the progress is shown
barrierColor Colors.black12 Color of the Barrier displayed behind the indicator
textStyle TextStyle(color: Colors.white, fontSize: 14.0) TextStyle for the Text displayed below the indicator
padding EdgeInsets.all(16.0)} Indicator content padding

所属分类

源码仓库

使用此插件的项目