From 8d10cf6434e753d8ab6bd9e0ef0f12a05685b9c2 Mon Sep 17 00:00:00 2001 From: Jochum van der Ploeg Date: Mon, 2 May 2022 17:45:40 +0200 Subject: [PATCH] fix: how to play screen can't be dismissed (#293) Co-authored-by: Tom Arra --- .../widgets/how_to_play_dialog.dart | 1 - test/how_to_play/how_to_play_dialog_test.dart | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/how_to_play/widgets/how_to_play_dialog.dart b/lib/how_to_play/widgets/how_to_play_dialog.dart index 766944b9..3dc2c62b 100644 --- a/lib/how_to_play/widgets/how_to_play_dialog.dart +++ b/lib/how_to_play/widgets/how_to_play_dialog.dart @@ -52,7 +52,6 @@ extension on Control { Future showHowToPlayDialog(BuildContext context) { return showDialog( context: context, - barrierDismissible: false, builder: (_) => HowToPlayDialog(), ); } diff --git a/test/how_to_play/how_to_play_dialog_test.dart b/test/how_to_play/how_to_play_dialog_test.dart index 24c683a4..2e3d3fd4 100644 --- a/test/how_to_play/how_to_play_dialog_test.dart +++ b/test/how_to_play/how_to_play_dialog_test.dart @@ -73,5 +73,25 @@ void main() { await tester.pumpAndSettle(); expect(find.byType(HowToPlayDialog), findsNothing); }); + + testWidgets('can be dismissed', (tester) async { + await tester.pumpApp( + Builder( + builder: (context) { + return TextButton( + onPressed: () => showHowToPlayDialog(context), + child: const Text('test'), + ); + }, + ), + ); + expect(find.byType(HowToPlayDialog), findsNothing); + await tester.tap(find.text('test')); + await tester.pumpAndSettle(); + + await tester.tapAt(Offset.zero); + await tester.pumpAndSettle(); + expect(find.byType(HowToPlayDialog), findsNothing); + }); }); }