我正在使用 Flutter 开发一个应用程序。一旦满足某个条件,我需要显示一个对话框。完成后,不会显示对话框,但屏幕会变暗,就像正在显示对话框一样。
showEndGamePopUp() {
showDialog<void>(
context: context,
builder: (_) {
return Container(
child: SimpleDialog(
backgroundColor: Colors.black,
elevation: 2.0,
title: Text(
"$playerTurn wins!",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
height: 1.5,
),
),
children: <Widget>[
SimpleDialogOption(
onPressed: () => Navigator.pop(context),
child: Text("Play again"),
),
SimpleDialogOption(
onPressed: () => exit(0),
child: Text("Exit"),
),
],
),
);
},
);
}
我得到以下异常:RenderBox was not laid out: RenderCustomPaint#3d792 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UP
.