Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 线性投影指示器颜色_Flutter - Fatal编程技术网

Flutter 线性投影指示器颜色

Flutter 线性投影指示器颜色,flutter,Flutter,如果我使用以下代码创建小部件: child: new Row(children: <Widget>[ new Expanded( child: LinearProgressIndicator(value: _animation.value, valueColor: AlwaysStoppedAnimation<Color>(Colors.white)), ), ]), 子项:新行(子项:[ 新扩展( 子项:LinearPr

如果我使用以下代码创建小部件:

child: new Row(children: <Widget>[
      new Expanded(
        child: LinearProgressIndicator(value: _animation.value, valueColor: AlwaysStoppedAnimation<Color>(Colors.white)),
      ),
    ]),
子项:新行(子项:[
新扩展(
子项:LinearProgressIndicator(值:_animation.value,值Color:AlwaysStoppedAnimation(Colors.white)),
),
]),

我以后如何访问设置程序来修改,例如LinearProgressIndicator值或valueColor?

您必须调用
setState
进行更改

child: LinearProgressIndicator(value: _animation.value, valueColor: AlwaysStoppedAnimation<Color>(colorValue))

实际上,也可以有其他解决方案,例如,创建用于显示进度的自定义小部件,使用FutureBuilder或StreamBuilder。设置状态-这是更改某些内容最简单的方法

那么,您是否检查了答案,找到了您要查找的内容?
setState((){
    colorValue = /* new color */
});