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