Skip to content
pubscout

expandable_reorderable_list

2.0.0, released 2 years ago by novade.net

Wrapper around ReorderableListView that adds tree structure, expand/collapse, and reordering.

WASM-ready
$ flutter pub add expandable_reorderable_list
Source repository

What it does

It lets you build a list of items that can be expanded or collapsed like a tree, while still supporting drag‑to‑reorder. Each item is built via a builder that receives the current model and child widget. The package removes the visibility_detector dependency, so visibility must be handled manually if needed.

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

Use it when

  • You need a reorderable list with expandable/collapsible tree nodes.
  • You want to reuse ReorderableListView API but add hierarchical support.
  • You need a simple, declarative way to build custom list items with drag handles.

Skip it when

  • You only need a flat list or a simple ListView.
  • You require high‑performance scrolling for very large trees.
  • You need built‑in visibility detection for lazy loading.

Strengths

  • Easy integration with existing ReorderableListView code.
  • No extra code generation or build_runner steps.
  • Supports custom builders and drag handles out of the box.

Weaknesses

  • Visibility detection removed; must wrap items manually if needed.
  • Limited to the features of ReorderableListView; no advanced animations or custom drag logic.
  • No support for nested lists beyond a single tree level.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
```dart
ExpandableReorderableList<ValueKey<int>>(
  onReorder: (details) {
    setState(() {
      var newIndex = details.newIndex;
      if (details.oldIndex < details.newIndex) newIndex -= 1;
      final item = _items.removeAt(details.oldIndex);
      _items.insert(newIndex, item);
    });
  },
  children: _items.map((int item) {
    return ExpandableReorderableListItem<ValueKey<int>>(
      key: ValueKey<int>(item),
      builder: (_, child, model) {
        return ReorderableDragStartListener(
          index: model.index!,
          child: ListTile(title: Text('Item $item')),
        );
      },
    );
  }).toList(),
);
```

Alternatives

Packages that do the same job and could replace expandable_reorderable_list.

Works with

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