我具有以下功能来显示对话框,我使用媒体查询将其设置为100%,但是当它运行时,对话框周围仍然有白色边距。
如何归档全屏对话框?
Future<void> showLoadingDialog(BuildContext context, GlobalKey key) async {
Widget myDialog = SimpleDialog(
key: key,
backgroundColor: Colors.black54,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircularProgressIndicator(),
SizedBox(height: 10,),
Text("Please Wait....",style: TextStyle(color: accentColor),)
]),
)
]);
return showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return myDialog;
});
}
答案 0 :(得分:1)
您可以使用showGeneralDialog小部件来完成此操作。
showGeneralDialog(
context: context,
barrierDismissible: true,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black45,
transitionDuration: const Duration(milliseconds: 200),
pageBuilder: (BuildContext buildContext, Animation animation,
Animation secondaryAnimation) {
return Center(
child: Container(
width: MediaQuery.of(context).size.width - 10,
height: MediaQuery.of(context).size.height - 80,
padding: EdgeInsets.all(20),
color: Colors.white,
child: Column(
children: [
RaisedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
"Save",
style: TextStyle(color: Colors.white),
),
color: const Color(0xFF1BC0C5),
)
],
),
),
);
});