diff --git a/lib/util.dart b/lib/util.dart index 2cb766270..375922a94 100644 --- a/lib/util.dart +++ b/lib/util.dart @@ -118,7 +118,8 @@ class Util { /// Read more at: https://flame-engine.org/docs/input.md /// @Deprecated( - 'This method can lead to confuse behaviour, use the gestures methods provided by the Game class') + 'This method can lead to confuse behaviour, use the gestures methods provided by the Game class', + ) void addGestureRecognizer(GestureRecognizer recognizer) { if (GestureBinding.instance == null) { throw Exception( diff --git a/lib/widgets/animation_widget.dart b/lib/widgets/animation_widget.dart index b9fe86221..b38053181 100644 --- a/lib/widgets/animation_widget.dart +++ b/lib/widgets/animation_widget.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart' hide Animation; import 'package:flame/animation.dart'; +import 'dart:math'; + import '../anchor.dart'; import './sprite_widget.dart'; -import 'dart:math'; - class AnimationWidget extends StatefulWidget { final Animation animation; final Anchor anchor; @@ -64,15 +64,13 @@ class _AnimationWidget extends State widget.animation.reset(); _lastUpdated = DateTime.now().millisecond.toDouble(); _controller.repeat( - // -/+ 60 fps + // Approximately 60 fps period: const Duration(milliseconds: 16)); }); } void _pauseAnimation() { - setState(() { - _controller.stop(); - }); + setState(() => _controller.stop()); } @override @@ -84,6 +82,8 @@ class _AnimationWidget extends State @override Widget build(ctx) { return SpriteWidget( - sprite: widget.animation.getSprite(), anchor: widget.anchor); + sprite: widget.animation.getSprite(), + anchor: widget.anchor, + ); } } diff --git a/lib/widgets/sprite_widget.dart b/lib/widgets/sprite_widget.dart index f13fc6dcd..d1c7ea78a 100644 --- a/lib/widgets/sprite_widget.dart +++ b/lib/widgets/sprite_widget.dart @@ -1,10 +1,10 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; +import 'dart:math'; + import '../sprite.dart'; import '../anchor.dart'; -import 'dart:math'; - class SpriteWidget extends StatelessWidget { final Sprite sprite; final Anchor anchor; @@ -29,8 +29,9 @@ class _SpritePainer extends CustomPainter { _SpritePainer(this._sprite, this._anchor); @override - bool shouldRepaint(_SpritePainer old) => - old._sprite != _sprite || old._anchor != _anchor; + bool shouldRepaint(_SpritePainer old) { + return old._sprite != _sprite || old._anchor != _anchor; + } @override void paint(Canvas canvas, Size size) {