首页 > 建站教程 > APP开发,混合APP >  Flutter笔记42:ProgressIndicator进度条组件正文

Flutter笔记42:ProgressIndicator进度条组件

Flutter ProgressIndicator进度条组件主要两种:圆形进度条CircularProgressIndicator和LinearProgressIndicator:
class _DemoPageState extends State<DemoPage> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child:Column(
        children: [
          //圆形进度条
          CircularProgressIndicator(
            //背景色
            backgroundColor: Colors.red,
            //值的颜色
            valueColor: AlwaysStoppedAnimation(Colors.yellow),
            //值,范围 0-1,设置了值,就静止
            value: .3,
          ),
          //条形进度条
          LinearProgressIndicator(
            //背景色
            backgroundColor: Colors.red,
            //值的颜色
            valueColor: AlwaysStoppedAnimation(Colors.yellow),
            //值,范围 0-1,设置了值,就静止
            value: .3,
          )
        ],
      ),
    );
  }
}