mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: fix reset phantom record bug
This commit is contained in:
parent
621c9615a1
commit
1ba24c00ba
@ -14,11 +14,10 @@ class _MultiBoardListExampleState extends State<MultiBoardListExample> {
|
||||
debugPrint('Move column from $fromIndex to $toIndex');
|
||||
},
|
||||
onMoveColumnItem: (columnId, fromIndex, toIndex) {
|
||||
debugPrint('Column:$columnId move item from $fromIndex to $toIndex');
|
||||
debugPrint('Move $columnId:$fromIndex to $columnId:$toIndex');
|
||||
},
|
||||
onMoveColumnItemToColumn: (fromColumnId, fromIndex, toColumnId, toIndex) {
|
||||
debugPrint(
|
||||
'Column:$fromColumnId move item at $fromIndex to column:$toColumnId $toIndex');
|
||||
debugPrint('Move $fromColumnId:$fromIndex to $toColumnId:$toIndex');
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -56,5 +56,5 @@ class TextItem extends ColumnItem {
|
||||
TextItem(this.s);
|
||||
|
||||
@override
|
||||
String get id => throw UnimplementedError();
|
||||
String get id => s;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class BoardDataController extends ChangeNotifier
|
||||
columnController.removeAt(index);
|
||||
|
||||
Log.debug(
|
||||
'[$BoardPhantomController] Column$columnId remove phantom, current count: ${columnController.items.length}');
|
||||
'[$BoardDataController] Column$columnId remove phantom, current count: ${columnController.items.length}');
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ class _ReorderDragTargetState<T extends DragTargetData>
|
||||
transform: Matrix4.rotationZ(0),
|
||||
alignment: FractionalOffset.topLeft,
|
||||
child: Material(
|
||||
elevation: 2.0,
|
||||
elevation: 3.0,
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.zero,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
@ -212,10 +212,10 @@ class DragTargetAnimation {
|
||||
value: 0, vsync: vsync, duration: reorderAnimationDuration);
|
||||
|
||||
insertController = AnimationController(
|
||||
value: 0.0, vsync: vsync, duration: reorderAnimationDuration);
|
||||
value: 0.0, vsync: vsync, duration: const Duration(milliseconds: 100));
|
||||
|
||||
deleteController = AnimationController(
|
||||
value: 0.0, vsync: vsync, duration: reorderAnimationDuration);
|
||||
value: 0.0, vsync: vsync, duration: const Duration(milliseconds: 10));
|
||||
}
|
||||
|
||||
void startDargging() {
|
||||
|
@ -328,10 +328,13 @@ class ReorderFlexState extends State<ReorderFlex>
|
||||
"[DragTarget]: Column${widget.dataSource.identifier} end dragging");
|
||||
|
||||
setState(() {
|
||||
_onReordered(
|
||||
dragState.dragStartIndex,
|
||||
dragState.currentIndex,
|
||||
);
|
||||
if (dragTargetData.reorderFlexId == widget.reorderFlexId) {
|
||||
_onReordered(
|
||||
dragState.dragStartIndex,
|
||||
dragState.currentIndex,
|
||||
);
|
||||
}
|
||||
|
||||
dragState.endDragging();
|
||||
widget.onDragEnded?.call();
|
||||
});
|
||||
|
@ -64,26 +64,22 @@ class BoardPhantomController extends OverlapDragTargetDelegate
|
||||
/// Remove the phanton in the column when the column is end dragging.
|
||||
void columnEndDragging(String columnId) {
|
||||
columnsState.setColumnIsDragging(columnId, true);
|
||||
if (phantomRecord != null) {
|
||||
if (phantomRecord!.fromColumnId == columnId) {
|
||||
columnsState.notifyDidRemovePhantom(phantomRecord!.toColumnId);
|
||||
}
|
||||
}
|
||||
_swapColumnData();
|
||||
}
|
||||
if (phantomRecord == null) return;
|
||||
|
||||
void _swapColumnData() {
|
||||
if (phantomRecord == null) {
|
||||
final fromColumnId = phantomRecord!.fromColumnId;
|
||||
final toColumnId = phantomRecord!.toColumnId;
|
||||
if (fromColumnId == columnId) {
|
||||
columnsState.notifyDidRemovePhantom(toColumnId);
|
||||
}
|
||||
|
||||
if (columnsState.isDragging(fromColumnId) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (columnsState.isDragging(phantomRecord!.fromColumnId) == false) {
|
||||
return;
|
||||
}
|
||||
delegate.swapColumnItem(
|
||||
phantomRecord!.fromColumnId,
|
||||
fromColumnId,
|
||||
phantomRecord!.fromColumnIndex,
|
||||
phantomRecord!.toColumnId,
|
||||
toColumnId,
|
||||
phantomRecord!.toColumnIndex,
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user