diff --git a/doc/flame/examples/analysis_options.yaml b/doc/flame/examples/analysis_options.yaml index 85732fa02fd..3abedbe8791 100644 --- a/doc/flame/examples/analysis_options.yaml +++ b/doc/flame/examples/analysis_options.yaml @@ -1 +1,5 @@ include: package:flame_lint/analysis_options.yaml + +linter: + rules: + avoid_web_libraries_in_flutter: false diff --git a/doc/flame/examples/lib/ember.dart b/doc/flame/examples/lib/ember.dart index 4536c810bfb..d14734096f5 100644 --- a/doc/flame/examples/lib/ember.dart +++ b/doc/flame/examples/lib/ember.dart @@ -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 onLoad() async { diff --git a/doc/flame/examples/lib/flower.dart b/doc/flame/examples/lib/flower.dart index 283ac2e3eb9..53bcc46aa5b 100644 --- a/doc/flame/examples/lib/flower.dart +++ b/doc/flame/examples/lib/flower.dart @@ -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 @@ -34,7 +32,7 @@ class Flower extends PositionComponent } final List _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; diff --git a/doc/flame/examples/lib/main.dart b/doc/flame/examples/lib/main.dart index fbb646c7a32..44c6773779e 100644 --- a/doc/flame/examples/lib/main.dart +++ b/doc/flame/examples/lib/main.dart @@ -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'; @@ -44,37 +44,37 @@ void main() { final routes = { '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) { diff --git a/doc/flame/examples/lib/remove_effect.dart b/doc/flame/examples/lib/remove_effect.dart index 5c0c1c80a69..ba6d17f3793 100644 --- a/doc/flame/examples/lib/remove_effect.dart +++ b/doc/flame/examples/lib/remove_effect.dart @@ -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); } } diff --git a/doc/flame/examples/lib/rotate_by_effect.dart b/doc/flame/examples/lib/rotate_by_effect.dart index 937213565ab..7baf81c444b 100644 --- a/doc/flame/examples/lib/rotate_by_effect.dart +++ b/doc/flame/examples/lib/rotate_by_effect.dart @@ -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; diff --git a/doc/flame/examples/lib/rotate_to_effect.dart b/doc/flame/examples/lib/rotate_to_effect.dart index 74c0882eae4..223a1cc1c6a 100644 --- a/doc/flame/examples/lib/rotate_to_effect.dart +++ b/doc/flame/examples/lib/rotate_to_effect.dart @@ -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; diff --git a/packages/flame_lottie/test/flame_lottie_test.dart b/packages/flame_lottie/test/flame_lottie_test.dart index 05a311ac5cc..2cf794551f5 100644 --- a/packages/flame_lottie/test/flame_lottie_test.dart +++ b/packages/flame_lottie/test/flame_lottie_test.dart @@ -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), ); },