|
|
@ -51,7 +51,6 @@ class PinballGamePage extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
|
|
return MultiBlocProvider(
|
|
|
|
return MultiBlocProvider(
|
|
|
|
providers: [
|
|
|
|
providers: [
|
|
|
|
BlocProvider(create: (_) => StartGameBloc(game: game)),
|
|
|
|
|
|
|
|
BlocProvider(create: (_) => GameBloc()),
|
|
|
|
BlocProvider(create: (_) => GameBloc()),
|
|
|
|
BlocProvider(create: (_) => AssetsManagerCubit(loadables)..load()),
|
|
|
|
BlocProvider(create: (_) => AssetsManagerCubit(loadables)..load()),
|
|
|
|
],
|
|
|
|
],
|
|
|
@ -96,11 +95,16 @@ class PinballGameLoadedView extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
final isPlaying = context.select(
|
|
|
|
|
|
|
|
(StartGameBloc bloc) => bloc.state.status == StartGameStatus.play,
|
|
|
|
|
|
|
|
);
|
|
|
|
final gameWidgetWidth = MediaQuery.of(context).size.height * 9 / 16;
|
|
|
|
final gameWidgetWidth = MediaQuery.of(context).size.height * 9 / 16;
|
|
|
|
final screenWidth = MediaQuery.of(context).size.width;
|
|
|
|
final screenWidth = MediaQuery.of(context).size.width;
|
|
|
|
final leftMargin = (screenWidth / 2) - (gameWidgetWidth / 1.8);
|
|
|
|
final leftMargin = (screenWidth / 2) - (gameWidgetWidth / 1.8);
|
|
|
|
|
|
|
|
|
|
|
|
return Stack(
|
|
|
|
return StartGameListener(
|
|
|
|
|
|
|
|
game: game,
|
|
|
|
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Positioned.fill(
|
|
|
|
Positioned.fill(
|
|
|
|
child: GameWidget<PinballGame>(
|
|
|
|
child: GameWidget<PinballGame>(
|
|
|
@ -108,24 +112,26 @@ class PinballGameLoadedView extends StatelessWidget {
|
|
|
|
initialActiveOverlays: const [PinballGame.playButtonOverlay],
|
|
|
|
initialActiveOverlays: const [PinballGame.playButtonOverlay],
|
|
|
|
overlayBuilderMap: {
|
|
|
|
overlayBuilderMap: {
|
|
|
|
PinballGame.playButtonOverlay: (context, game) {
|
|
|
|
PinballGame.playButtonOverlay: (context, game) {
|
|
|
|
return Positioned(
|
|
|
|
return const Positioned(
|
|
|
|
bottom: 20,
|
|
|
|
bottom: 20,
|
|
|
|
right: 0,
|
|
|
|
right: 0,
|
|
|
|
left: 0,
|
|
|
|
left: 0,
|
|
|
|
child: PlayButtonOverlay(game: game),
|
|
|
|
child: PlayButtonOverlay(),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// TODO(arturplaczek): add Visibility to GameHud based on StartGameBloc
|
|
|
|
|
|
|
|
// status
|
|
|
|
|
|
|
|
Positioned(
|
|
|
|
Positioned(
|
|
|
|
top: 16,
|
|
|
|
top: 16,
|
|
|
|
left: leftMargin,
|
|
|
|
left: leftMargin,
|
|
|
|
|
|
|
|
child: Visibility(
|
|
|
|
|
|
|
|
visible: isPlaying,
|
|
|
|
child: const GameHud(),
|
|
|
|
child: const GameHud(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|