mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 20:13:50 +08:00
pr nits
This commit is contained in:
@ -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(
|
||||
|
||||
@ -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<AnimationWidget>
|
||||
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<AnimationWidget>
|
||||
@override
|
||||
Widget build(ctx) {
|
||||
return SpriteWidget(
|
||||
sprite: widget.animation.getSprite(), anchor: widget.anchor);
|
||||
sprite: widget.animation.getSprite(),
|
||||
anchor: widget.anchor,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user