mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: remove phantom where dragTarget disappear
This commit is contained in:
parent
3977925e8a
commit
e592a09ec3
@ -23,7 +23,9 @@ abstract class ReorderFlexDragTargetInterceptor {
|
|||||||
ReorderFlexDraggableTargetBuilder? get draggableTargetBuilder => null;
|
ReorderFlexDraggableTargetBuilder? get draggableTargetBuilder => null;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class OverlapReorderFlexDragTargetDelegate {}
|
abstract class OverlapReorderFlexDragTargetDelegate {
|
||||||
|
void dragTargetDidDisappear();
|
||||||
|
}
|
||||||
|
|
||||||
class OverlapReorderFlexDragTargetInteceptor
|
class OverlapReorderFlexDragTargetInteceptor
|
||||||
extends ReorderFlexDragTargetInterceptor {
|
extends ReorderFlexDragTargetInterceptor {
|
||||||
@ -50,7 +52,7 @@ class OverlapReorderFlexDragTargetInteceptor
|
|||||||
required String dragTargetId,
|
required String dragTargetId,
|
||||||
required int dragTargetIndex}) {
|
required int dragTargetIndex}) {
|
||||||
if (dragTargetId == dragTargetData.reorderFlexId) {
|
if (dragTargetId == dragTargetData.reorderFlexId) {
|
||||||
Log.debug('remove all phantom');
|
delegate.dragTargetDidDisappear();
|
||||||
} else {
|
} else {
|
||||||
Log.debug('add phantom to $dragTargetId');
|
Log.debug('add phantom to $dragTargetId');
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ class ReorderFlexState extends State<ReorderFlex>
|
|||||||
/// The [willAccept] will be true if the dargTarget is the widget that gets
|
/// The [willAccept] will be true if the dargTarget is the widget that gets
|
||||||
/// dragged and it is dragged on top of the other dragTargets.
|
/// dragged and it is dragged on top of the other dragTargets.
|
||||||
///
|
///
|
||||||
Log.debug(
|
Log.trace(
|
||||||
'[$ReorderDragTarget] ${widget.dataSource.identifier} on will accept, dragIndex:$dragIndex, dragTargetIndex:$dragTargetIndex, count: ${widget.dataSource.items.length}');
|
'[$ReorderDragTarget] ${widget.dataSource.identifier} on will accept, dragIndex:$dragIndex, dragTargetIndex:$dragTargetIndex, count: ${widget.dataSource.items.length}');
|
||||||
|
|
||||||
bool willAccept =
|
bool willAccept =
|
||||||
|
@ -207,6 +207,16 @@ class BoardPhantomController extends OverlapReorderFlexDragTargetDelegate
|
|||||||
_updatePhantom(phantomRecord!.toColumnId, dragTargetIndex);
|
_updatePhantom(phantomRecord!.toColumnId, dragTargetIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dragTargetDidDisappear() {
|
||||||
|
if (phantomRecord == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_removePhantom(phantomRecord!.toColumnId);
|
||||||
|
phantomRecord = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use [PhantomRecord] to record where to remove the column item and where to
|
/// Use [PhantomRecord] to record where to remove the column item and where to
|
||||||
|
Loading…
Reference in New Issue
Block a user