docs: Deprecate TapDetector in favour of TapCallbacks (#2886)

Deprecate `TapDetector` in favour of `TapCallbacks`
This commit is contained in:
Luan Nico
2025-10-02 13:21:05 -07:00
committed by GitHub
parent 36eb3929aa
commit b173697bfb
35 changed files with 90 additions and 83 deletions

View File

@ -10,7 +10,7 @@ import 'package:flame/palette.dart';
import 'package:flutter/material.dart';
class RaycastLightExample extends FlameGame
with HasCollisionDetection, TapDetector, MouseMovementDetector {
with HasCollisionDetection, TapCallbacks, MouseMovementDetector {
static const description = '''
In this example the raycast functionality is showcased by using it as a light
source, if you move the mouse around the canvas the rays will be cast from its
@ -88,9 +88,8 @@ with with mouse.
}
@override
void onTapDown(TapDownInfo info) {
super.onTapDown(info);
final origin = info.eventPosition.widget;
void onTapDown(TapDownEvent event) {
final origin = event.canvasPosition;
isTapOriginCasted = origin == tapOrigin;
tapOrigin = origin;
}