refactor: removing baseColor from ball

pull/279/head
RuiAlonso 3 years ago
parent ccf9b33d67
commit f00d31383f

@ -14,7 +14,7 @@ class Ball<T extends Forge2DGame> extends BodyComponent<T>
with Layered, InitialPosition {
/// {@macro ball}
Ball({
required this.baseColor,
Color? baseColor,
String? spriteAsset,
}) : super(
renderBody: false,
@ -33,9 +33,6 @@ class Ball<T extends Forge2DGame> extends BodyComponent<T>
/// The size of the [Ball].
static final Vector2 size = Vector2.all(4.13);
/// The base [Color] used to tint this [Ball].
final Color baseColor;
@override
Body createBody() {
final shape = CircleShape()..radius = size.x / 2;

@ -5,7 +5,7 @@ import 'package:sandbox/common/common.dart';
class BallGame extends AssetsGame with TapDetector, Traceable {
BallGame({
this.color = Colors.blue,
Color? color,
this.ballPriority = 0,
this.ballLayer = Layer.all,
this.character,
@ -34,7 +34,6 @@ class BallGame extends AssetsGame with TapDetector, Traceable {
'Dino': Assets.images.ball.dinoBall.keyName,
};
final Color color;
final int ballPriority;
final Layer ballLayer;
final String? character;
@ -43,7 +42,6 @@ class BallGame extends AssetsGame with TapDetector, Traceable {
void onTapUp(TapUpInfo info) {
add(
Ball(
baseColor: color,
spriteAsset: characterBallPaths[character],
)
..initialPosition = info.eventPosition.game

@ -1,5 +1,4 @@
import 'package:dashbook/dashbook.dart';
import 'package:flutter/material.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/ball_booster_game.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
@ -7,10 +6,9 @@ import 'package:sandbox/stories/ball/basic_ball_game.dart';
void addBallStories(Dashbook dashbook) {
dashbook.storiesOf('Ball')
..addGame(
title: 'Colored',
title: 'Themed',
description: BallGame.description,
gameBuilder: (context) => BallGame(
color: context.colorProperty('color', Colors.blue),
character: context.listProperty(
'Character',
BallGame.characterBallPaths.keys.first,

Loading…
Cancel
Save