一,概述

  基本有两种类型:

  • 条形进度条(LinearProgressIndicator

    new LinearProgressIndicator(
    backgroundColor: Colors.blue,
    // value: 0.2,
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    ),
    new Container(padding: const EdgeInsets.all(20.0)),
  • 圆形进度条(CircularProgressIndicator
    new CircularProgressIndicator(
    strokeWidth: 4.0,
    backgroundColor: Colors.blue,
    // value: 0.2,
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    ),  

注意如果 value 为 null 或空,则显示一个动画,否则显示一个定值。Progress 的值只能设置 0 ~ 1.0,如果大于 1,则表示已经结束。 

二,构造函数

  • LinearProgressIndicator

    /**
    * 条形进度条
    * LinearProgressIndicator本身不能设置高度,可以包一层父容器设置高度来间接设置LinearProgressIndicator的高度,
    * 如Container,SizedBox等
    *
    * const LinearProgressIndicator({
    Key key,
    double value,//0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值
    Color backgroundColor,//背景颜色
    Animation<Color> valueColor,//animation类型的参数,用来设定进度值的颜色,默认为主题色
    String semanticsLabel,
    String semanticsValue,
    })
    */
  • CircularProgressIndicator
    /**
    * 圆形进度条
    * 可以在外面包一层SizedBox,间接改变进度条的大小
    *const CircularProgressIndicator({
    Key key,
    double value,//0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值
    Color backgroundColor,//背景颜色
    Animation<Color> valueColor,//animation类型的参数,用来设定进度值的颜色,默认为主题色
    this.strokeWidth = 4.0,//进度条宽度
    String semanticsLabel,
    String semanticsValue,
    })
    */

三,demo

  • LinearProgressIndicator

    body: ListView(
    children: <Widget>[
    Container(
    padding: EdgeInsets.only(left: 50.0, right: 50.0, top: 50.0),
    child: LinearProgressIndicator(
    value: 0.3,
    backgroundColor: Color(0xff00ff00),
    ),
    ),
    Container(
    padding: EdgeInsets.only(left: 50.0, right: 50.0, top: 50.0),
    child: LinearProgressIndicator(
    // value: 0.3,
    backgroundColor: Color(0xffff0000),
    ),
    ),
    Container(
    padding: EdgeInsets.only(left: 50.0, right: 50.0, top: 50.0),
    child: LinearProgressIndicator(
    value: 0.3,
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    backgroundColor: Color(0xff00ff00),
    ),
    ),
    Container(
    padding: EdgeInsets.only(left: 50.0, right: 50.0, top: 50.0),
    child: Container(
    height: 10.0,
    child: LinearProgressIndicator(
    value: 0.3,
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    backgroundColor: Color(0xff00ff00),
    ),
    ),
    ),
    ],
    ),
  • CircularProgressIndicator
    body: Stack(
    children: <Widget>[
    Positioned(
    left: 150.0,
    top: 20.0,
    child: CircularProgressIndicator(
    // value: 0.3,
    backgroundColor: Color(0xffff0000),
    )
    ),
    Positioned(
    left: 150.0,
    top: 70.0,
    child: CircularProgressIndicator(
    value: 0.3,
    backgroundColor: Color(0xffff0000),
    )
    ),
    Positioned(
    left: 150.0,
    top: 120.0,
    child: CircularProgressIndicator(
    // value: 0.3,
    strokeWidth: 4.0,
    backgroundColor: Color(0xffff0000),
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    )
    ),
    Positioned(
    left: 150.0,
    top: 170.0,
    child: CircularProgressIndicator(
    // value: 0.3,
    strokeWidth: 8.0,
    backgroundColor: Color(0xffff0000),
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    )
    ),
    Positioned(
    left: 150.0,
    top: 220.0,
    child: SizedBox(
    width: 50.0,
    height: 50.0,
    child: CircularProgressIndicator(
    // value: 0.3,
    backgroundColor: Color(0xffff0000),
    valueColor: new AlwaysStoppedAnimation<Color>(Colors.red),
    ),
    )
    ),
    ],
    )

【Flutter学习】基本组件之进度条(LinearProgressIndicator, CircularProgressIndicator)的更多相关文章

  1. 使用tqdm组件构造程序进度条

    使用tqdm组件构造程序进度条 觉得有用的话,欢迎一起讨论相互学习~Follow Me 主要代码 import tqdm # 引用tqdm组件 TRAIN_STEPS = N for i in tqd ...

  2. 第33讲 UI组件_进度条ProcessBar和消息队列处理器handler

    第33讲UI组件_进度条ProcessBar和消息队列处理器handler 1. 进度条ProcessBar 一个可视化的进度指示器,代表正在执行的耗时任务.可以为用户展示一个进度条,表示正在执行的任 ...

  3. progress组件(进度条)

    progress组件:进度条 progress组件的属性: percent:类型:number 设置百分比 (0~100) show-info:类型:布尔 在进度条右侧显示百分比 border-rad ...

  4. jqueryui组件progressbar进度条和日期组件datepickers的简单使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. 自己定义View学习之12/7(进度条之混合模式)

    今天重点内容是我们学习自己定义view里面的混合模式.事实上我们的画布就跟photoshop一样.是个图层关系,一层盖着一层.这样就导致有非常多种覆盖模式,这就是我们今天的主题."混合模式& ...

  6. 【Flutter学习】组件学习之目录

    01. Flutter组件-Layout-Container-容器  02. Flutter组件-Text-Text-文本  03. Flutter组件-Text-RichText-富文本  04. ...

  7. android学习笔记20——ProgressDialog进度条对话框

    ProgressDialog==>进度条对话框 ProgressDialog本身就代表一个进度条对话框,程序只需要创建ProgressDialog实例,并将其显示出来就是一个进度条对话框:开发者 ...

  8. ftk学习记录(一个进度条文章)

    [ 声明:版权全部,欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 首先.在開始今天的文章之前.我们还是给朋友们展示一下前面一段代码的执行效果.效果例如以下, w ...

  9. Android学习笔记_76_Android ProgressBar 进度条

    android 进度条的样式  例1:(默认样式(中等圆形))Xml代码 <ProgressBar      android:id="@+id/progressBar1"   ...

随机推荐

  1. webpack使用的补充

    1.分离生产环境和开发环境的wepack.config.js 我们可以将生产环境和开发环境中的配置分离为两个不同的文件,并且还维护一个共同的配置文件 common,可以通过 webpack.merge ...

  2. NAGIOS(网络监视工具)

    Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机,路由器等网络设备,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员 ...

  3. 【丛林】HTML Table 表格浅谈(边框、隔行变色

    此例子已经包含本文大部分内容,请对照参考.查看代码 > 定义和用法 table标签定义 HTML 表格. 创建表格的四要素:table.tr.th.td <table> 整个表格以& ...

  4. php面试专题---1、php中变量存储及引用的原理

    php面试专题---1.php中变量存储及引用的原理 一.总结 一句话总结: 查看变量的存储结构可以安装xdebug扩展,用xdebug_debug_zval()方法,不推荐使用memory_get_ ...

  5. 分布式架构下的会话追踪实践【基于Cookie和Redis实现】

    分布式架构下的会话追踪实践[基于Cookie和Redis实现] 博客分类: NoSQL/Redis/MongoDB session共享rediscookie分布式架构session 在单台Tomcat ...

  6. appium移动端自动化测试的一些感想

    花了一个多月的时间来复习,学习appium+python+android的UI层的自动化测试. 从最开始的环境搭建,都后面运行脚本报错各类错,到优化脚本结构,基本上问题不断. 相比,selenium做 ...

  7. C#链接mysql出现 One of the identified items was in an invalid format

    这个问题在tolist查询结果的时候就会出现但是count就不会出现,后来才发现是数据生成工具生成出来的ID有问题导致的,只要保证iD不重复并且按照指定的类型建立ID就可以了

  8. Problem accessing /jenkins/. Reason:

    这是一个Jenkins的Bug.临时解决方法是:在浏览器中手工输入:http://<ip>:<port>.不要访问"/jenkins"这个路径.

  9. Python多进程编程-进程间协作(Queue、Lock、Semaphore、Event、Pipe)

    进程与进程之间是相互独立的,互不干扰.如果多进程之间需要对同一资源操作,就需要进程间共享变量,上一篇文章介绍了进程间共享数据的三大类Value.Array.Manager,这三种类的主要区别在于管理的 ...

  10. upc组队赛14 Floating-Point Hazard【求导】

    Floating-Point Hazard 题目描述 Given the value of low, high you will have to find the value of the follo ...