Skip to content
pubscout

scroll_when_needed

3.0.1, released 4 years ago by vanlooverenkoen.be

Custom scroll behavior and physics to scroll only when content exceeds available space.

WASM-ready
$ flutter pub add scroll_when_needed
Source repository

What it does

Provides a custom ScrollBehavior and scroll physics that enable platform-specific scrolling behavior only when there is not enough space inside a scrollable widget. It helps prevent unnecessary scrolling behavior on platforms where it is not desired when content fits completely.

AI-written summary of version 3.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want a scrollable widget to only scroll when its content exceeds the available space
  • You need platform-specific scrolling behavior based on content overflow

Skip it when

  • You always want scrolling enabled regardless of content size

Strengths

  • Simple integration via ScrollConfiguration and ListView physics
  • Supports platform-specific scrolling behaviors

Weaknesses

  • Limited documentation beyond basic usage
  • No topics specified on pub.dev

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
ScrollConfiguration(
    behavior: ScrollWhenNeededBehavior(),
    child: ListView(
        physics: ScrollWhenNeededPhysics(targetPlatform: Theme.of(context).platform),
        children: [
            Container(
                height: 100,
                color: Colors.amber,
            ),
            TextField(),
            Container(
                height: 300,
                color: Colors.amber,
            ),
        ],
    ),
),

Alternatives

Packages that do the same job and could replace scroll_when_needed.