|
|
@ -23,16 +23,17 @@ class _GameHudState extends State<GameHud> {
|
|
|
|
|
|
|
|
|
|
|
|
/// Ratio from sprite frame (width 500, height 144) w / h = ratio
|
|
|
|
/// Ratio from sprite frame (width 500, height 144) w / h = ratio
|
|
|
|
static const _ratio = 3.47;
|
|
|
|
static const _ratio = 3.47;
|
|
|
|
static const _width = 265.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final isGameOver = context.select((GameBloc bloc) => bloc.state.isGameOver);
|
|
|
|
final isGameOver = context.select((GameBloc bloc) => bloc.state.isGameOver);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final height = _calculateHeight(context);
|
|
|
|
|
|
|
|
|
|
|
|
return _ScoreViewDecoration(
|
|
|
|
return _ScoreViewDecoration(
|
|
|
|
child: SizedBox(
|
|
|
|
child: SizedBox(
|
|
|
|
height: _width / _ratio,
|
|
|
|
height: height,
|
|
|
|
width: _width,
|
|
|
|
width: height * _ratio,
|
|
|
|
child: BlocListener<GameBloc, GameState>(
|
|
|
|
child: BlocListener<GameBloc, GameState>(
|
|
|
|
listenWhen: (previous, current) =>
|
|
|
|
listenWhen: (previous, current) =>
|
|
|
|
previous.bonusHistory.length != current.bonusHistory.length,
|
|
|
|
previous.bonusHistory.length != current.bonusHistory.length,
|
|
|
@ -53,6 +54,17 @@ class _GameHudState extends State<GameHud> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
class _ScoreViewDecoration extends StatelessWidget {
|
|
|
|