Flutter, How to remove white spaces around dialog

2020-07-14 05:19发布

I am calling this dialog while getting data from server. This dialog box is having white spaces around it. I can I remove this white space around my dialog box. Here is my code.

var bodyProgress = new Container(
 decoration: new BoxDecoration(
  color: Colors.blue[200],
  borderRadius: new BorderRadius.circular(10.0)
 ),
width: 300.0,
height: 200.0,
//color: Colors.blue,
alignment: AlignmentDirectional.center,
child: new Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
  new Center(
    child: new SizedBox(
      height: 50.0,
      width: 50.0,
      child: new CircularProgressIndicator(
        value: null,
        strokeWidth: 7.0,
      ),
    ),
  ),
  new Container(
    margin: const EdgeInsets.only(top: 25.0),
    child: new Center(
      child: new Text(
        "Signing up...",
        style: new TextStyle(
            color: Colors.white
           ),
         ),
       ),
     ),
   ],
  ),
);

Here I am calling this dialog. I've tried with both AlertDialog() and SimpleDialog() having same issue with both.

showDialog(context: context, child: new AlertDialog(
  content: bodyProgress,

));

enter image description here

3条回答
叼着烟拽天下
2楼-- · 2020-07-14 05:57

Inside AlertDialog set contentPadding 0

contentPadding: EdgeInsets.all(0.0),
查看更多
劳资没心,怎么记你
3楼-- · 2020-07-14 06:08

Don't use AlertDialog at all. Just send bodyProgress to showDialog

showDialog(context: context, builder: (_) => bodyProgress,);
查看更多
淡お忘
4楼-- · 2020-07-14 06:23

add the file to your project https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/dialog.dart, use the CustomAlertDialog and set the contentPadding to 0.0 by using EdgeInsets.all(0.0), finally adjust the border raidius to that of your bodyprogress

查看更多
登录 后发表回答