-
-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow most basic and advanced gesture detectors together (#1208)
Most gesture detectors work together now, except for the PanDetector or ScaleDetector together with the MultiTouchDragDetector. Maybe even the ScaleDetector will work with the MultiTouchDragDetector, will have to try.
- Loading branch information
Showing
6 changed files
with
118 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flame/game.dart'; | ||
import 'package:flame/input.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
class _MultiDragPanGame extends FlameGame | ||
with MultiTouchDragDetector, PanDetector {} | ||
|
||
class _MultiTapDoubleTapGame extends FlameGame | ||
with MultiTouchTapDetector, DoubleTapDetector {} | ||
|
||
void main() { | ||
group('apply detectors', () { | ||
testWidgets( | ||
'game can not have both MultiTouchDragDetector and PanDetector', | ||
(tester) async { | ||
await tester.pumpWidget( | ||
GameWidget( | ||
game: _MultiDragPanGame(), | ||
), | ||
); | ||
expect(tester.takeException(), isInstanceOf<AssertionError>()); | ||
}, | ||
); | ||
|
||
testWidgets( | ||
'game can have both MultiTouchTapDetector and DoubleTapDetector', | ||
(tester) async { | ||
await tester.pumpWidget( | ||
GameWidget( | ||
game: _MultiTapDoubleTapGame(), | ||
), | ||
); | ||
expect(tester.takeException(), null); | ||
}, | ||
); | ||
}); | ||
} |