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> { ...@@ -547,11 +547,17 @@ class ScaffoldState extends State<Scaffold> {
final ScrollableState scrollable = notification.scrollable; final ScrollableState scrollable = notification.scrollable;
if ((scrollable.config.scrollDirection == Axis.vertical) && if ((scrollable.config.scrollDirection == Axis.vertical) &&
(config.scrollableKey == null || config.scrollableKey == scrollable.config.key)) { (config.scrollableKey == null || config.scrollableKey == scrollable.config.key)) {
final double newScrollOffset = scrollable.scrollOffset; double newScrollOffset = scrollable.scrollOffset;
setState(() { if (ClampOverscrolls.of(scrollable.context)) {
_scrollOffsetDelta = _scrollOffset - newScrollOffset; ExtentScrollBehavior limits = scrollable.scrollBehavior;
_scrollOffset = newScrollOffset; newScrollOffset = newScrollOffset.clamp(limits.minScrollOffset, limits.maxScrollOffset);
}); }
if (_scrollOffset != newScrollOffset) {
setState(() {
_scrollOffsetDelta = _scrollOffset - newScrollOffset;
_scrollOffset = newScrollOffset;
});
}
} }
return false; 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