一,概述

  基本有两种类型:

  • 条形进度条(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. CF 1172E Nauuo and ODT ——LCT

    题目:http://codeforces.com/contest/1172/problem/E LCT好题. 考虑对每个颜色求出 “不是该颜色的点组成的连通块的 siz2 之和” .每个颜色用 LCT ...

  2. 后端技术杂谈3:Lucene基础原理与实践

    本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下 ...

  3. 点击按钮后URL呗改变

    这里留个坑,Button默认类型是submit.没有写类型的,可能会导致触发Url改变.要么写类型,要么在按钮对应的Js方法里return.

  4. kPagination纯js实现分页插件

    kPagination分页插件 纯js分页插件,压缩版本~4kb,样式可以自定义 demo 使用方法 <div id="pagination"></div> ...

  5. mysql oracle sqlserver三种数据库count函数返回值不一样

    SQLQuery countSqlQuery = userDAO.createSQLQuery("select count(id) from fhcb_08_tbl_user"); ...

  6. xcode安装pod

    参考了: https://blog.csdn.net/AugustDY/article/details/92078639 输入 ruby -v ,查看当前电脑的ruby版本,如果已经安装了ruby环境 ...

  7. charles抓包看性能数据

    1.优化某个接口或加载速度(H5加载速度慢) 抓包看Overview ①看Duration,就是接口的加载时间 ②看Latency,就是延时一端传播到另一端所花费的时间:一般和网络有关:可以综合Dur ...

  8. shell cp拷贝的用法

    个人觉得这个记录的比较全 自己查阅: cp [options] <source file or directory> <target file or directory> 或 ...

  9. JS高级程序随笔二

    var person1={ toLoginString:function(){ return "lili"; }, toString2:function(){ return &qu ...

  10. DNS解析全过程详解

    1.Chrome浏览器 会首先搜索浏览器自身的DNS缓存(缓存时间比较短,大概只有1分钟,且只能容纳1000条缓存),看自身的缓存中是否有www.linux178.com 对应的条目,而且没有过期,如 ...