refactor: alien sandbox traceable

pull/166/head
RuiAlonso 4 years ago
parent 1c9fe2b359
commit 3705e1d268

@ -5,10 +5,8 @@ import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart'; import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart'; import 'package:sandbox/stories/ball/basic_ball_game.dart';
class AlienBumperGame extends BasicBallGame { class AlienBumperGame extends BasicBallGame with Traceable {
AlienBumperGame({ AlienBumperGame() : super(color: const Color(0xFF0000FF));
required this.trace,
}) : super(color: const Color(0xFF0000FF));
static const info = ''' static const info = '''
Shows how a AlienBumper is rendered. Shows how a AlienBumper is rendered.
@ -16,8 +14,6 @@ class AlienBumperGame extends BasicBallGame {
Activate the "trace" parameter to overlay the body. Activate the "trace" parameter to overlay the body.
'''; ''';
final bool trace;
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
@ -34,9 +30,6 @@ class AlienBumperGame extends BasicBallGame {
alienBumperB, alienBumperB,
]); ]);
if (trace) { await traceAllBodies();
alienBumperA.trace();
alienBumperB.trace();
}
} }
} }

@ -7,9 +7,7 @@ void addAlienBumperStories(Dashbook dashbook) {
dashbook.storiesOf('Alien Bumpers').add( dashbook.storiesOf('Alien Bumpers').add(
'Basic', 'Basic',
(context) => GameWidget( (context) => GameWidget(
game: AlienBumperGame( game: AlienBumperGame()..trace = context.boolProperty('Trace', true),
trace: context.boolProperty('Trace', true),
),
), ),
codeLink: buildSourceLink('alien_bumper/basic.dart'), codeLink: buildSourceLink('alien_bumper/basic.dart'),
info: AlienBumperGame.info, info: AlienBumperGame.info,

Loading…
Cancel
Save