strokeWidth:用于绘制圆的线条的宽度。
backgroundColor:背景颜色。
value:如果为非null,则该进度指示器的值为0.0,对应于没有进度,1.0对应于所有进度。
valueColor:动画的颜色值。
在flutter中 CircleProgressIndicator 默认颜色为 主题设定的颜色。
CircleProgressIndicator的参数有3种:
value,0~1的浮点数,用来表示进度多少。
valueColor,是animation类型的参数,用来设定进度值的颜色。
backgroundColor,背景颜色,不太好用。
更改进度条的颜色 我们用 valueColor,直接晒代码:
CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(Colors.yellow),),
如果不需要自定义动画风格,就直接传AlwaysStoppedAnimation就好了。
return AlertDialog( content: Container( child: Row( children: <Widget>[ CircularProgressIndicator( strokeWidth: 2, valueColor: AlwaysStoppedAnimation(Colors.pink), ), if (msg != null) SizedBox(width: 25), if (msg != null) Text('加载中'), ], ), ), );