reorderable_grid
1.0.13, released 10 months ago by casvanluijtelaar.com
Reorderable grid widget with drag‑and‑drop support
What it does
Provides a drop‑in replacement for GridView that allows items to be reordered via drag and drop. It exposes callbacks for reorder start, completion, and optional locking of specific items.
AI-written summary of version 1.0.13, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a grid where users can reorder items by dragging
- You want a simple, declarative API without custom drag handles
- You need callbacks to update your data model after reordering
Skip it when
- You require highly custom drag handles or animations not supported by the package
- You need a non‑grid reorderable list (use ReorderableListView instead)
Strengths
- Drop‑in replacement for GridView
- Supports locking specific items from being dragged
- Provides onReorderStart callback
- Easy to integrate with existing state management
Weaknesses
- Only supports grid layouts, not list or custom slivers beyond provided ones
- Limited customization of drag handles compared to building your own widget
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add dependency to pubspec and import the package; no special permissions or build_runner needed
final items = List<int>.generate(40, (index) => index);
void _onReorder(int oldIndex, int newIndex) {
setState(() {
final item = items.removeAt(oldIndex);
items.insert(newIndex, item);
});
}
ReorderableGridView.extent(
maxCrossAxisExtent: 250,
onReorder: _onReorder,
childAspectRatio: 1,
children: items.map((item) => Card(
key: ValueKey(item),
child: Center(child: Text(item.toString())),
)).toList(),
);Alternatives
Packages that do the same job and could replace reorderable_grid.
- flutter_reorderable_list
Reorderable list for Flutter supporting slivers and large items
50Compare - tab_overview
Tab switcher with live thumbnails in a grid, zoom transitions, and drag-and-drop reordering.
73Compare - animated_reorderable
Animated, draggable reorderable ListView/GridView with built‑in swipe‑to‑delete.
73Compare - reorderable_grid_view
A reorderable grid view widget for Flutter supporting drag-and-drop reordering.
50Compare