CircularProgressIndicator 未显示在颤动中

Aja*_*wal 5 dart flutter

我试图CircularProgressIndicator在单击按钮时在我的颤振应用程序中显示 ,但它不会呈现圆形进度条,但是一旦我更改代码以使用LinearProgressBar进度条,就没有任何问题。所以想知道是否有任何特殊设置需要显示循环加载指示器?

作品

if (_isFetching) {
  return new Scaffold(
    body: new Center(
      child: new SizedBox(
        width: 40.0,
        height: 40.0,
        child: const LinearProgressIndicator(backgroundColor: Colors.black)),
  ));
}
Run Code Online (Sandbox Code Playgroud)

不工作

if (_isFetching) {
  return new Scaffold(
    body: new Center(
      child: new SizedBox(
        width: 40.0,
        height: 40.0,
        child: const CircularProgressIndicator(backgroundColor: Colors.black)),
  ));
}
Run Code Online (Sandbox Code Playgroud)

ap1*_*p14 1

您可以参考此处的文档。您使用的backgroundColor属性仅定义指示器的背景颜色,而不定义指示器的类型。我用于null不确定类型。您可以使用valueColor[ doc ] 属性来更改指示器的颜色。这是简单的代码并且运行良好。

if (_isFetching) {
          return new Scaffold(
              body: new Center(
            child: new SizedBox(
                width: 40.0,
                height: 40.0,
                child:
                    const CircularProgressIndicator(
        value: null,
        strokeWidth: 2.0,
      )),
          ));
        }
Run Code Online (Sandbox Code Playgroud)