mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #850 from HansMuller/reset_scroll_behavior
Fix PageableList demo PageableList's scrollBehavior depends on its itemsWrap property. Also: deleted some commented out code that I'd forgotten to delete.
This commit is contained in:
commit
5ddbc03b80
@ -131,11 +131,19 @@ class PageableListState<T, Config extends PageableList<T>> extends ScrollableSta
|
||||
);
|
||||
}
|
||||
|
||||
ScrollBehavior createScrollBehavior() {
|
||||
return config.itemsWrap ? new UnboundedBehavior() : new OverscrollBehavior();
|
||||
UnboundedBehavior _unboundedBehavior;
|
||||
OverscrollBehavior _overscrollBehavior;
|
||||
|
||||
ExtentScrollBehavior get scrollBehavior {
|
||||
if (config.itemsWrap) {
|
||||
_unboundedBehavior ??= new UnboundedBehavior();
|
||||
return _unboundedBehavior;
|
||||
}
|
||||
_overscrollBehavior ??= new OverscrollBehavior();
|
||||
return _overscrollBehavior;
|
||||
}
|
||||
|
||||
ExtentScrollBehavior get scrollBehavior => super.scrollBehavior;
|
||||
ScrollBehavior createScrollBehavior() => scrollBehavior;
|
||||
|
||||
bool get snapScrollOffsetChanges => config.itemsSnapAlignment == ItemsSnapAlignment.item;
|
||||
|
||||
|
||||
@ -197,18 +197,6 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
|
||||
}
|
||||
|
||||
Simulation _createFlingSimulation(double velocity) {
|
||||
/*
|
||||
// Assume that we're rendering at atleast 15 FPS. Stop when we're
|
||||
// scrolling less than one logical pixel per frame. We're essentially
|
||||
// normalizing by the devicePixelRatio so that the threshold has the
|
||||
// same effect independent of the device's pixel density.
|
||||
double endVelocity = pixelToScrollOffset(15.0 * ui.window.devicePixelRatio);
|
||||
|
||||
// Similar to endVelocity. Stop scrolling when we're this close to
|
||||
// destiniation scroll offset.
|
||||
double endDistance = pixelToScrollOffset(0.5 * ui.window.devicePixelRatio);
|
||||
*/
|
||||
|
||||
final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity);
|
||||
final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance);
|
||||
return scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user