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

2021-05-07  本文已影响0人  耀木i

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,
          ),
        ),
      ),
    );
  }
}```
上一篇 下一篇

猜你喜欢

热点阅读