chore(chat): migrate reorderable tab list to onReorderItem for flutter 3.44

ReorderableListView's onReorder was deprecated after Flutter 3.41 and
fails flutter analyze on the CI's pinned 3.44.1 toolchain. Switch to
onReorderItem, which adjusts newIndex for the removed item itself, and
drop the now-redundant manual off-by-one correction in reorderTab.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tommy Chow 2026-06-08 22:01:47 -07:00
parent e24491639d
commit d2b4f0f39e
2 changed files with 3 additions and 5 deletions

View file

@ -620,10 +620,8 @@ abstract class ChatTabsStoreBase with Store {
// Primary tab (index 0) cannot be moved, and nothing can move before it
if (oldIndex == 0 || newIndex == 0) return;
// ReorderableListView passes newIndex as if item was already removed
if (oldIndex < newIndex) {
newIndex -= 1;
}
// onReorderItem already adjusts newIndex for the removed item, so no
// manual off-by-one correction is needed here.
if (oldIndex == newIndex) return;
final tab = _tabs.removeAt(oldIndex);

View file

@ -144,7 +144,7 @@ class ChatTabs extends StatelessWidget {
left: 12,
right: showMerge ? 32 : 12,
),
onReorder: (oldIndex, newIndex) {
onReorderItem: (oldIndex, newIndex) {
HapticFeedback.lightImpact();
chatTabsStore.reorderTab(oldIndex, newIndex);
},