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

flutter_svprogresshud 封面
插件详情v1.1.0

flutter_svprogresshud

一个干净轻量的 Flutter 进度 HUD,基于 SVProgressHUD。

AndroidiOS
近 30 天下载
357
喜欢数
52
Pub 分数
130

安装插件

flutter pub add flutter_svprogresshud

插件介绍

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

一个干净轻量的进度HUD,适用于Flutter应用,灵感来自SVProgressHUD。它提供了一种简单优雅的方式来显示加载指示器、成功消息和错误信息,而不会干扰用户体验。专为Android和iOS设计,可轻松集成到现有的Flutter项目中,设置简单。该包提供了可自定义的外观和行为,同时保持高性能和响应性。

适合场景

  • 在网络请求期间显示加载状态
  • 操作后显示成功或错误消息
  • 增强表单提交期间的用户体验
  • 在后台任务期间提供反馈
  • 简化移动应用中的加载界面

主要特点

  • 轻量且快速
  • 跨平台支持(Android 和 iOS)
  • 可自定义外观
  • 用于显示/隐藏HUD的简单API
  • 支持多种消息类型(成功、错误、信息)
  • 与 Flutter 小部件的轻松集成

适合对象

  • 寻求极简加载指示器的开发人员
  • 需要持续进度反馈的应用程序
  • 优先考虑流畅用户体验过渡的项目
  • 在原生平台上使用 SVProgressHUD 的团队
  • 需要快速实现HUD组件的Flutter应用

使用建议

  • 超出基础样式的定制有限
  • 无内置动画控制
  • 依赖原生平台渲染
  • 可能需要额外处理以应对复杂的UI流程
  • 不适合高度定制化的HUD设计

原始 README

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

🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.

flutter_svprogresshud

pub version

A clean and lightweight progress HUD for flutter app, based on SVProgressHUD.

The plugin supports almost all of SVProgressHUD APIs, for Android we have almost replicated SVProgressHUD effects (View code).


SVProgressHUD

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_svprogresshud: ^1.0.1

You can install packages from the command line:

$ flutter pub get
Usage

(see demo in /example)

SVProgressHUD is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call SVProgressHUD.method()).

Use SVProgressHUD wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.

Using SVProgressHUD in your app will usually look as simple as this:

SVProgressHUD.show();
Future.delayed(Duration(seconds: 3)).then((value) {
  SVProgressHUD.dismiss();
});
Showing the HUD

You can show the status of indeterminate tasks using one of the following:

SVProgressHUD.show();
SVProgressHUD.show(status: 'Doing Stuff');

If you'd like the HUD to reflect the progress of a task, use one of these:

SVProgressHUD.showProgress(0.91);
SVProgressHUD.showProgress(0.91, status: 'Loading...');
Dismissing the HUD

The HUD can be dismissed using:

SVProgressHUD.dismiss()
SVProgressHUD.dismiss(delay: Duration(milliseconds: 2000));

If you'd like to stack HUDs, you can balance out every show call using:

+ (void)popActivity;

The HUD will get dismissed once the popActivity calls will match the number of show calls.

Or show a confirmation glyph before before getting dismissed a little bit later. The display time depends on minimumDismissTimeInterval and the length of the given string.

SVProgressHUD.showInfo(status: 'Useful Information.');
SVProgressHUD.showSuccess(status: 'Great Success!');
SVProgressHUD.showError(status: 'Failed with Error');
Customization

SVProgressHUD can be customized via the following methods:

void setDefaultStyle(SVProgressHUDStyle style);                 // default is SVProgressHUDStyle.Light
void setDefaultMaskType(SVProgressHUDMaskType maskType);        // default is SVProgressHUDMaskType.None
void setDefaultAnimationType(SVProgressHUDAnimationType type);  // default is SVProgressHUDAnimationType.Flat
void setMinimumSize(Size minimumSize);                          // default is Size.zero, can be used to avoid resizing
void setRingThickness(num width);                               // default is 2 pt
void setRingRadiu(num radius);                                  // default is 18 pt
void setRingNoTextRadius(num radius);                           // default is 24 pt
void setCornerRadius(num cornerRadius);                         // default is 14 pt
void setBorderColor(Color color);                               // default is null
void setBorderWidth(num width);                                 // default is 0
void setForegroundColor(Color color);                           // default is Colors.black, only used for SVProgressHUDStyle.Custom
// void setForegroundImageColor(Color color);                      // default is the same as foregroundColor
void setBackgroundColor(Color color);                           // default is Colors.white, only used for SVProgressHUDStyle.Custom
void setBackgroundLayerColor(Color color);                      // default is [Color colorWithWhite:0 alpha:0.4], only used for SVProgressHUDMaskType.Custom
void setImageViewSize(Size size);                               // default is 28x28 pt
// void setShouldTintImages(bool shouldTintImages);                // default is true
// void setInfoImage(UIImage image);                               // default is the bundled info image provided by Freepik
// void setSuccessImage(UIImage image);                            // default is bundled success image from Freepik
// void setErrorImage(UIImage image);                              // default is bundled error image from Freepik
// void setGraceTimeInterval(num interval);                        // default is 0 seconds
void setMinimumDismissTimeInterval(num interval);               // default is 5.0 seconds
// void setMaximumDismissTimeInterval(num interval);               // default is CGFLOAT_MAX
void setFadeInAnimationDuration(num duration);                  // default is 0.15 seconds
void setFadeOutAnimationDuration(num duration);                 // default is 0.15 seconds
void setHapticsEnabled(bool hapticsEnabled);                    // default is false

Related Links

  • https://github.com/SVProgressHUD/SVProgressHUD

License

MIT

所属分类

源码仓库

使用此插件的项目

暂无相关数据。