mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 20:13:50 +08:00
renaming play to playing on AnimationWidget
This commit is contained in:
@ -131,7 +131,7 @@ void main() async {
|
|||||||
height: ctx.numberProperty('container height', 200),
|
height: ctx.numberProperty('container height', 200),
|
||||||
child: AnimationWidget(
|
child: AnimationWidget(
|
||||||
animation: _animation,
|
animation: _animation,
|
||||||
play: ctx.boolProperty('playing', true),
|
playing: ctx.boolProperty('playing', true),
|
||||||
anchor: parseAnchor(
|
anchor: parseAnchor(
|
||||||
ctx.listProperty('anchor', 'Anchor.center', anchorOptions)),
|
ctx.listProperty('anchor', 'Anchor.center', anchorOptions)),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -71,7 +71,7 @@ How to use it:
|
|||||||
```dart
|
```dart
|
||||||
AnimationWidget(
|
AnimationWidget(
|
||||||
animation: _animation,
|
animation: _animation,
|
||||||
play: true,
|
playing: true,
|
||||||
center: true,
|
center: true,
|
||||||
),
|
),
|
||||||
```
|
```
|
||||||
|
|||||||
@ -9,11 +9,11 @@ import 'dart:math';
|
|||||||
class AnimationWidget extends StatefulWidget {
|
class AnimationWidget extends StatefulWidget {
|
||||||
final Animation animation;
|
final Animation animation;
|
||||||
final Anchor anchor;
|
final Anchor anchor;
|
||||||
final bool play;
|
final bool playing;
|
||||||
|
|
||||||
AnimationWidget({
|
AnimationWidget({
|
||||||
this.animation,
|
this.animation,
|
||||||
this.play = true,
|
this.playing = true,
|
||||||
this.anchor = Anchor.topLeft,
|
this.anchor = Anchor.topLeft,
|
||||||
}) : assert(animation.loaded(), 'Animation must be loaded');
|
}) : assert(animation.loaded(), 'Animation must be loaded');
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class _AnimationWidget extends State<AnimationWidget>
|
|||||||
@override
|
@override
|
||||||
void didUpdateWidget(oldWidget) {
|
void didUpdateWidget(oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
if (widget.play) {
|
if (widget.playing) {
|
||||||
_initAnimation();
|
_initAnimation();
|
||||||
} else {
|
} else {
|
||||||
_pauseAnimation();
|
_pauseAnimation();
|
||||||
@ -54,7 +54,7 @@ class _AnimationWidget extends State<AnimationWidget>
|
|||||||
|
|
||||||
widget.animation.onCompleteAnimation = _pauseAnimation;
|
widget.animation.onCompleteAnimation = _pauseAnimation;
|
||||||
|
|
||||||
if (widget.play) {
|
if (widget.playing) {
|
||||||
_initAnimation();
|
_initAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user