Skip to content

Commit

Permalink
Document on ScrollPhysics the requirement to override applyTo (#121850)
Browse files Browse the repository at this point in the history
Document on ScrollPhysics the requirement to override applyTo
  • Loading branch information
gnprice authored Mar 10, 2023
1 parent 28b65e0 commit 4792297
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/flutter/lib/src/widgets/scroll_physics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ enum ScrollDecelerationRate {
/// // ...
/// final ScrollPhysics mergedPhysics = physics.applyTo(const AlwaysScrollableScrollPhysics());
/// ```
///
/// When implementing a subclass, you must override [applyTo] so that it returns
/// an appropriate instance of your subclass. Otherwise, classes like
/// [Scrollable] that inform a [ScrollPosition] will combine them with
/// the default [ScrollPhysics] object instead of your custom subclass.
@immutable
class ScrollPhysics {
/// Creates an object with the default scroll physics.
Expand Down

0 comments on commit 4792297

Please sign in to comment.