Skip to content
pubscout

sticky_and_expandable_list

1.1.3, released 3 years ago by sshine.dev

Grouped list with sticky headers and expandable sections for CustomScrollView

WASM-ready
$ flutter pub add sticky_and_expandable_list
Source repository

What it does

Provides a sliver‑compatible list that groups items into sections, each section can be expanded or collapsed and the header sticks while scrolling. It supports custom section widgets, dividers, overlap content, pull‑to‑refresh, load more and scrolling to a specific index.

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

Use it when

  • You need a scrollable list with sticky headers and expandable sections in a CustomScrollView
  • You want to avoid multiple list widgets for large data sets
  • You need to customize section appearance or animation

Skip it when

  • You only need a simple ListView without grouping or sticky headers
  • You are targeting a platform that does not support slivers (e.g., web without CustomScrollView)

Strengths

  • Efficient memory usage by using a single list widget
  • Built‑in support for slivers, pull‑to‑refresh, load more and scroll‑to‑index
  • Highly customizable section builder and animation
  • No external dependencies beyond Flutter

Weaknesses

  • No support for nested lists beyond a limited feature set
  • Limited documentation on advanced customization
  • No built‑in theming or styling beyond basic widgets

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Add dependency in pubspec.yaml and import the package. No additional permissions or build_runner needed.

```dart
import 'package:sticky_and_expandable_list/sticky_and_expandable_list.dart';

class ExampleSection implements ExpandableListSection<String> {
  final String title;
  final List<String> items;
  bool _expanded = false;
  ExampleSection(this.title, this.items);
  @override
  bool get isExpanded => _expanded;
  @override
  set isExpanded(bool value) => _expanded = value;
}

final sections = [
  ExampleSection('Fruits', ['Apple', 'Banana']),
  ExampleSection('Vegetables', ['Carrot', 'Lettuce']),
];

ExpandableListView(
  builder: SliverExpandableChildDelegate<String, ExampleSection>(
    sectionList: sections,
    headerBuilder: (ctx, sectionIndex, _) => Text(sections[sectionIndex].title),
    itemBuilder: (ctx, sectionIndex, itemIndex, _) {
      final item = sections[sectionIndex].items[itemIndex];
      return ListTile(title: Text(item));
    },
  ),
);
```

Alternatives

Packages that do the same job and could replace sticky_and_expandable_list.