【Flutter学习】基本组件之进度条(LinearProgressIndicator, CircularProgressIndicator)
一,概述
基本有两种类型:
- 条形进度条(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)的更多相关文章
- 使用tqdm组件构造程序进度条
使用tqdm组件构造程序进度条 觉得有用的话,欢迎一起讨论相互学习~Follow Me 主要代码 import tqdm # 引用tqdm组件 TRAIN_STEPS = N for i in tqd ...
- 第33讲 UI组件_进度条ProcessBar和消息队列处理器handler
第33讲UI组件_进度条ProcessBar和消息队列处理器handler 1. 进度条ProcessBar 一个可视化的进度指示器,代表正在执行的耗时任务.可以为用户展示一个进度条,表示正在执行的任 ...
- progress组件(进度条)
progress组件:进度条 progress组件的属性: percent:类型:number 设置百分比 (0~100) show-info:类型:布尔 在进度条右侧显示百分比 border-rad ...
- jqueryui组件progressbar进度条和日期组件datepickers的简单使用
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 自己定义View学习之12/7(进度条之混合模式)
今天重点内容是我们学习自己定义view里面的混合模式.事实上我们的画布就跟photoshop一样.是个图层关系,一层盖着一层.这样就导致有非常多种覆盖模式,这就是我们今天的主题."混合模式& ...
- 【Flutter学习】组件学习之目录
01. Flutter组件-Layout-Container-容器 02. Flutter组件-Text-Text-文本 03. Flutter组件-Text-RichText-富文本 04. ...
- android学习笔记20——ProgressDialog进度条对话框
ProgressDialog==>进度条对话框 ProgressDialog本身就代表一个进度条对话框,程序只需要创建ProgressDialog实例,并将其显示出来就是一个进度条对话框:开发者 ...
- ftk学习记录(一个进度条文章)
[ 声明:版权全部,欢迎转载,请勿用于商业用途. 联系信箱:feixiaoxing @163.com] 首先.在開始今天的文章之前.我们还是给朋友们展示一下前面一段代码的执行效果.效果例如以下, w ...
- Android学习笔记_76_Android ProgressBar 进度条
android 进度条的样式 例1:(默认样式(中等圆形))Xml代码 <ProgressBar android:id="@+id/progressBar1" ...
随机推荐
- Word中页码及目录、参考文献的制做方法
1.页码从正文开始 1.要想从哪里显示第一页,就在这页的前一页的最后一行最后的地方,插入分隔符---下一页2.然后在你想显示第一页的那一页双击页脚处,点击取消掉“链接到前一条页眉”.(这是为了取消原来 ...
- Delphi TextFile读取文本文件
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- [杂题]:C/c(二分答案)
题目传送门(内部题54) 输入格式 第一行一个整数表示$n$.第二行$n$个整数表示初始序列.(这行原题没有,是我加的)接下来$2n$行每行两个整数,分别表示$X_i,Y_i$.数据保证至少存在一种方 ...
- html&css面试笔记
1.CSS选择器有哪些?它们的优先级是怎样的? 选择器类型: id选择器 ( # myid) 类选择器 (.myclassname) 标签选择器 (div, h1, p) 相邻选择器 (h1 + p) ...
- 【ERP知识】一个VMI(供应商管理库存)实现方案
VMI,Vendor Managed Inventory,供应商管理库存 是指客户不采购或尽量少采购物料,而是由供应商保证该物料有充足的数量,在客户需要的时候能按时提供. 这样可以降低客户方的库存成本 ...
- MySQL操作数据库值mysql事务
创建一个无参数的事务 注意要写START TRANSACTION或者是Begin;Mysql会默认直接执行一个单元 MYSQL默认是自动提交的,也就是你提交一个QUERY,它就直接执行!我们可 ...
- webform将一个usercontrol作为模态框在page上弹出
弹窗 public static void RegisterJQueryDialogScript(Page page, string dialogDivId, string title, int wi ...
- DTED文件结构
注:DTED层级为1时,每列总计2414字节,包含1201个高度信息:DTED层级为2时,每列总计7214字节,包含3601个高度信息:DTED层级为3时,每列包含9001个高度信息. 每列数据前八个 ...
- sql查询某个时间内的数据
hour) 七天之前的数据 SELECT * FROM commodity_order where create_time <= (now()-INTERVAL 7 DAY) order by ...
- 用shell脚本实现MongoDB数据库自动备份
一.创建MongoDB备份目录 用来存放数据 mkdir -p /data/mongodb_bak/mongodb_bak_now mkdir -p /data/mongodb_bak/mongodb ...