Commit ff1d3b81 authored by Hans Muller's avatar Hans Muller

Clamp AppBar scroll notifications when ClampOverscrolls is true (#4152)

parent 3b3db78f
......@@ -547,11 +547,17 @@ class ScaffoldState extends State<Scaffold> {
final ScrollableState scrollable = notification.scrollable;
if ((scrollable.config.scrollDirection == Axis.vertical) &&
(config.scrollableKey == null || config.scrollableKey == scrollable.config.key)) {
final double newScrollOffset = scrollable.scrollOffset;
setState(() {
_scrollOffsetDelta = _scrollOffset - newScrollOffset;
_scrollOffset = newScrollOffset;
});
double newScrollOffset = scrollable.scrollOffset;
if (ClampOverscrolls.of(scrollable.context)) {
ExtentScrollBehavior limits = scrollable.scrollBehavior;
newScrollOffset = newScrollOffset.clamp(limits.minScrollOffset, limits.maxScrollOffset);
}
if (_scrollOffset != newScrollOffset) {
setState(() {
_scrollOffsetDelta = _scrollOffset - newScrollOffset;
_scrollOffset = newScrollOffset;
});
}
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment