mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: inserted index out of boundr
This commit is contained in:
parent
e592a09ec3
commit
2e0256f305
@ -71,7 +71,13 @@ class BoardColumnDataController extends ChangeNotifier
|
||||
void insert(int index, ColumnItem item, {bool notify = true}) {
|
||||
Log.debug(
|
||||
'[$BoardColumnDataController] $columnData insert $item at $index');
|
||||
columnData._items.insert(index, item);
|
||||
|
||||
if (columnData._items.length > index) {
|
||||
columnData._items.insert(index, item);
|
||||
} else {
|
||||
columnData._items.add(item);
|
||||
}
|
||||
|
||||
if (notify) {
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -25,6 +25,11 @@ abstract class ReorderFlexDragTargetInterceptor {
|
||||
|
||||
abstract class OverlapReorderFlexDragTargetDelegate {
|
||||
void dragTargetDidDisappear();
|
||||
bool acceptNewDragTargetData(
|
||||
String reorderFlexId,
|
||||
FlexDragTargetData dragTargetData,
|
||||
int dragTargetIndex,
|
||||
);
|
||||
}
|
||||
|
||||
class OverlapReorderFlexDragTargetInteceptor
|
||||
@ -54,7 +59,11 @@ class OverlapReorderFlexDragTargetInteceptor
|
||||
if (dragTargetId == dragTargetData.reorderFlexId) {
|
||||
delegate.dragTargetDidDisappear();
|
||||
} else {
|
||||
Log.debug('add phantom to $dragTargetId');
|
||||
delegate.acceptNewDragTargetData(
|
||||
dragTargetId,
|
||||
dragTargetData,
|
||||
dragTargetIndex,
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user