flutter Material-信息显示
1.CircularProgressIndicator
循环进度
圆形
Center( child: Column( children: <Widget>[ RaisedButton( child: Text("aa"), onPressed: () {}, ), CircularProgressIndicator() ], ), )
更换颜色
CircularProgressIndicator( valueColor: new AlwaysStoppedAnimation<Color>(Colors.green), ),
独立页面
loading(BuildContext context) { showDialog<Null>( context: context, //BuildContext对象 barrierDismissible: false, builder: (BuildContext context) { return LoadingDialog( //调用对话框 text: '正在加载请稍后...', ); }); } class LoadingDialog extends Dialog { final String text; LoadingDialog({Key key, @required this.text}) : super(key: key); @override Widget build(BuildContext context) { return WillPopScope( onWillPop: () => Future.value(false), //禁止返回 child: Material( //创建透明层 type: MaterialType.transparency, //透明类型 child: Center( //保证控件居中效果 child: SizedBox( width: 200.0, height: 200.0, child: Container( // decoration: ShapeDecoration( // color: Color(0xffffffff), // // color: Color(0xffffffff), // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.all( // Radius.circular(8.0), // ), // ), // ), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>(Colors.grey), ), Padding( padding: const EdgeInsets.only( top: 20.0, ), child: Text( text, style: TextStyle(fontSize: 16.0, color: Colors.white), ), ), ], ), ), ), ), )); } }
直线
LinearProgressIndicator()