leafOnly<T> static method
只允许叶子节点拖拽
适用于只允许最底层节点移动的场景,如文件系统中只能移动文件不能移动文件夹
示例:
TolyDraggableTree(
canDrop: DragRules.leafOnly<MyData>(),
// ...
)
Implementation
static bool? Function(
TreeNode<T> dragNode, TreeNode<T>? targetNode, DropPosition position)
leafOnly<T>() {
return (dragNode, targetNode, position) => dragNode.isLeaf;
}