mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
Linting
This commit is contained in:
@ -92,8 +92,7 @@ void main() async {
|
|||||||
to: 3,
|
to: 3,
|
||||||
loop: true,
|
loop: true,
|
||||||
);
|
);
|
||||||
dashbook.storiesOf('FlameAnimationWidget').decorator(CenterDecorator())
|
dashbook.storiesOf('FlameAnimationWidget').decorator(CenterDecorator()).add(
|
||||||
.add(
|
|
||||||
'default',
|
'default',
|
||||||
(ctx) => Container(
|
(ctx) => Container(
|
||||||
width: ctx.numberProperty('container width', 400),
|
width: ctx.numberProperty('container width', 400),
|
||||||
|
|||||||
@ -20,8 +20,8 @@ class FlameAnimationWidget extends StatefulWidget {
|
|||||||
State createState() => _FlameAnimationWidget();
|
State createState() => _FlameAnimationWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTickerProviderStateMixin {
|
class _FlameAnimationWidget extends State<FlameAnimationWidget>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
AnimationController _controller;
|
AnimationController _controller;
|
||||||
int _lastUpdated;
|
int _lastUpdated;
|
||||||
|
|
||||||
@ -39,9 +39,7 @@ class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTicke
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_controller = AnimationController(
|
_controller = AnimationController(vsync: this)
|
||||||
vsync: this
|
|
||||||
)
|
|
||||||
..addListener(() {
|
..addListener(() {
|
||||||
final now = DateTime.now().millisecond;
|
final now = DateTime.now().millisecond;
|
||||||
|
|
||||||
@ -66,8 +64,7 @@ class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTicke
|
|||||||
_lastUpdated = DateTime.now().millisecond;
|
_lastUpdated = DateTime.now().millisecond;
|
||||||
_controller.repeat(
|
_controller.repeat(
|
||||||
// -/+ 60 fps
|
// -/+ 60 fps
|
||||||
period: Duration(milliseconds: 16)
|
period: Duration(milliseconds: 16));
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +82,7 @@ class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTicke
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(ctx) {
|
Widget build(ctx) {
|
||||||
return FlameSpriteWidget(sprite: widget.animation.getSprite(), center: widget.center);
|
return FlameSpriteWidget(
|
||||||
|
sprite: widget.animation.getSprite(), center: widget.center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,8 @@ class _FlameSpritePainer extends CustomPainter {
|
|||||||
_FlameSpritePainer(this._sprite, this._center);
|
_FlameSpritePainer(this._sprite, this._center);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldRepaint(_FlameSpritePainer old) => old._sprite != _sprite || old._center != _center;
|
bool shouldRepaint(_FlameSpritePainer old) =>
|
||||||
|
old._sprite != _sprite || old._center != _center;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user