From be06affeb4056d5d86b228a5aac8c225707644dd Mon Sep 17 00:00:00 2001 From: arturplaczek Date: Wed, 27 Apr 2022 11:39:29 +0200 Subject: [PATCH] feat: use DialogDecoration in app --- .../view/widgets/play_button_overlay.dart | 10 +------- .../view/character_selection_page.dart | 13 +++++------ .../widgets/how_to_play_dialog.dart | 23 ++++++++----------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/lib/game/view/widgets/play_button_overlay.dart b/lib/game/view/widgets/play_button_overlay.dart index f90ebb98..c0ad324a 100644 --- a/lib/game/view/widgets/play_button_overlay.dart +++ b/lib/game/view/widgets/play_button_overlay.dart @@ -28,15 +28,7 @@ class PlayButtonOverlay extends StatelessWidget { context: context, barrierDismissible: false, builder: (_) { - final height = MediaQuery.of(context).size.height * 0.5; - - return Center( - child: SizedBox( - height: height, - width: height * 1.4, - child: const CharacterSelectionDialog(), - ), - ); + return const CharacterSelectionDialog(); }, ); }, diff --git a/lib/select_character/view/character_selection_page.dart b/lib/select_character/view/character_selection_page.dart index 0e83db8d..fa5c86e3 100644 --- a/lib/select_character/view/character_selection_page.dart +++ b/lib/select_character/view/character_selection_page.dart @@ -1,5 +1,6 @@ // ignore_for_file: public_member_api_docs +import 'package:app_ui/app_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:pinball/l10n/l10n.dart'; @@ -32,17 +33,15 @@ class CharacterSelectionView extends StatelessWidget { Widget build(BuildContext context) { final l10n = context.l10n; - return Scaffold( + return DialogDecoration( + header: Text( + l10n.characterSelectionTitle, + style: Theme.of(context).textTheme.headline3, + ), body: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const SizedBox(height: 80), - Text( - l10n.characterSelectionTitle, - style: Theme.of(context).textTheme.headline3, - ), - const SizedBox(height: 80), const _CharacterSelectionGridView(), const SizedBox(height: 20), TextButton( diff --git a/lib/start_game/widgets/how_to_play_dialog.dart b/lib/start_game/widgets/how_to_play_dialog.dart index aed7a3e3..b91d27e7 100644 --- a/lib/start_game/widgets/how_to_play_dialog.dart +++ b/lib/start_game/widgets/how_to_play_dialog.dart @@ -1,5 +1,6 @@ // ignore_for_file: public_member_api_docs +import 'package:app_ui/app_ui.dart'; import 'package:flutter/material.dart'; import 'package:pinball/l10n/l10n.dart'; @@ -11,19 +12,15 @@ class HowToPlayDialog extends StatelessWidget { final l10n = context.l10n; const spacing = SizedBox(height: 16); - return Dialog( - child: Padding( - padding: const EdgeInsets.all(20), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text(l10n.howToPlay), - spacing, - const _LaunchControls(), - spacing, - const _FlipperControls(), - ], - ), + return DialogDecoration( + header: Text(l10n.howToPlay), + body: Column( + children: const [ + spacing, + _LaunchControls(), + spacing, + _FlipperControls(), + ], ), ); }