mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
This:
Add new rule use_if_null_to_convert_nulls_to_bools to flame_lint (no violations)
Add new rule use_key_in_widget_constructors (several violations)
Fix violations
Exclude generated files from flame_lint (we don't have any on this repo but when using on games often there are)
I believe this is not a breaking change because it just adds optional arguments to constructors, but if it is, we can reconsider this PR.
23 lines
549 B
Dart
23 lines
549 B
Dart
import 'package:flame/components.dart';
|
|
import 'package:flame/game.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class MyGameWidget extends StatelessWidget {
|
|
const MyGameWidget({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GameWidget(game: MyGame());
|
|
}
|
|
}
|
|
|
|
class MyGame extends FlameGame {
|
|
@override
|
|
Future<void> onLoad() async {
|
|
await super.onLoad();
|
|
|
|
final citySprite = await loadSprite('city.png');
|
|
await add(SpriteComponent(sprite: citySprite, size: Vector2.all(200)));
|
|
}
|
|
}
|