flutter_animate
flutter_animate copied to clipboard
Make it easier to set ScrollAdapter begin/end relative to a specific widget
trafficstars
When creating scroll driven animations, it is often a lot easier to set anchor points relative to an element in the scroll region (versus absolute pixel values). This is especially true with dynamic or responsive content.
Quick sketch follows for illustration, naming and implementation specifics TBD.
ScrollAdapter(
begin: ScrollAdapter.getPosition(myWidget, alignment: Alignment.center, offset: Offset(y: -100),
...
)
The above would set the begin property to 100px above the middle of myWidget.
It's worth considering whether there's a use case for a version of this that adjusts automatically if the position of the widget changes (the example above wouldn't).