Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Fix lint issues across the codebase #2672

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to put it here since it applies project-wise than in a single file

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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use flame's tau

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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map keys alphabetical (was almost there)

'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)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just using existing declaration of tau


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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final composition = await loadLottie(asset);

await game.ready();

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