Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: Using the SlideTransition

Tags:

flutter

dart

I'm confused on how to use the SlideTransition, especially about the Position property. Atm I've got an AnimationBuilder in which I want to use a SlideTransition and an AnimationController. How would I get the position of the child of the AnimationBuilder? Or is that not what has to be passed to the Position property? Perhaps a small example would help!

like image 947
Bram Vanbilsen Avatar asked Jul 31 '17 23:07

Bram Vanbilsen


1 Answers

AnimationBuilder and SlideTransition are peers, you'd use one or the other (or both in parallel), you don't use one to use the other.

You want to create an Animation<FractionalOffset> from your AnimationController, typically using a Tween<FractionalOffset>.

See, e.g., https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/lib/demo/material/drawer_demo.dart

like image 104
Ian Hickson Avatar answered Oct 14 '22 05:10

Ian Hickson