一,概述

  基本有两种类型:

  • 条形进度条(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. Apache Flink 的迁移之路,2 年处理效果提升 5 倍

    一.背景与痛点 在 2017 年上半年以前,TalkingData 的 App Analytics 和 Game Analytics 两个产品,流式框架使用的是自研的 td-etl-framework ...

  2. [CSP-S模拟测试]:平均数(二分答案+归并排序)

    题目描述 有一天,小$A$得到了一个长度为$n$的序列.他把这个序列的所有连续子序列都列了出来,并对每一个子序列都求了其平均值,然后他把这些平均值写在纸上,并对它们进行排序,最后他报出了第$k$小的平 ...

  3. python的迭代器(转自廖雪峰老师python基础)

    我们已经知道,可以直接作用于for循环的数据类型有以下几种:一类是集合数据类型,如list.tuple.dict.set.str等:一类是generator,包括生成器和带yield的generato ...

  4. 如何利用nginx实现负载均衡(总结)

    如何利用nginx实现负载均衡(总结) 一.总结 一句话总结: 推荐使用nginx七层(应用层)负载均衡的实现:配置那是相当的简单 1.nginx配置实例? |||-begin #这里的域名要和下面p ...

  5. flask扩展系列之 - 访问速度限制

    flask-limiter 是一个对客户端的访问速率进行限制的flask扩展.可以自定义一些访问的(速度)限制条件来把那些触发限制的请求拒之门外.一般常用来进行对爬虫的限制. 下面就常见的用法,举了一 ...

  6. CSS深入理解line-height

    1.line-height高度基于基线 2. 3.p元素的高度由行高决定的 4. 5.

  7. 【翻译自mos文章】oraclepassword管理策略

    oraclepassword管理策略 參考原文: Oracle Password Management Policy (Doc ID 114930.1) 细节: password管理通过使用profi ...

  8. Dagger2 探索记2——四大基本组件(二)

    书接上文,先回顾以下前一章写的内容. 内容大概就是在Activity中用@Inject标记一个注入的类,然后在这个类的构造函数上也打个@Inject标记,然后使用@Component来连接两边,完成对 ...

  9. 【原创】微信最新表情js代码

    最近在做仿微信聊天表情发送功能,所以需要展示常用的105个表情. 因为对接微信公众号的时候,用户聊天过程中发送的表情,微信服务器会转成对应的代码传给我们的服务器,类似如下: :/::)/::~/::B ...

  10. 自动化运维工具ansible简单介绍

    ansible架构图 ansible安装(centos7环境下) yum update yum install ansible 验证ansible是否成功安装 ansible --version an ...