Skip to content

Commit

Permalink
docs: Remove references to Tappable and Draggable (#2912)
Browse files Browse the repository at this point in the history
We still had some references to `Tappable` and `Draggable`, this PR
removes them and removes a superfluous test for `TapCallbacks`.

---------

Co-authored-by: jonathan <sharyari@gmail.com>
  • Loading branch information
spydon and sharyari committed Dec 9, 2023
1 parent 47643f0 commit d12e454
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 297 deletions.
3 changes: 2 additions & 1 deletion .markdownlint.yaml
Expand Up @@ -201,7 +201,8 @@ MD044:
html_elements: true

# MD045/no-alt-text - Images should have alternate text (alt text)
MD045: true
# TODO: Activate this with #2913
MD045: false

# MD046/code-block-style - Code block style
MD046:
Expand Down
8 changes: 4 additions & 4 deletions doc/flame/components.md
Expand Up @@ -105,12 +105,12 @@ In the following example we first initialize the component with priority 1, and
user taps the component we change its priority to 2:

```dart
class MyComponent extends PositionComponent with Tappable {
class MyComponent extends PositionComponent with TapCallbacks {
MyComponent() : super(priority: 1);
@override
void onTap() {
void onTapDown(TapDownEvent event) {
priority = 2;
}
}
Expand Down Expand Up @@ -818,8 +818,8 @@ robot.animationTickers?[RobotState.idle]?.onFrame = (currentIndex) {
Example:

```dart
class ButtonComponent extends SpriteGroupComponent<ButtonState>
with HasGameRef<SpriteGroupExample>, Tappable {
class PlayerComponent extends SpriteGroupComponent<ButtonState>
with HasGameReference<SpriteGroupExample>, TapCallbacks {
@override
Future<void>? onLoad() async {
final pressedSprite = await gameRef.loadSprite(/* omitted */);
Expand Down
2 changes: 1 addition & 1 deletion doc/flame/examples/lib/collision_detection.dart
Expand Up @@ -3,7 +3,7 @@ import 'package:flame/collisions.dart';
import 'package:flame/components.dart';
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart' hide Image, Draggable;
import 'package:flutter/material.dart' hide Image;

class CollisionDetectionGame extends FlameGame with HasCollisionDetection {
@override
Expand Down
2 changes: 1 addition & 1 deletion doc/flame/inputs/keyboard_input.md
Expand Up @@ -76,7 +76,7 @@ class MyGame extends FlameGame with KeyboardEvents {

To receive keyboard events directly in components, there is the mixin `KeyboardHandler`.

Similarly to `Tappable` and `Draggable`, `KeyboardHandler` can be mixed into any subclass of
Similarly to `TapCallbacks` and `DragCallbacks`, `KeyboardHandler` can be mixed into any subclass of
`Component`.

KeyboardHandlers must only be added to games that are mixed with `HasKeyboardHandlerComponents`.
Expand Down
2 changes: 1 addition & 1 deletion doc/flame/inputs/tap_events.md
Expand Up @@ -58,7 +58,7 @@ Every component that received an `onTapDown` event will eventually receive eithe
### onLongTapDown

If the user holds their finger down for some time (as configured by the `.longTapDelay` property
in `HasTappableComponents`), the "long tap" will be generated. This event invokes the
in `MultiTapDispatcher`), "long tap" will be triggered. This event invokes the
`void onLongTapDown(TapDownEvent)` handler on those components that previously received the
`onTapDown` event.

Expand Down
2 changes: 1 addition & 1 deletion examples/lib/stories/input/input.dart
Expand Up @@ -23,7 +23,7 @@ import 'package:flutter/material.dart';
void addInputStories(Dashbook dashbook) {
dashbook.storiesOf('Input')
..add(
'Tappables',
'TapCallbacks',
(_) => GameWidget(game: TapCallbacksExample()),
codeLink: baseLink('input/tap_callbacks_example.dart'),
info: TapCallbacksExample.description,
Expand Down
4 changes: 2 additions & 2 deletions examples/lib/stories/input/tap_callbacks_example.dart
Expand Up @@ -6,8 +6,8 @@ import 'package:flutter/material.dart';

class TapCallbacksExample extends FlameGame {
static const String description = '''
In this example we show the `Tappable` mixin functionality. You can add the
`Tappable` mixin to any `PositionComponent`.\n\n
In this example we show the `TapCallbacks` mixin functionality. You can add
the `TapCallbacks` mixin to any `PositionComponent`.\n\n
Tap the squares to see them change their angle around their anchor.
''';

Expand Down
Expand Up @@ -10,8 +10,6 @@ import 'package:meta/meta.dart';
/// In addition to adding this mixin, the component must also implement the
/// [containsLocalPoint] method -- the component will only be considered
/// "tapped" if the point where the tap has occurred is inside the component.
///
/// This mixin is the replacement of the Tappable mixin.
mixin TapCallbacks on Component {
void onTapDown(TapDownEvent event) {}
void onLongTapDown(TapDownEvent event) {}
Expand Down
283 changes: 0 additions & 283 deletions packages/flame/test/components/mixins/tappable_test.dart

This file was deleted.

2 changes: 1 addition & 1 deletion packages/flame_rive/test/flame_rive_test.dart
Expand Up @@ -56,7 +56,7 @@ void main() {
});

testWithFlameGame(
'Can Add with Tappable',
'Can Add with TapCallbacks',
(game) async {
final child = _RiveComponentWithTappable(
artboard: await loadArtboard(riveFile),
Expand Down

0 comments on commit d12e454

Please sign in to comment.