Files
Lukas Klingsbo 2a41d0d683 feat: Move to Flutter 3.0.0 and Dart 2.17.0 (#1713)
This upgrades all packages to Flutter 3.0.0 and fixes all analyze issues that came from that.
2022-06-08 06:04:40 +00:00

29 lines
636 B
Dart

import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
class MyGameWidget extends StatelessWidget {
const MyGameWidget({super.key});
@override
Widget build(BuildContext context) {
return GameWidget(game: MyGame());
}
}
class Background extends SpriteComponent with HasGameRef<MyGame> {
@override
Future<void> onLoad() async {
sprite = await gameRef.loadSprite('city.png');
size = Vector2.all(200);
position = Vector2.all(100);
}
}
class MyGame extends FlameGame {
@override
Future<void> onLoad() async {
await add(Background());
}
}