AnimatedBuilder should have a child

Providing a pre-built child is more efficient because we don't need to rebuild
the child every tick of the animation.
This commit is contained in:
Adam Barth
2016-01-20 09:10:34 -08:00
parent 715af6ebe8
commit d25951c517
10 changed files with 51 additions and 44 deletions

View File

@@ -41,7 +41,7 @@ class CardTransition extends StatelessComponent {
Widget build(BuildContext context) {
return new AnimatedBuilder(
animation: animation,
builder: (BuildContext context) {
builder: (BuildContext context, Widget child) {
double currentScale = scale.evaluate(animation);
Matrix4 transform = new Matrix4.identity()
..translate(x.evaluate(animation))
@@ -53,7 +53,8 @@ class CardTransition extends StatelessComponent {
child: child
)
);
}
},
child: child
);
}
}