DesignTooltip class

A tooltip of message for child, painted by tooltipBuilder.

It shows:

As WCAG 1.4.13 asks of content shown on hover or focus, the pointer may move from child onto the tip and it stays (hoverable); Escape hides it without moving the pointer or the focus, and goes no further when it hid one (dismissible); and it stays until the pointer or the focus leaves (persistent). A tap anywhere but on the tip hides it too.

One tooltip shows at a time, app-wide. While one shows, and for warmUpDuration after it hid, the next shows at once: running the pointer along a toolbar reads each control's tip without the wait. A route pushed over child hides it.

A screen reader hears message as child's tooltip, child and the message one node; the tip itself is left out of the semantics tree, so the words are not read twice. Put it round one control (a button, an icon), as a tip belongs to one.

The tip fades in and out on an effects spring (DesignMotionPolicy): under Reduce Motion, a short fade.

DesignTooltip(message: 'Save the report', tooltipBuilder: (context, info) => Text('Save the report'), child: const Text('Save'))
Inheritance

Constructors

DesignTooltip({Key? key, required String message, required DesignOverlaySurfaceBuilder tooltipBuilder, required Widget child, DesignOverlayPlacement placement = defaultPlacement, Duration hoverDelay = const Duration(milliseconds: 500), Duration dismissDelay = const Duration(milliseconds: 100), Duration touchDelay = const Duration(milliseconds: 1500), TooltipTriggerMode triggerMode = TooltipTriggerMode.longPress, bool enableFeedback = true, bool excludeFromSemantics = false})
A tooltip of message for child.
const

Properties

child → Widget
The control it describes.
final
dismissDelay → Duration
How long it stays after the pointer leaves child and the tip; 100 ms by default, time to cross the gap between them.
final
enableFeedback → bool
Whether a long press that shows it plays DesignHaptics.longPress; true by default.
final
excludeFromSemantics → bool
Whether a screen reader is left without message; false by default. True only where child already says it (its label is the message).
final
hashCode → int
The hash code for this object.
no setterinherited
hoverDelay → Duration
How long a pointer rests on child before it shows; 500 ms by default. Within warmUpDuration of another tip, none.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
message → String
What it says; a screen reader hears it as child's tooltip. Empty: no tooltip at all.
final
placement → DesignOverlayPlacement
Where the tip goes: defaultPlacement by default. Wherever it goes, it keeps clear of the screen's edges, the on-screen keyboard and a DesignOverlayPadding.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tooltipBuilder → DesignOverlaySurfaceBuilder
Paints the tip: DesignOverlayInfo.side is the side of child it took, DesignOverlayInfo.animation its presence (0 hidden, 1 shown), and DesignOverlayInfo.surfaceRect where it landed, for a tail that points at child. It never takes the focus.
final
touchDelay → Duration
How long it stays after a long press (or a tap, in TooltipTriggerMode.tap) lets go; 1.5 s by default.
final
triggerMode → TooltipTriggerMode
What a finger does to show it: TooltipTriggerMode.longPress (the default), TooltipTriggerMode.tap, or TooltipTriggerMode.manual (nothing: the child's own long press keeps its meaning). A pointer's hover and the keyboard's focus show it in every mode.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DesignTooltip>
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.
override
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

Static Methods

dismissAll() → bool
Hides the tip that shows, if one does; true when one did (Flutter's Tooltip.dismissAllToolTips).

Constants

defaultPlacement → const DesignOverlayPlacement
Above child, centred on it, 4 px from it; below where there are fewer than 48 px above (two lines of a tip) and more below.
warmUpDuration → const Duration
How long after a tip hid the next shows at once, with no hoverDelay: 300 ms.