adding anchor to sprite and animation widget

This commit is contained in:
Erick Zanardo
2020-05-30 15:15:24 -03:00
parent 19b57b0c38
commit 9e4e27e100
4 changed files with 67 additions and 35 deletions

View File

@ -1,19 +1,20 @@
import 'package:flutter/material.dart' hide Animation;
import 'package:flame/animation.dart';
import '../anchor.dart';
import './sprite_widget.dart';
import 'dart:math';
class AnimationWidget extends StatefulWidget {
final Animation animation;
final bool center;
final Anchor anchor;
final bool play;
AnimationWidget({
this.animation,
this.play = true,
this.center = false,
this.anchor = Anchor.topLeft,
}) : assert(animation.loaded(), 'Animation must be loaded');
@override
@ -83,6 +84,6 @@ class _AnimationWidget extends State<AnimationWidget>
@override
Widget build(ctx) {
return SpriteWidget(
sprite: widget.animation.getSprite(), center: widget.center);
sprite: widget.animation.getSprite(), anchor: widget.anchor);
}
}