TouchDrive class final

A wheel and pedals, drawn over a game nobody can reach a keyboard for.

TouchControls does not fit and should not be made to. It is a thumb stick and a cluster of buttons; a vehicle has no stick, its steering is one axis rather than two, and its two most important controls are held for whole corners at a time rather than tapped. Bending the shared widget into this shape would make it worse at the games that already use it.

The layout:

control where
SteeringBand on steerLeft and steerRight bottom left
pedals (TouchButton.pedal): handbrake, brake, throttle bottom right, the throttle nearest the thumb
corner top right, on its own

What the controls are named and which actions they press are the game's.

Inheritance

Constructors

TouchDrive({Key? key, required InputState state, required GameAction steerLeft, required GameAction steerRight, required GameAction throttle, required GameAction brake, GameAction? handbrake, TouchAction? corner, String? throttleLabel, String? brakeLabel, String? handbrakeLabel, AxisAction? steer})
A wheel on steerLeft and steerRight and pedals on throttle and brake over state; the handbrake and corner only when given.
const

Properties

brake → GameAction
The action the brake pedal holds.
final
brakeLabel → String?
What the brake pedal says; null for the word in the player's language.
final
corner → TouchAction?
A button pressed once, standing still — fresh tyres, a reset, a horn — or null for none.
final
handbrake → GameAction?
Optional, because a game may not have one and a control for nothing is worse than a gap.
final
handbrakeLabel → String?
What the handbrake pedal says; null for the word in the player's language.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → InputState
The input the wheel and pedals write into, as a device would.
final
steer → AxisAction?
The wheel as one AxisAction as well — see SteeringBand.axis.
final
steerLeft → GameAction
The action the wheel gives its left lock, a fraction from nought to one.
final
steerRight → GameAction
The action the wheel gives its right lock, a fraction from nought to one.
final
throttle → GameAction
The action the throttle pedal holds, the one nearest the thumb.
final
throttleLabel → String?
What the pedals say, on them and to a screen reader; null for Flutter3dGameLocalizations.throttle, brake and handbrake in the player's language.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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