mirror of https://github.com/flutter/pinball.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
import 'package:flutter/material.dart';
|
|
import 'package:pinball/game/pinball_game.dart';
|
|
import 'package:pinball/l10n/l10n.dart';
|
|
import 'package:pinball/theme/theme.dart';
|
|
|
|
/// {@template play_button_overlay}
|
|
/// [Widget] that renders the button responsible to starting the game
|
|
/// {@endtemplate}
|
|
class PlayButtonOverlay extends StatelessWidget {
|
|
/// {@macro play_button_overlay}
|
|
const PlayButtonOverlay({
|
|
Key? key,
|
|
required PinballGame game,
|
|
}) : _game = game,
|
|
super(key: key);
|
|
|
|
final PinballGame _game;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = context.l10n;
|
|
|
|
return Center(
|
|
child: ElevatedButton(
|
|
onPressed: () {
|
|
_game.gameFlowController.start();
|
|
showDialog<void>(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
builder: (_) {
|
|
final height = MediaQuery.of(context).size.height * 0.5;
|
|
|
|
return Center(
|
|
child: SizedBox(
|
|
height: height,
|
|
width: height * 1.4,
|
|
child: const CharacterSelectionDialog(),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
child: Text(l10n.play),
|
|
),
|
|
);
|
|
}
|
|
}
|