Node class

A base class for all objects that can be added to the sprite node tree and rendered to screen using SpriteBox and SpriteWidget.

The Node class itself doesn't render any content, but provides the basic functions of any type of node, such as handling transformations and user input. To render the node tree, a root node must be added to a SpriteBox or a SpriteWidget. Commonly used sub-classes of Node are Sprite, NodeWithSize, and many more upcoming subclasses.

Nodes form a hierarchical tree. Each node can have a number of children, and the transformation (positioning, rotation, and scaling) of a node also affects its children.

Implementers

Constructors

Node()
Creates a new Node without any transformation.

Properties

children List<Node>
A list of the children of this node.
no setter
constraints List<Constraint>?
A List of Constraints that will be applied to the node. The constraints are applied after the update method has been called.
getter/setter pair
handleMultiplePointers bool
If set to true the node will receive multiple pointers, otherwise it will only receive events the first pointer.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
inverseTransformMatrix Matrix4
The inverse transform matrix used by this node.
no setter
motions MotionController
The MotionController associated with this node.
no setter
parent Node?
The parent of this node, or null if it doesn't have a parent.
no setter
paused bool
Decides if the node and its children is currently paused.
getter/setter pair
position Offset
The position of this node relative to its parent.
getter/setter pair
rotation double
The rotation of this node in degrees.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double
The scale of this node relative its parent.
getter/setter pair
scaleX double
The horizontal scale of this node relative its parent.
getter/setter pair
scaleY double
The vertical scale of this node relative its parent.
getter/setter pair
skewX double
The skew along the x-axis of this node in degrees.
getter/setter pair
skewY double
The skew along the y-axis of this node in degrees.
getter/setter pair
spriteBox SpriteBox?
The SpriteBox this node is added to, or null if it's not currently added to a SpriteBox.
no setter
transformMatrix Matrix4
The transformMatrix describes the transformation from the node's parent.
no setter
userInteractionEnabled bool
The node will receive user interactions, such as pointer (touch or mouse) events.
getter/setter pair
visible bool
The visibility of this node and its children.
getter/setter pair
zPosition double
The draw order of this node compared to its parent and its siblings.
getter/setter pair

Methods

addChild(Node child) → void
Adds a child to this node.
applyConstraints(double dt) → void
Called to apply the constraints to the node. Normally, this method is called automatically by the SpriteBox, but it can be called manually if the constraints need to be applied immediately.
computeTransformMatrix() Matrix4
Computes the transformation matrix of this node. This method can be overriden if a custom matrix is required. There is usually no reason to call this method directly.
convertPointFromNode(Offset point, Node node) Offset
Converts a point from another nodes coordinate system into the local coordinate system of this node.
convertPointToBoxSpace(Offset nodePoint) Offset
Converts a point from the local coordinate system of the node to the coordinate system of the SpriteBox.
convertPointToNodeSpace(Offset boxPoint) Offset
Converts a point from the coordinate system of the SpriteBox to the local coordinate system of the node.
handleEvent(SpriteBoxEvent event) bool
Handles an event, such as a pointer (touch or mouse) event.
handleKeyboardEvent(KeyEvent event) bool
Handles a keyboard event.
invalidateTransformMatrix() → void
Invalidates the current transform matrix. If the computeTransformMatrix method is overidden, this method should be called whenever a property changes that affects the matrix.
isPointInside(Offset point) bool
Returns true if the point is inside the node, the point is in the local coordinate system of the node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas) → void
Paints this node to the canvas.
removeAllChildren() → void
Removes all children of this node.
removeChild(Node child) → void
Removes a child from this node.
removeFromParent() → void
Removes this node from its parent node.
spriteBoxPerformedLayout() → void
Called whenever the SpriteBox is modified or resized, or if the device is rotated.
toString() String
A string representation of this object.
inherited
update(double dt) → void
Called before a frame is drawn.

Operators

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