美文网首页
2021-05-07 自定义Flutter Loading加载框

2021-05-07 自定义Flutter Loading加载框

作者: 耀木i | 来源:发表于2021-05-07 13:22 被阅读0次

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加载框

      本文链接:https://www.haomeiwen.com/subject/hxbsdltx.html