From 4d2ddb9199c1857289799f9e21bee71534a886fc Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Wed, 24 Jun 2020 12:28:01 -0700 Subject: [PATCH] Doc Updates (#60222) --- .../flutter/lib/src/widgets/scroll_physics.dart | 13 +++++++++++++ packages/flutter/lib/src/widgets/sliver_fill.dart | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/widgets/scroll_physics.dart b/packages/flutter/lib/src/widgets/scroll_physics.dart index ecfc55b2fa..f34f10838e 100644 --- a/packages/flutter/lib/src/widgets/scroll_physics.dart +++ b/packages/flutter/lib/src/widgets/scroll_physics.dart @@ -448,12 +448,25 @@ class RangeMaintainingScrollPhysics extends ScrollPhysics { /// /// This is the behavior typically seen on iOS. /// +/// [BouncingScrollPhysics] by itself will not create an overscroll effect if +/// the contents of the scroll view do not extend beyond the size of the +/// viewport. To create the overscroll and bounce effect regardless of the +/// length of your scroll view, combine with [AlwaysScrollableScrollPhysics]. +/// +/// {@tool snippet} +/// ```dart +/// BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()) +/// ``` +/// (@end-tool} +/// /// See also: /// /// * [ScrollConfiguration], which uses this to provide the default /// scroll behavior on iOS. /// * [ClampingScrollPhysics], which is the analogous physics for Android's /// clamping behavior. +/// * [ScrollPhysics], for more examples of combining [ScrollPhysics] objects +/// of different types to get the desired scroll physics. class BouncingScrollPhysics extends ScrollPhysics { /// Creates scroll physics that bounce back from the edge. const BouncingScrollPhysics({ ScrollPhysics parent }) : super(parent: parent); diff --git a/packages/flutter/lib/src/widgets/sliver_fill.dart b/packages/flutter/lib/src/widgets/sliver_fill.dart index f505980795..cb95d095d9 100644 --- a/packages/flutter/lib/src/widgets/sliver_fill.dart +++ b/packages/flutter/lib/src/widgets/sliver_fill.dart @@ -188,7 +188,10 @@ class _RenderSliverFractionalPadding extends RenderSliverEdgeInsetsPadding { /// The [hasScrollBody] flag indicates whether the sliver's child has a /// scrollable body. This value is never null, and defaults to true. A common /// example of this use is a [NestedScrollView]. In this case, the sliver will -/// size its child to fill the maximum available extent. +/// size its child to fill the maximum available extent. [SliverFillRemaining] +/// will not constrain the scrollable area, as it could potentially have an +/// infinite depth. This is also true for use cases such as a [ScrollView] when +/// [ScrollView.shrinkwrap] is true. /// /// ### When [SliverFillRemaining] does not have a scrollable child /// @@ -347,7 +350,10 @@ class _RenderSliverFractionalPadding extends RenderSliverEdgeInsetsPadding { /// // fillOverscroll only changes the behavior of your layout when applied /// // to Scrollables that allow for overscroll. BouncingScrollPhysics are /// // one example, which are provided by default on the iOS platform. -/// physics: BouncingScrollPhysics(), +/// // BouncingScrollPhysics is combined with AlwaysScrollableScrollPhysics +/// // to allow for the overscroll, regardless of the depth of the +/// // scrollable. +/// physics: BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), /// slivers: [ /// SliverToBoxAdapter( /// child: Container(