Skip to content
pubscout

sliver_passthrough

1.0.0, released 2 years ago by nikolaynik.com

Widget to place box widgets between slivers in a CustomScrollView

WASM-ready
$ flutter pub add sliver_passthrough
Source repository

What it does

Provides two widgets, SliverPassthrough and BoxToSliverPassthrough, that convert between sliver and box layout protocols and expose the box scroll offset via a ValueListenable.

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

Use it when

  • Embedding a box widget inside a sliver list or grid
  • Needing the scroll offset of a box for CustomPaint or other effects
  • Simplifying CustomScrollView construction when mixing slivers and boxes

Skip it when

  • Using only slivers or only boxes
  • Needing advanced layout features beyond simple box-to-sliver conversion

Strengths

  • Simple API, no external dependencies
  • Works across all Flutter platforms
  • Exposes scroll offset for custom painting

Weaknesses

  • Limited to sliver/box conversion, no advanced layout options
  • Documentation is minimal
  • No examples for complex use cases

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
CustomScrollView(
  slivers: [
    SliverPassthrough(
      minBoxExtent: 0.0,
      child: ColoredBox(
        color: Colors.red,
        child: BoxToSliverPassthrough(
          sliver: SliverList(
            delegate: SliverChildBuilderDelegate(
              (context, index) => SizedBox(),
            ),
          ),
        ),
      ),
    ),
  ],
)

Alternatives

Packages that do the same job and could replace sliver_passthrough.

Works with

Packages commonly used together with sliver_passthrough: ones it builds on, ones built on it, and its own family.