OrgChartController<E> class

Implementers

Constructors

OrgChartController({required List<E> items, Size boxSize = const Size(200, 100), Offset spacing = const Offset(20, 50), required String? idProvider(E data), required String? toProvider(E data), OrgChartOrientation orientation = OrgChartOrientation.leftToRight})

Properties

boxSize Size
The size of each node box. Needed to determine it here and not in the contentBuilder function because I need this value for the calculations
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
idProvider String? Function(E data)
The following function is included to ease the use of custom data types whether it be a map with key 'id' or 'pk' or a custom class, just use this function to provide the ids The function that returns the id of the node.
getter/setter pair
items List<E>
returns the list of items showed in the graph use the remove item if you want to remove an item from the list
getter/setter pair
orientation OrgChartOrientation
getter/setter pair
roots List<Node<E>>
returns the list of root nodes
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spacing Offset
The spacing between each node box. Needed here for the same reason i need boxSize here.
getter/setter pair
toProvider String? Function(E data)
The following function is included to ease the use of custom data types whether it be a map with key 'id' or 'pk' or a custom class, just use this function to provide the ids The function that returns the id of the node that the current node is pointing to.
getter/setter pair
uniqueNodeId String
to generate a unique id for an item this is used when you want to add an item to the list and you don't want to provide an id for it you might want to get an id from the server, but in case of a local list you can use this function
no setter

Methods

addItem(E item) → void
to add an item to the list position will be calculated afterwards
allLeaf(List<Node<E>> nodes) bool
returns true if all the nodes in the list are leaves nodes
calculatePosition() → void
call this function when you want to recalculate the positions of the nodes for example if you want to restore the postion after dragging the items around but don't forget to setState after calcutions this function is called automatically when you change the items list
changeNodeIndex(Node<E> node, dynamic index) → void
changes the index of the node in the list, if index is -1 then it will be moved to the end of the list this is used on drag start to move the dragged node to the end of the list so that it will be drawn on top
getOverlapping(Node<E> node) List<Node<E>>
input: the node that we want to get the overlapping nodes with returns a list of nodes that are overlapping with the input node sorted by closest to farthest from the input node
getSize({Offset offset = const Offset(0, 0)}) Offset
returns the total size of the graph
getSubNodes(Node<E> node) List<Node<E>>
returns the list of nodes that are pointing to the input node
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeItem(dynamic id) → void
to remove an item from the list
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited