chore: add on dismiss callback to HowToPlayDialog

pull/254/head
arturplaczek 3 years ago
parent f60d29b7d1
commit 12ce2083b3

@ -5,22 +5,33 @@ import 'package:pinball/l10n/l10n.dart';
import 'package:pinball_ui/pinball_ui.dart'; import 'package:pinball_ui/pinball_ui.dart';
class HowToPlayDialog extends StatelessWidget { class HowToPlayDialog extends StatelessWidget {
const HowToPlayDialog({Key? key}) : super(key: key); const HowToPlayDialog({
Key? key,
required this.onDismissCallback,
}) : super(key: key);
final VoidCallback onDismissCallback;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = context.l10n; final l10n = context.l10n;
const spacing = SizedBox(height: 16); const spacing = SizedBox(height: 16);
return PixelatedDecoration( return WillPopScope(
header: Text(l10n.howToPlay), onWillPop: () {
body: ListView( onDismissCallback.call();
children: const [ return Future.value(true);
spacing, },
_LaunchControls(), child: PixelatedDecoration(
spacing, header: Text(l10n.howToPlay),
_FlipperControls(), body: ListView(
], children: const [
spacing,
_LaunchControls(),
spacing,
_FlipperControls(),
],
),
), ),
); );
} }

@ -9,10 +9,14 @@ import '../../helpers/helpers.dart';
void main() { void main() {
group('HowToPlayDialog', () { group('HowToPlayDialog', () {
testWidgets('displays content', (tester) async { testWidgets('displays dialog', (tester) async {
final l10n = await AppLocalizations.delegate.load(Locale('en')); final l10n = await AppLocalizations.delegate.load(Locale('en'));
await tester.pumpApp(HowToPlayDialog()); await tester.pumpApp(
HowToPlayDialog(
onDismissCallback: () {},
),
);
expect(find.text(l10n.launchControls), findsOneWidget); expect(find.text(l10n.launchControls), findsOneWidget);
}); });

Loading…
Cancel
Save