DesignTapTarget class
Lays child out at least minSize (the floor for what reaches the controls, DesignTapTargets.of, when null), placed by alignment, and sends a tap anywhere in that area to the child's centre: the control's layout, the area a tap reaches and the box a screen reader outlines are one.
alignment is where the face stands in its target; the target grows away from the edges it names. Centred, as Material's is, by default. A face that starts on a column's keyline (a bare checkbox, a round key) takes AlignmentDirectional.centerStart, so its drawn face, not its target, stands on the keyline and the target grows toward the end, the top and the bottom; a field's trailing key takes AlignmentDirectional.centerEnd. Both mirror right to left.
The face stands on whole device pixels: an offset that falls between them (a 27 pt face centred in 44 stands 8.5 in) is rounded toward the start edge (and the top), so a pixel look's 1 px bevels and a hairline stay sharp, and right to left mirrors left to right exactly.
The control's semantics node spans the target too: what the child says
merges into one node the target's size, so a screen reader outlines, and
Flutter's tap-target guidelines (meetsGuideline) measure, the area a
tap reaches. Material's padded tap target (MaterialTapTargetSize.padded)
does the same. A control that widens only its own hit test past its box (a hit
slop) takes taps over its parent's bounds alone, since hit testing
reaches a child only inside its parent, while a screen reader outlines,
and Flutter's tap-target guidelines pass, the wider box.
The child is laid out under the constraints the target is given, as if nothing stood round it; the target grows round it as far as they let.
DesignTapTarget(
child: DesignPressable(onPressed: onPressed, builder: face),
)
A face on the column's start edge:
DesignTapTarget(
alignment: AlignmentDirectional.centerStart,
child: DesignPressable(onPressed: onPressed, builder: face),
)
See also:
- DesignTapTargets, the floors a look declares.
DesignTapTargetCheck, which holds a screen to them.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- RenderObjectWidget
- SingleChildRenderObjectWidget
- DesignTapTarget
Constructors
- DesignTapTarget({Key? key, Size? minSize, AlignmentGeometry alignment = AlignmentDirectional.center, required Widget child})
-
Lays
childout at leastminSize, placed byalignment.const
Properties
- alignment → AlignmentGeometry
-
Where the face stands in its target, which grows away from the edges
this names; AlignmentDirectional.center by default.
final
- child → Widget?
-
The widget below this widget in the tree.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- minSize → Size?
-
The least size; null: the floor for what reaches the controls
(DesignTapTargets.floorOn).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → SingleChildRenderObjectElement -
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
-
createRenderObject(
BuildContext context) → RenderObject -
Creates an instance of the RenderObject class that this
RenderObjectWidget represents, using the configuration described by this
RenderObjectWidget.
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.
override
-
didUnmountRenderObject(
covariant RenderObject renderObject) → void -
This method is called when a RenderObject that was previously
associated with this widget is removed from the render tree.
The provided RenderObject will be of the same type as the one created by
this widget's createRenderObject method.
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
-
updateRenderObject(
BuildContext context, covariant RenderDesignTapTarget renderObject) → void -
Copies the configuration described by this RenderObjectWidget to the
given RenderObject, which will be of the same type as returned by this
object's createRenderObject.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited