From 17899ebb5bd49d8ab1f52c6646c8a43119696dd4 Mon Sep 17 00:00:00 2001 From: Leigha Jarett Date: Mon, 19 Jun 2023 15:38:07 -0400 Subject: [PATCH] Fixing example --- .../flutter/lib/src/material/reorderable_list.dart | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/material/reorderable_list.dart b/packages/flutter/lib/src/material/reorderable_list.dart index 1b874ef8603..ed6b815b093 100644 --- a/packages/flutter/lib/src/material/reorderable_list.dart +++ b/packages/flutter/lib/src/material/reorderable_list.dart @@ -23,7 +23,19 @@ import 'theme.dart'; /// removing the item at oldIndex from the list will /// reduce the list's length by one. /// Implementations will need to account for this -/// when inserting before newIndex. +/// when inserting before newIndex. Typically the [onReorder] +/// callback adjusts its index parameters like this: +/// +/// ``` +/// onReorder: (int oldIndex, int newIndex) { +/// if (oldIndex < newIndex) { +/// // removing the item at oldIndex will shorten the list by 1. +/// newIndex -= 1; +/// } +/// .... +/// } +/// ``` +/// /// /// {@tool dartpad} ///