我试图在我的颤动应用程序中单击按钮显示 CircularProgressIndicator
但它不会呈现循环进度条,但是一旦我更改代码以使用 LinearProgressBar
,进度条就没有任何问题 . 所以想知道我需要显示圆形加载指示器的任何特殊设置吗?
Works
if (_isFetching) {
return new Scaffold(
body: new Center(
child: new SizedBox(
width: 40.0,
height: 40.0,
child: const LinearProgressIndicator(backgroundColor: Colors.black)),
));
}
Do not work
if (_isFetching) {
return new Scaffold(
body: new Center(
child: new SizedBox(
width: 40.0,
height: 40.0,
child: const CircularProgressIndicator(backgroundColor: Colors.black)),
));
}
2 回答
你可以在这里参考docs . 您正在使用backgroundColor属性,该属性仅定义指标的背景颜色而不是指标的类型 . 我正在使用
null
作为Indeterminate类型 . 您可以使用valueColor
[doc]属性更改指示器的颜色 . 这是简单的代码,它工作正常 .确保进度条的值颜色与父窗口小部件的背景颜色不同 . 试试这个: