Skip to content
pubscout

flutter_sticky_widgets

0.0.3, released 4 years ago by sankethbk.me

Provides widgets that emulate CSS position: sticky in Flutter.

WASM-ready
$ flutter pub add flutter_sticky_widgets
Source repository

What it does

StickyContainer and StickyWidget let a child widget stay fixed at a position while scrolling until a threshold. They use a shared ScrollController to track scroll offset and reposition the widget between initial and final positions.

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

Use it when

  • Implement sticky headers or footers in a list
  • Create floating action buttons that stick after scrolling
  • Need a simple, platform‑agnostic sticky UI pattern

Skip it when

  • Complex nested scroll views that require independent controllers
  • Performance‑critical apps where every frame must be ultra‑fast
  • Scenarios needing custom scroll physics beyond basic offset tracking

Strengths

  • Simple API, no code generation
  • Works on all Flutter platforms (web, mobile, desktop)
  • No external dependencies beyond Flutter

Weaknesses

  • Requires a single ScrollController shared with the scrollable
  • Limited to two‑parameter positions (top/bottom, left/right)
  • No built‑in support for nested or multi‑axis scrolling

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:flutter_sticky_widgets/flutter_sticky_widgets.dart';

StickyContainer(
  stickyChildren: [
    StickyWidget(
      initialPosition: StickyPosition(bottom: 20, right: 20),
      finalPosition: StickyPosition(
        bottom: MediaQuery.of(context).size.height - 80, right: 20),
      controller: _controller,
      child: Container(
        width: 40,
        height: 40,
        decoration: const BoxDecoration(
          shape: BoxShape.circle,
          color: Colors.green,
        ),
        child: const Center(child: Icon(Icons.pause)),
      ),
    ),
  ],
  child: ListView.builder(
    controller: _controller,
    itemCount: 50,
    itemBuilder: (context, index) {
      return ListTile(title: Text("Tile $index"));
    },
  ),
);

Alternatives

Packages that do the same job and could replace flutter_sticky_widgets.