Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/pro_image_editor/features/reorder_layer_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ class _ReorderLayerSheetState extends State<ReorderLayerSheet> {
if (oldIndex == 0 || newIndex == 0) {
return;
}

if (oldIndex < newIndex) {
newIndex -= 1;
}
Comment on lines 145 to +151
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for newIndex == 0 should occur after the index adjustment on line 150. Currently, if an item is dragged downward where the adjusted newIndex would be 0, it won't be caught by the guard clause. Move the index adjustment before the guard clause, or add an additional check after the adjustment: if (oldIndex < newIndex) { newIndex -= 1; if (newIndex == 0) return; }

Copilot uses AI. Check for mistakes.
widget.onReorder(oldIndex, newIndex);
},
);
Expand Down
Loading