class LoadingDialog extends Dialog {
String title; //自定义加载框文本供外部使用
LoadingDialog(this.title);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Material(
type: MaterialType.transparency,
child: Center(
child: Container(
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)))),
width: 100,
height: 100,
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(height: 10),
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.red),//指示器颜色
),
SizedBox(
height: 10,
),
Text(
'${this.title}',
style: TextStyle(fontSize: 12, color: Colors.grey),
softWrap: false,
)//加载框文字样式 及 内容
],
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
),
);
}
}```
2021-05-07 自定义Flutter Loading加载框
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 学习完列表渲染后,我打算做一个综合一点的练习小项目:豆瓣Top电影排行列表; 这个练习小项目主要是为了锻炼布局Wi...
- 这个章节本来打算讲解Flutter的渲染原理,但是学习初期过多的讲解原理性的内容,并不利于大家快速入门和上手,做出...