VirtualJoystick class Widgets

An ergonomic on-screen multi-touch virtual thumbstick for driving game characters and cameras.

Note on coordinate space: The joystick emits raw screen-space directions (where pushing up is -Y and right is +X). When feeding into character controllers expecting +Y as forward, invert the Y axis: controller.setMoveInput(vm.Vector2(dir.x, -dir.y)).

Inheritance

Constructors

VirtualJoystick({Key? key, required JoystickCallback onChanged, double radius = 60.0, double knobRadius = 24.0, double deadzone = 0.1, BoxDecoration? baseDecoration, BoxDecoration? knobDecoration})
const

Properties

baseDecoration BoxDecoration?
Optional decoration for the outer ring.
final
deadzone double
Deadzone radius (0.0 to <1.0) below which input is reported as zero.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
knobDecoration BoxDecoration?
Optional decoration for the inner knob.
final
knobRadius double
Radius of the inner draggable knob.
final
onChanged JoystickCallback
Callback receiving the normalized direction vector in screen coordinates.
final
radius double
Radius of the outer boundary circle.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<VirtualJoystick>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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