Skip to content

Commit 4792297

Browse files
authored
Document on ScrollPhysics the requirement to override applyTo (#121850)
Document on ScrollPhysics the requirement to override applyTo
1 parent 28b65e0 commit 4792297

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/flutter/lib/src/widgets/scroll_physics.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ enum ScrollDecelerationRate {
6767
/// // ...
6868
/// final ScrollPhysics mergedPhysics = physics.applyTo(const AlwaysScrollableScrollPhysics());
6969
/// ```
70+
///
71+
/// When implementing a subclass, you must override [applyTo] so that it returns
72+
/// an appropriate instance of your subclass. Otherwise, classes like
73+
/// [Scrollable] that inform a [ScrollPosition] will combine them with
74+
/// the default [ScrollPhysics] object instead of your custom subclass.
7075
@immutable
7176
class ScrollPhysics {
7277
/// Creates an object with the default scroll physics.

0 commit comments

Comments
 (0)