diff --git a/lib/game/view/widgets/game_hud.dart b/lib/game/view/widgets/game_hud.dart index 2c7d74bf..c569189f 100644 --- a/lib/game/view/widgets/game_hud.dart +++ b/lib/game/view/widgets/game_hud.dart @@ -27,36 +27,44 @@ class _GameHudState extends State { @override Widget build(BuildContext context) { final isGameOver = context.select((GameBloc bloc) => bloc.state.isGameOver); - final gameWidgetWidth = MediaQuery.of(context).size.height * 9 / 16; - final _width = gameWidgetWidth / 1.6; + + final height = _calculateHeight(context); return _ScoreViewDecoration( child: SizedBox( - height: _width / _ratio, - width: _width, + height: height, + width: height * _ratio, child: BlocListener( listenWhen: (previous, current) => previous.bonusHistory.length != current.bonusHistory.length, listener: (_, __) => setState(() => showAnimation = true), - child: FittedBox( - alignment: Alignment.centerLeft, - child: AnimatedSwitcher( - duration: kThemeAnimationDuration, - child: showAnimation && !isGameOver - ? _AnimationView( - onComplete: () { - if (mounted) { - setState(() => showAnimation = false); - } - }, - ) - : const ScoreView(), - ), + child: AnimatedSwitcher( + duration: kThemeAnimationDuration, + child: showAnimation && !isGameOver + ? _AnimationView( + onComplete: () { + if (mounted) { + setState(() => showAnimation = false); + } + }, + ) + : const ScoreView(), ), ), ), ); } + + double _calculateHeight(BuildContext context) { + final height = MediaQuery.of(context).size.height * 0.09; + if (height > 90) { + return 90; + } else if (height < 60) { + return 60; + } else { + return height; + } + } } class _ScoreViewDecoration extends StatelessWidget { diff --git a/lib/game/view/widgets/score_view.dart b/lib/game/view/widgets/score_view.dart index 1fe57eb1..780763f3 100644 --- a/lib/game/view/widgets/score_view.dart +++ b/lib/game/view/widgets/score_view.dart @@ -18,7 +18,7 @@ class ScoreView extends StatelessWidget { return Padding( padding: const EdgeInsets.symmetric( horizontal: 16, - vertical: 8, + vertical: 2, ), child: AnimatedSwitcher( duration: kThemeAnimationDuration, @@ -71,9 +71,11 @@ class _ScoreText extends StatelessWidget { Widget build(BuildContext context) { final score = context.select((GameBloc bloc) => bloc.state.score); - return Text( - score.formatScore(), - style: Theme.of(context).textTheme.headline1, + return FittedBox( + child: Text( + score.formatScore(), + style: Theme.of(context).textTheme.headline2, + ), ); } }