File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
bridge_packages/flame_spine Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ void main() async {
21
21
runApp(const GameWidget.controlled(gameFactory: SpineExample.new));
22
22
}
23
23
24
- class FlameSpineExample extends FlameGame with TapDetector {
24
+ class FlameSpineExample extends FlameGame {
25
25
late final SpineComponent spineboy;
26
26
27
27
@override
Original file line number Diff line number Diff line change @@ -35,5 +35,19 @@ class EmberPlayer extends SpriteAnimationComponent with TapCallbacks {
35
35
}
36
36
37
37
@override
38
- void onTapUp ([TapUpEvent ? event]) => _onTap? .call (this );
38
+ void onTapDown (TapDownEvent event) {
39
+ if (_onTap == null ) {
40
+ event.continuePropagation = true ;
41
+ }
42
+ }
43
+
44
+ @override
45
+ void onTapUp (TapUpEvent event) {
46
+ final onTap = _onTap;
47
+ if (onTap == null ) {
48
+ event.continuePropagation = true ;
49
+ } else {
50
+ onTap.call (this );
51
+ }
52
+ }
39
53
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import 'package:flame/palette.dart';
9
9
import 'package:flutter/material.dart' ;
10
10
11
11
class RayTraceExample extends FlameGame
12
- with HasCollisionDetection , TapDetector {
12
+ with HasCollisionDetection , TapCallbacks {
13
13
Paint paint = Paint ()..color = Colors .red.withValues (alpha: 0.6 );
14
14
bool isClicked = false ;
15
15
@@ -79,8 +79,7 @@ class RayTraceExample extends FlameGame
79
79
}
80
80
81
81
@override
82
- void onTap () {
83
- super .onTap ();
82
+ void onTapUp (TapUpEvent event) {
84
83
if (! isClicked) {
85
84
isClicked = true ;
86
85
return ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import 'package:flame/effects.dart';
4
4
import 'package:flame/events.dart' ;
5
5
import 'package:flame/game.dart' ;
6
6
7
- class RemoveEffectGame extends FlameGame with TapDetector {
7
+ class RemoveEffectGame extends FlameGame with TapCallbacks {
8
8
static const double delayTime = 3 ;
9
9
late EmberPlayer ember;
10
10
late TextComponent textComponent;
@@ -22,7 +22,7 @@ class RemoveEffectGame extends FlameGame with TapDetector {
22
22
}
23
23
24
24
@override
25
- void onTap ( ) {
25
+ void onTapUp ( TapUpEvent event ) {
26
26
if (children.contains (ember)) {
27
27
ember.add (effect);
28
28
} else {
You can’t perform that action at this time.
0 commit comments