-
Hans Muller authored
Initial snap offset support for ScrollableWidgetList (and ScrollableList<T>) and ScrollableMixedWidgetList. If a ```toSnapOffset(scrollOffset)``` function is provided, fling Scrolls will coast to the returned value. If ```alignmentOffset``` is specified then fling scrolls conclude when toSnapOffset's value lines up with the Scrollable widget's origin + alignmentOffset. For example if the Scrollable widget's height was 200.0, and alignmentOffset:100.0 was specified, then fling scrolls would end with the value returned by toSnapOffset() lined up with the center of the Scrollable. This approach to Scrollable snapping assumes that the layout of whatever the Scrollable contains is known at the outset. This is often true however a ScrollableMixedWidgetList may not know its items' sizes until they've been reached by scrolling. This is a first cut at snapping support. Among the things that remain to be done: - Scrolling limits trump snapping. Snapping should probably trump scrolling limits. - Drag scrolls aren't snapped. This may be desirable so perhaps the feature should be controlled with a flag. - Specifying alignmentOffset as a percentage would probably be more convenient. - It would be nice if one could wrap items in a SnapOffset value like: ```new SnapOffset(0.5, child: myItem)``` to snap to the center of the item. Updated the CardCollection example: snapping and fixed size items can be turned on/off with Drawer checkboxes.
7385641f