From 278d641f3a6e5f53c3507c654336303aa83f7d4d Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Thu, 7 Apr 2022 18:14:20 +0200 Subject: [PATCH] refactor: added priority and layer to Ball for BasicBallGame --- .../sandbox/lib/stories/ball/basic_ball_game.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/pinball_components/sandbox/lib/stories/ball/basic_ball_game.dart b/packages/pinball_components/sandbox/lib/stories/ball/basic_ball_game.dart index 46cfb154..ca091560 100644 --- a/packages/pinball_components/sandbox/lib/stories/ball/basic_ball_game.dart +++ b/packages/pinball_components/sandbox/lib/stories/ball/basic_ball_game.dart @@ -4,7 +4,11 @@ import 'package:pinball_components/pinball_components.dart'; import 'package:sandbox/common/common.dart'; class BasicBallGame extends BasicGame with TapDetector { - BasicBallGame({required this.color}); + BasicBallGame({ + required this.color, + this.ballPriority = 0, + this.ballLayer = Layer.all, + }); static const info = ''' Shows how a Ball works. @@ -13,11 +17,16 @@ class BasicBallGame extends BasicGame with TapDetector { '''; final Color color; + final int ballPriority; + final Layer ballLayer; @override void onTapUp(TapUpInfo info) { add( - Ball(baseColor: color)..initialPosition = info.eventPosition.game, + Ball(baseColor: color) + ..initialPosition = info.eventPosition.game + ..layer = ballLayer + ..priority = ballPriority, ); } }