mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 20:36:31 +08:00
46 lines
969 B
Dart
46 lines
969 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import './example_game.dart';
|
|
|
|
void main() {
|
|
runApp(MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
home: MyHomePage(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
MyHomePage({Key key}) : super(key: key);
|
|
@override
|
|
_MyHomePageState createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
ExampleGame _myGame;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Testing addingOverlay'),
|
|
),
|
|
body: _myGame == null ? const Text('Wait') : _myGame.widget,
|
|
floatingActionButton: FloatingActionButton(
|
|
onPressed: () => newGame(),
|
|
child: Icon(Icons.add),
|
|
));
|
|
}
|
|
|
|
void newGame() {
|
|
print('New game created');
|
|
_myGame = ExampleGame();
|
|
setState(() {});
|
|
}
|
|
}
|