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:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user