TouchToggle class final
A round button that is set rather than held: tapped once it is on, tapped again it is off.
The control TouchButton cannot be. A button that holds an action for as long as a finger is on it is right for a trigger and wrong for anything that lasts: on a handset one thumb is already on the stick, so pinning the other to a button for the length of a climb leaves nothing to aim with. The platformer's sprint was simply unreachable on a phone for that reason, and the crypt's map is the same shape of control — something that is on, not something that is being pressed.
Stateless, and the caller owns on. What "on" means differs by control:
sprint is a held action inside an InputState, and a map is a widget's own
bool. A button that kept its own answer would be able to disagree with
either — the classic checkbox that says off while the thing is on — so this
draws what it is told and reports the tap.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- TouchToggle
Constructors
- TouchToggle({Key? key, required String label, required bool on, required VoidCallback onTap, double radius = 30.0})
-
A toggle saying
label, drawn ason, ofradiuslogical pixels, 30 by default.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String
-
What it says, on its face and to a screen reader.
final
- on → bool
-
Whether the thing this switches is switched on, asked of whatever owns it.
final
- onTap → VoidCallback
-
Called on each tap; the owner flips the state, and this draws on as
it is handed back.
final
- radius → double
-
The radius, in logical pixels.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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