Skip to content

Commit

Permalink
refactor: Fix lint issues across the codebase (#2672)
Browse files Browse the repository at this point in the history
Fix a couple lint issues across the codebase, identified by
#2667
Nothing controversial, I expect; getting these out of the way so we can
focus on discussing bigger things.
  • Loading branch information
luanpotter authored Aug 24, 2023
1 parent 34f69b9 commit 6fe9a24
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 30 deletions.
4 changes: 4 additions & 0 deletions doc/flame/examples/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include: package:flame_lint/analysis_options.yaml

linter:
rules:
avoid_web_libraries_in_flutter: false
4 changes: 2 additions & 2 deletions doc/flame/examples/lib/ember.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class EmberPlayer extends SpriteAnimationComponent with TapCallbacks {
EmberPlayer({
required super.position,
required super.size,
void Function(EmberPlayer)? onTap,
void Function(EmberPlayer player)? onTap,
}) : _onTap = onTap,
super();

Vector2 velocity = Vector2(0, 0);
final void Function(EmberPlayer)? _onTap;
final void Function(EmberPlayer player)? _onTap;

@override
Future<void> onLoad() async {
Expand Down
6 changes: 2 additions & 4 deletions doc/flame/examples/lib/flower.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'dart:math';
import 'dart:ui';

import 'package:flame/components.dart';
import 'package:flame/events.dart';
import 'package:flame/geometry.dart';
import 'package:flame/rendering.dart';

const tau = 2 * pi;

enum FlowerPaint { paintId1, paintId2, paintId3, paintId4, paintId5 }

class Flower extends PositionComponent
Expand Down Expand Up @@ -34,7 +32,7 @@ class Flower extends PositionComponent
}

final List<Path> _paths = [];
final void Function(Flower)? _onTap;
final void Function(Flower flower)? _onTap;

Path _makePath(double radius, int n, double sharpness, double f) {
final radius2 = radius * f;
Expand Down
26 changes: 13 additions & 13 deletions doc/flame/examples/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dart:html'; // ignore: avoid_web_libraries_in_flutter
import 'dart:html';

import 'package:doc_flame_examples/anchor.dart';
import 'package:doc_flame_examples/anchor_by_effect.dart';
Expand Down Expand Up @@ -44,37 +44,37 @@ void main() {
final routes = <String, Game Function()>{
'anchor_by_effect': AnchorByEffectGame.new,
'anchor_to_effect': AnchorToEffectGame.new,
'anchor': AnchorGame.new,
'collision_detection': CollisionDetectionGame.new,
'color_effect': ColorEffectExample.new,
'decorator_blur': DecoratorBlurGame.new,
'decorator_grayscale': DecoratorGrayscaleGame.new,
'decorator_rotate3d': DecoratorRotate3DGame.new,
'decorator_shadow3d': DecoratorShadowGame.new,
'decorator_tint': DecoratorTintGame.new,
'drag_events': DragEventsGame.new,
'opacity_to_effect': OpacityToEffectGame.new,
'opacity_effect_with_target': OpacityEffectWithTargetGame.new,
'opacity_by_effect': OpacityByEffectGame.new,
'glow_effect': GlowEffectExample.new,
'move_along_path_effect': MoveAlongPathEffectGame.new,
'move_by_effect': MoveByEffectGame.new,
'move_to_effect': MoveToEffectGame.new,
'opacity_by_effect': OpacityByEffectGame.new,
'opacity_effect_with_target': OpacityEffectWithTargetGame.new,
'opacity_to_effect': OpacityToEffectGame.new,
'ray_cast': RayCastExample.new,
'ray_trace': RayTraceExample.new,
'remove_effect': RemoveEffectGame.new,
'rive_example': RiveExampleGame.new,
'rotate_by_effect': RotateByEffectGame.new,
'rotate_to_effect': RotateToEffectGame.new,
'router': RouterGame.new,
'scale_by_effect': ScaleByEffectGame.new,
'scale_to_effect': ScaleToEffectGame.new,
'sequence_effect': SequenceEffectGame.new,
'size_by_effect': SizeByEffectGame.new,
'size_to_effect': SizeToEffectGame.new,
'sequence_effect': SequenceEffectGame.new,
'tap_events': TapEventsGame.new,
'value_route': ValueRouteExample.new,
'rive_example': RiveExampleGame.new,
'ray_cast': RayCastExample.new,
'ray_trace': RayTraceExample.new,
'glow_effect': GlowEffectExample.new,
'remove_effect': RemoveEffectGame.new,
'color_effect': ColorEffectExample.new,
'time_scale': TimeScaleGame.new,
'anchor': AnchorGame.new,
'value_route': ValueRouteExample.new,
};
final game = routes[page]?.call();
if (game != null) {
Expand Down
6 changes: 3 additions & 3 deletions doc/flame/examples/lib/remove_effect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class RemoveEffectGame extends FlameGame with TapDetector {

@override
void onTap() {
if (!children.contains(ember)) {
if (children.contains(ember)) {
ember.add(effect);
} else {
effect.reset();
add(ember);
} else {
ember.add(effect);
}
}

Expand Down
1 change: 1 addition & 0 deletions doc/flame/examples/lib/rotate_by_effect.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:doc_flame_examples/flower.dart';
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flame/geometry.dart';

class RotateByEffectGame extends FlameGame {
bool reset = false;
Expand Down
1 change: 1 addition & 0 deletions doc/flame/examples/lib/rotate_to_effect.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:doc_flame_examples/flower.dart';
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flame/geometry.dart';

class RotateToEffectGame extends FlameGame {
bool reset = false;
Expand Down
10 changes: 2 additions & 8 deletions packages/flame_lottie/test/flame_lottie_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,17 @@ void main() {

final mockAsset = FakeAssetBundle({'logo.json': logoData});

LottieComposition? composition;

final asset = Lottie.asset(
'logo.json',
bundle: mockAsset,
onLoaded: (c) {
composition = c;
},
);

composition = await loadLottie(asset);
final composition = await loadLottie(asset);

await game.ready();

expect(composition, isNotNull);
expect(
composition!.duration,
composition.duration,
const Duration(seconds: 5, milliseconds: 966),
);
},
Expand Down

0 comments on commit 6fe9a24

Please sign in to comment.