PlTooltip class

A short label that appears when the pointer rests on something.

PlTooltip(
  content: const Text('Copy'),
  child: PlButton(onPressed: copy, child: const PlIcon(icon: CopyGlyph())),
)

The whole component is a wrapper: it adds no box to the layout and the child stays whatever it was — a button, a chip, a truncated cell.

content is a short phrase. A tooltip is not a container: it cannot be reached by a finger on a touch screen, it goes the moment attention moves, and anything inside it that could be pressed cannot be. Content that needs either of those belongs in a sheet that stays put.

The plate is the same floating sheet a PlSelect's popup is: the glass at its most opaque, a white hairline round it, a shadow under it. Not a filled key, which is what most libraries draw a tooltip as — a tooltip is a note about something rather than a thing to press, and the library already has one answer for a surface that floats over arbitrary content.

Needs an Overlay above it, which WidgetsApp with a navigator and MaterialApp both provide.

Inheritance

Constructors

PlTooltip({required Widget content, required Widget child, PlassSide side = PlassSide.top, PlassAlign align = PlassAlign.center, double offset = 6, Duration delay = const Duration(milliseconds: 600), Duration closeDelay = Duration.zero, bool arrow = true, bool? open, ValueChanged<bool>? onOpenChanged, bool disabled = false, String? semanticLabel, PlassSize? size, PlassDensity? density, Key? key})
Creates a tooltip.
const

Properties

align PlassAlign
Where it sits along that edge.
final
arrow bool
Draws the little wedge pointing at the trigger.
final
child Widget
What it hangs off.
final
closeDelay Duration
How long it waits before closing once the pointer leaves.
final
content Widget
What the tooltip says.
final
delay Duration
How long the pointer has to rest before it opens.
final
density PlassDensity?
How tightly the plate packs its text.
final
disabled bool
Stops the tooltip opening at all, without disabling the trigger. For the tooltip that only exists while a label is truncated.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
offset double
How far it stands off the trigger, in logical pixels.
final
onOpenChanged ValueChanged<bool>?
Called whenever the tooltip opens or closes, however it was asked.
final
open bool?
Drives the tooltip from outside.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String?
What a screen reader says the trigger's tooltip is.
final
side PlassSide
Which edge of the trigger it appears on. It flips to the opposite side when there is no room.
final
size PlassSize?
Type scale, radius and padding of the plate.
final

Methods

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