Flutter 自定义loading及使用
1.首先写一个公共组件
new Material(
type: MaterialType.transparency,
child: new Center(
child: new SizedBox(
width: 120.0,
height: 120.0,
child: new Container(
decoration: ShapeDecoration(
color: Color(0xffffffff),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
),
),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation(Color(0xffAA1F52))),
new Padding(
padding: const EdgeInsets.only(
top: 20.0,
),
child: new Text(widget.text),
),
],
),
),
),
),
);
2.封装loading组建
void showLoading(BuildContext context,String text){
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return new Loading(
text,
);
}
);
}
3.调用loading弹窗
showLoading(context, "加载中");
效果如下:::
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。