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:
@ -71,7 +71,13 @@ class BoardColumnDataController extends ChangeNotifier
|
|||||||
void insert(int index, ColumnItem item, {bool notify = true}) {
|
void insert(int index, ColumnItem item, {bool notify = true}) {
|
||||||
Log.debug(
|
Log.debug(
|
||||||
'[$BoardColumnDataController] $columnData insert $item at $index');
|
'[$BoardColumnDataController] $columnData insert $item at $index');
|
||||||
|
|
||||||
|
if (columnData._items.length > index) {
|
||||||
columnData._items.insert(index, item);
|
columnData._items.insert(index, item);
|
||||||
|
} else {
|
||||||
|
columnData._items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
if (notify) {
|
if (notify) {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,11 @@ abstract class ReorderFlexDragTargetInterceptor {
|
|||||||
|
|
||||||
abstract class OverlapReorderFlexDragTargetDelegate {
|
abstract class OverlapReorderFlexDragTargetDelegate {
|
||||||
void dragTargetDidDisappear();
|
void dragTargetDidDisappear();
|
||||||
|
bool acceptNewDragTargetData(
|
||||||
|
String reorderFlexId,
|
||||||
|
FlexDragTargetData dragTargetData,
|
||||||
|
int dragTargetIndex,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class OverlapReorderFlexDragTargetInteceptor
|
class OverlapReorderFlexDragTargetInteceptor
|
||||||
@ -54,7 +59,11 @@ class OverlapReorderFlexDragTargetInteceptor
|
|||||||
if (dragTargetId == dragTargetData.reorderFlexId) {
|
if (dragTargetId == dragTargetData.reorderFlexId) {
|
||||||
delegate.dragTargetDidDisappear();
|
delegate.dragTargetDidDisappear();
|
||||||
} else {
|
} else {
|
||||||
Log.debug('add phantom to $dragTargetId');
|
delegate.acceptNewDragTargetData(
|
||||||
|
dragTargetId,
|
||||||
|
dragTargetData,
|
||||||
|
dragTargetIndex,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user