Issue
In Flutter framework by extending the AnimatedWidget class is implemented a simple animation widget that changes color. How is it possible after complete the widget animation run a function?
Solution
You can listen on the status of an AnimationController
:
var _controller = new AnimationController(
0.0,
const Duration(milliseconds: 200),
);
_controller.addStatusListener((status) {
if(status == AnimationStatus.completed) {
// custom code here
}
});
Animation<Offset> _animation = new Tween<Offset>(
begin: const Offset(100.0, 50.0),
end: const Offset(200.0, 300.0),
).animate(_controller);
Answered By - Günter Zöchbauer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.