chore: Remove 1.8.0 deprecations (#2538)

Removes all the deprecated methods before 1.8.0 release.
This commit is contained in:
Lukas Klingsbo
2023-05-22 19:01:55 +02:00
committed by GitHub
parent 6e1d5466aa
commit 2d45d2be39
139 changed files with 1224 additions and 1084 deletions

View File

@ -1,25 +1,31 @@
import 'package:examples/commons/ember.dart';
import 'package:flame/camera.dart';
import 'package:flame/events.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart' show Colors;
class DraggablesExample extends FlameGame {
static const String description = '''
In this example we show you can use the `Draggable` mixin on
In this example we show you can use the `DragCallbacks` mixin on
`PositionComponent`s. Drag around the Embers and see their position
changing.
''';
DraggablesExample({required this.zoom});
final world = World();
late final CameraComponent cameraComponent;
final double zoom;
late final DraggableEmber square;
DraggablesExample({required this.zoom});
@override
Future<void> onLoad() async {
camera.zoom = zoom;
add(square = DraggableEmber());
add(DraggableEmber()..y = 350);
cameraComponent = CameraComponent(world: world);
cameraComponent.viewfinder.zoom = zoom;
addAll([cameraComponent, world]);
world.add(square = DraggableEmber());
world.add(DraggableEmber()..y = 350);
}
}
@ -29,28 +35,24 @@ class DraggableEmber extends Ember with DragCallbacks {
@override
bool debugMode = true;
DraggableEmber({Vector2? position})
: super(
position: position ?? Vector2.all(100),
size: Vector2.all(100),
);
DraggableEmber({super.position}) : super(size: Vector2.all(100));
@override
void update(double dt) {
super.update(dt);
debugColor = isDragged && parent is DraggablesExample
debugColor = isDragged && findGame() is DraggablesExample
? Colors.greenAccent
: Colors.purple;
}
@override
void onDragUpdate(DragUpdateEvent event) {
if (parent is! DraggablesExample) {
if (findGame() is! DraggablesExample) {
event.continuePropagation = true;
return;
}
position.add(event.localPosition);
position.add(event.delta);
event.continuePropagation = false;
}
}