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

progress_state_button 封面
插件详情v1.0.4

progress_state_button

一个可自定义的进度按钮小部件,适用于 Flutter Android、IOS 和 Web。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2590
喜欢数
373
Pub 分数
130

安装插件

flutter pub add progress_state_button

插件介绍

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

一个可自定义的进度按钮小部件,适用于 Flutter,支持 Android、iOS、Web、macOS、Windows 和 Linux。它允许开发者创建具有动态状态(如加载、成功、错误和空闲)的按钮,从而在表单提交或 API 调用等操作期间增强用户反馈。该小部件高度可配置,支持自定义颜色、标签、图标和动画。它可以无缝集成到现有的 Flutter 应用中,并在各个平台上提供一致的体验。

适合场景

  • 表单提交带加载状态
  • 身份验证流程进度
  • 文件上传指示器
  • 支付处理UI
  • 引导向导步骤

主要特点

  • 多状态支持(空闲、加载中、成功、错误)
  • 可自定义的外观和行为
  • 跨平台兼容性
  • 状态之间的动画过渡
  • 可配置的标签和图标
  • 与现有控件的轻松集成

适合对象

  • 开发交互式表单的开发者
  • 注重用户体验一致性的团队
  • 需要实时反馈的应用程序
  • 跨平台移动和Web应用
  • 具有复杂用户工作流的项目

使用建议

  • 需要了解 Flutter 状态管理
  • 复杂设计可能需要额外的样式
  • 仅限按钮特定用例
  • 不适用于非交互元素
  • 依赖于平台特定的渲染行为

原始 README

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

Progress State Button

A customizable progress button for Flutter

Test with DartPad

Installation

https://pub.dev/packages/progress_state_button

progress_state_button: "^1.0.4"

Usage

Icon

ProgressButton.icon(iconedButtons: {
      ButtonState.idle:
        IconedButton(
            text: "Send",
            icon: Icon(Icons.send,color: Colors.white),
            color: Colors.deepPurple.shade500),
      ButtonState.loading:
        IconedButton(
            text: "Loading",
            color: Colors.deepPurple.shade700),
      ButtonState.fail:
        IconedButton(
            text: "Failed",
            icon: Icon(Icons.cancel,color: Colors.white),
            color: Colors.red.shade300),
      ButtonState.success:
        IconedButton(
            text: "Success",
            icon: Icon(Icons.check_circle,color: Colors.white,),
            color: Colors.green.shade400)
    }, 
    onPressed: onPressed,
    state: ButtonState.idle);
With Custom Widgets

ProgressButton(
      stateWidgets: {
        ButtonState.idle: Text("Idle",style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500),),
        ButtonState.loading: Text("Loading",style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500),),
        ButtonState.fail: Text("Fail",style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500),),
        ButtonState.success: Text("Success",style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500),)
      },
      stateColors: {
        ButtonState.idle: Colors.grey.shade400,
        ButtonState.loading: Colors.blue.shade300,
        ButtonState.fail: Colors.red.shade300,
        ButtonState.success: Colors.green.shade400,
      },
      onPressed: onPressed,
      state: ButtonState.idle,
    );
Constructors
Default constructor of ProgressButton
stateWidgets - Widgets of states
stateColors - Background color oof states
state = ButtonState.idle` - Current state of button
onPressed - onPressed function same like MaterialButton
onAnimationEnd - onAnimatedEnd function calls like that onAnimatedEnd(AnimationStatus animationStatus,ButtonState currentState).
minWidth = 200.0 - Loading state width
maxWidth = 400.0 - failed,success,idle states width
radius = 16.0 - Button radius
height = 53.0 - Button height
circularProgressIndicator - CircularProgressIndicator widget, default is instating with current state color.
progressIndicatorAlignment = MainAxisAlignment.spaceBetween` - ProgressIndicator aligment
progressIndicatorSize = 35.0 - size of progress indicator
padding = EdgeInsets.zero - Padding of button
minWidthStates = List of min width states, loading is the default. If you want to make small only icon states define them on this.
animationDuration = Transition animation duration.
ProgressButton.icon() specific constructors
Map<ButtonState, IconedButton> iconedButtons- State and IconedButton map
double iconPadding: 4.0 - Padding of icon 
TextStyle textStyle - TextStyle of all of states

License

This project is licensed under the MIT License - see the LICENSE.md file for details

所属分类

源码仓库

使用此插件的项目

暂无相关数据。