|
|
@ -23,11 +23,12 @@ 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 gameWidgetWidth = MediaQuery.of(context).size.height * 9 / 16;
|
|
|
|
|
|
|
|
final _width = gameWidgetWidth / 1.6;
|
|
|
|
|
|
|
|
|
|
|
|
return _ScoreViewDecoration(
|
|
|
|
return _ScoreViewDecoration(
|
|
|
|
child: SizedBox(
|
|
|
|
child: SizedBox(
|
|
|
@ -37,6 +38,8 @@ class _GameHudState extends State<GameHud> {
|
|
|
|
listenWhen: (previous, current) =>
|
|
|
|
listenWhen: (previous, current) =>
|
|
|
|
previous.bonusHistory.length != current.bonusHistory.length,
|
|
|
|
previous.bonusHistory.length != current.bonusHistory.length,
|
|
|
|
listener: (_, __) => setState(() => showAnimation = true),
|
|
|
|
listener: (_, __) => setState(() => showAnimation = true),
|
|
|
|
|
|
|
|
child: FittedBox(
|
|
|
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
duration: kThemeAnimationDuration,
|
|
|
|
duration: kThemeAnimationDuration,
|
|
|
|
child: showAnimation && !isGameOver
|
|
|
|
child: showAnimation && !isGameOver
|
|
|
@ -51,6 +54,7 @@ class _GameHudState extends State<GameHud> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -68,9 +72,7 @@ class _ScoreViewDecoration extends StatelessWidget {
|
|
|
|
const radius = BorderRadius.all(Radius.circular(12));
|
|
|
|
const radius = BorderRadius.all(Radius.circular(12));
|
|
|
|
const borderWidth = 5.0;
|
|
|
|
const borderWidth = 5.0;
|
|
|
|
|
|
|
|
|
|
|
|
return Opacity(
|
|
|
|
return DecoratedBox(
|
|
|
|
opacity: 0.7,
|
|
|
|
|
|
|
|
child: DecoratedBox(
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: radius,
|
|
|
|
borderRadius: radius,
|
|
|
|
border: Border.all(
|
|
|
|
border: Border.all(
|
|
|
@ -91,7 +93,6 @@ class _ScoreViewDecoration extends StatelessWidget {
|
|
|
|
child: child,
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|