I'm developing an app using Flutter. I need to show a dialog box once a certain condition is fulfilled. When it's fulfilled, the dialog box is not shown, but the screen is dimmed as if the dialog box is being shown.
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"),
),
],
),
);
},
);
}
And I get the following exception: RenderBox was not laid out: RenderCustomPaint#3d792 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UP
.