I want to display a custom dialog through a button. But i don't want user dismiss the dialog when touching exterior area.
I know that barrierDismissible: false, works but only in showDialog widget. In this case i need to do that but in Dialog widget.
This is what i have:
//RC
class ShowDialogGameOver2RC extends StatefulWidget {
ShowDialogGameOver2RC({required this.score});
late int score;
@override
State<ShowDialogGameOver2RC> createState() => _ShowDialogGameOver2RC();
}
// class dialog GameOver
class _ShowDialogGameOver2RC extends State<ShowDialogGameOver2RC> {
@override
Widget build(BuildContext context) {
return Dialog(
barrierDismissible: false //it doesn't work
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
elevation: 2,
backgroundColor: Colors.transparent,
child: _buildChild(context),
);
}