Skip to content

Commit f3be9bb

Browse files
committed
Fix dart format
1 parent 43f6659 commit f3be9bb

File tree

6 files changed

+47
-61
lines changed

6 files changed

+47
-61
lines changed

lib/game/actors/coin.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class Coin extends SpriteComponent
1818
super.anchor,
1919
super.priority,
2020
}) : super.fromImage(
21-
srcPosition: Vector2(3 * 32, 0),
22-
srcSize: Vector2.all(32),
23-
);
21+
srcPosition: Vector2(3 * 32, 0),
22+
srcSize: Vector2.all(32),
23+
);
2424

2525
@override
2626
Future<void> onLoad() async {

lib/game/actors/door.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class Door extends SpriteComponent with CollisionCallbacks {
1818
super.anchor,
1919
super.priority,
2020
}) : super.fromImage(
21-
srcPosition: Vector2(2 * 32, 0),
22-
srcSize: Vector2.all(32),
23-
);
21+
srcPosition: Vector2(2 * 32, 0),
22+
srcSize: Vector2.all(32),
23+
);
2424

2525
@override
2626
Future<void> onLoad() async {

lib/game/actors/enemy.dart

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,25 @@ class Enemy extends SpriteComponent
2020
super.anchor,
2121
super.priority,
2222
}) : super.fromImage(
23-
srcPosition: Vector2(1 * 32, 0),
24-
srcSize: Vector2.all(32),
25-
position: position,
26-
) {
23+
srcPosition: Vector2(1 * 32, 0),
24+
srcSize: Vector2.all(32),
25+
position: position,
26+
) {
2727
if (targetPosition != null && position != null) {
2828
// Need to sequence two move to effects so that we can
2929
// tap into the onFinishCallback and flip the component.
30-
final effect = SequenceEffect(
31-
[
32-
MoveToEffect(
33-
targetPosition,
34-
EffectController(speed: 100),
35-
onComplete: flipHorizontallyAroundCenter,
36-
),
37-
MoveToEffect(
38-
position + Vector2(32, 0), // Need to offset by 32 due to flip
39-
EffectController(speed: 100),
40-
onComplete: flipHorizontallyAroundCenter,
41-
),
42-
],
43-
infinite: true,
44-
);
30+
final effect = SequenceEffect([
31+
MoveToEffect(
32+
targetPosition,
33+
EffectController(speed: 100),
34+
onComplete: flipHorizontallyAroundCenter,
35+
),
36+
MoveToEffect(
37+
position + Vector2(32, 0), // Need to offset by 32 due to flip
38+
EffectController(speed: 100),
39+
onComplete: flipHorizontallyAroundCenter,
40+
),
41+
], infinite: true);
4542

4643
add(effect);
4744
}

lib/game/actors/player.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ class Player extends SpriteComponent with CollisionCallbacks, KeyboardHandler {
2828
super.anchor,
2929
super.priority,
3030
super.children,
31-
}) : super.fromImage(
32-
srcPosition: Vector2.zero(),
33-
srcSize: Vector2.all(32),
34-
);
31+
}) : super.fromImage(srcPosition: Vector2.zero(), srcSize: Vector2.all(32));
3532

3633
@override
3734
Future<void> onLoad() async {
@@ -89,7 +86,8 @@ class Player extends SpriteComponent with CollisionCallbacks, KeyboardHandler {
8986
if (other is Platform) {
9087
if (intersectionPoints.length == 2) {
9188
// Calculate the collision normal and separation distance.
92-
final mid = (intersectionPoints.elementAt(0) +
89+
final mid =
90+
(intersectionPoints.elementAt(0) +
9391
intersectionPoints.elementAt(1)) /
9492
2;
9593

@@ -120,11 +118,7 @@ class Player extends SpriteComponent with CollisionCallbacks, KeyboardHandler {
120118
void hit() {
121119
add(
122120
OpacityEffect.fadeOut(
123-
EffectController(
124-
alternate: true,
125-
duration: 0.1,
126-
repeatCount: 5,
127-
),
121+
EffectController(alternate: true, duration: 0.1, repeatCount: 5),
128122
),
129123
);
130124
}

lib/game/level/level.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ class Level extends Component
2121

2222
@override
2323
Future<void> onLoad() async {
24-
final level = await TiledComponent.load(
25-
levelName,
26-
Vector2.all(32),
27-
);
24+
final level = await TiledComponent.load(levelName, Vector2.all(32));
2825
await add(level);
2926

3027
_spawnActors(level);
@@ -67,31 +64,27 @@ class Level extends Component
6764
position: position,
6865
size: size,
6966
children: [
70-
BoundedPositionBehavior(
71-
bounds: Rectangle.fromRect(levelBounds),
72-
),
67+
BoundedPositionBehavior(bounds: Rectangle.fromRect(levelBounds)),
7368
],
7469
);
7570
add(_player);
7671

7772
break;
7873

7974
case 'Coin':
80-
final coin = Coin(
81-
game.spriteSheet,
82-
position: position,
83-
size: size,
84-
);
75+
final coin = Coin(game.spriteSheet, position: position, size: size);
8576
add(coin);
8677

8778
break;
8879

8980
case 'Enemy':
9081
// Find the target object.
91-
final targetObjectId =
92-
int.parse(spawnPoint.properties.first.value.toString());
93-
final target = spawnPointsLayer.objects
94-
.firstWhere((object) => object.id == targetObjectId);
82+
final targetObjectId = int.parse(
83+
spawnPoint.properties.first.value.toString(),
84+
);
85+
final target = spawnPointsLayer.objects.firstWhere(
86+
(object) => object.id == targetObjectId,
87+
);
9588

9689
final enemy = Enemy(
9790
game.spriteSheet,

lib/game/overlays/settings.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,24 @@ class Settings extends StatelessWidget {
2121
width: 300,
2222
child: ValueListenableBuilder<bool>(
2323
valueListenable: AudioManager.sfx,
24-
builder: (context, sfx, child) => SwitchListTile(
25-
title: const Text('Sound Effects'),
26-
value: sfx,
27-
onChanged: (value) => AudioManager.sfx.value = value,
28-
),
24+
builder:
25+
(context, sfx, child) => SwitchListTile(
26+
title: const Text('Sound Effects'),
27+
value: sfx,
28+
onChanged: (value) => AudioManager.sfx.value = value,
29+
),
2930
),
3031
),
3132
SizedBox(
3233
width: 300,
3334
child: ValueListenableBuilder<bool>(
3435
valueListenable: AudioManager.bgm,
35-
builder: (context, bgm, child) => SwitchListTile(
36-
title: const Text('Background Music'),
37-
value: bgm,
38-
onChanged: (value) => AudioManager.bgm.value = value,
39-
),
36+
builder:
37+
(context, bgm, child) => SwitchListTile(
38+
title: const Text('Background Music'),
39+
value: bgm,
40+
onChanged: (value) => AudioManager.bgm.value = value,
41+
),
4042
),
4143
),
4244
SizedBox(

0 commit comments

Comments
 (0)