• Hans Muller's avatar
    SnapOffsets for fling Scrolling · 7385641f
    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
Name
Last commit
Last update
..
coordinates_test.dart Loading commit data...
homogeneous_viewport_test.dart Loading commit data...
listener_test.dart Loading commit data...
mixed_viewport_test.dart Loading commit data...
multichild_test.dart Loading commit data...
parent_data_test.dart Loading commit data...
render_object_widget_test.dart Loading commit data...
stateful_component_test.dart Loading commit data...
test_widgets.dart Loading commit data...
widget_tester.dart Loading commit data...