Flutter 自定义loading及使用

   日期:2020-04-30     浏览:275    评论:0    
核心提示:Flutter 自定义loading及使用1.首先写一个公共组件2.封装loading组建3.调用l移动开发

Flutter 自定义loading及使用

    • 1.首先写一个公共组件
    • 2.封装loading组建
    • 3.调用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, "加载中");

效果如下:::

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服