feat: use PinballButton to start the game (#288)

pull/300/head
arturplaczek 2 years ago committed by GitHub
parent edf427513a
commit e7717643fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:pinball/game/pinball_game.dart'; import 'package:pinball/game/pinball_game.dart';
import 'package:pinball/l10n/l10n.dart'; import 'package:pinball/l10n/l10n.dart';
import 'package:pinball/select_character/select_character.dart'; import 'package:pinball/select_character/select_character.dart';
import 'package:pinball_ui/pinball_ui.dart';
/// {@template play_button_overlay} /// {@template play_button_overlay}
/// [Widget] that renders the button responsible to starting the game /// [Widget] that renders the button responsible to starting the game
@ -20,14 +21,12 @@ class PlayButtonOverlay extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = context.l10n; final l10n = context.l10n;
return Center( return PinballButton(
child: ElevatedButton( text: l10n.play,
onPressed: () async { onTap: () async {
_game.gameFlowController.start(); _game.gameFlowController.start();
await showCharacterSelectionDialog(context); await showCharacterSelectionDialog(context);
}, },
child: Text(l10n.play),
),
); );
} }
} }

@ -21,7 +21,9 @@ class PinballButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DecoratedBox( return Material(
color: PinballColors.transparent,
child: DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage(Assets.images.button.pinballButton.keyName), image: AssetImage(Assets.images.button.pinballButton.keyName),
@ -45,6 +47,7 @@ class PinballButton extends StatelessWidget {
), ),
), ),
), ),
),
); );
} }
} }

Loading…
Cancel
Save