fix: changed paths area default color to transparent

pull/14/head
RuiAlonso 4 years ago
parent c693e9a109
commit aeb289fce6

@ -10,12 +10,10 @@ class Path extends BodyComponent {
required List<List<Vector2>> paths,
}) : _position = position,
_paths = paths {
if (color != null) {
paint = Paint()
..color = color
..color = color ?? const Color.fromARGB(0, 0, 0, 0)
..style = PaintingStyle.stroke;
}
}
factory Path.straight({
Color? color,

@ -1,4 +1,4 @@
// ignore_for_file: cascade_invocations
// ignore_for_file: cascade_invocations, prefer_const_constructors
import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:flame_test/flame_test.dart';
import 'package:flutter/material.dart';
@ -15,7 +15,7 @@ void main() {
group('straight', () {
group('color', () {
flameTester.test(
'has white color by default if not specified',
'has transparent color by default if not specified',
(game) async {
final path = Path.straight(
position: Vector2.zero(),
@ -26,7 +26,10 @@ void main() {
await game.ensureAdd(path);
expect(game.contains(path), isTrue);
expect(path.paint, isNotNull);
expect(path.paint.color, equals(Colors.white));
expect(
path.paint.color,
equals(Color.fromARGB(0, 0, 0, 0)),
);
},
);
flameTester.test(

Loading…
Cancel
Save