StacTooltip class

A Stac model representing Flutter's Tooltip widget.

Tooltips provide text labels which help explain the function of a button or other user interface action. Wrap the button in a Tooltip widget and provide a message which will be shown when the widget is long pressed.

{@tool snippet} Dart Example:

StacTooltip(
  message: 'I am a Tooltip',
  child: StacIcon(icon: 'info'),
  decoration: StacBoxDecoration(
    color: StacColors.blue,
    borderRadius: StacBorderRadius.circular(4),
  ),
  textStyle: StacTextStyle(color: StacColors.white),
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "tooltip",
  "message": "I am a Tooltip",
  "child": { "type": "icon", "icon": "info" },
  "waitDuration": { "milliseconds": 500 },
  "preferBelow": false
}

{@end-tool}

See also:

  • Flutter's Tooltip documentation (https://api.flutter.dev/flutter/material/Tooltip-class.html)
Inheritance
Available extensions
Annotations
  • @JsonSerializable.new(explicitToJson: true)

Constructors

StacTooltip({String? message, StacTextSpan? richMessage, StacBoxConstraints? constraints, StacEdgeInsets? padding, StacEdgeInsets? margin, double? verticalOffset, bool? preferBelow, bool? excludeFromSemantics, StacBoxDecoration? decoration, StacTextStyle? textStyle, StacTextAlign? textAlign, StacDuration? waitDuration, StacDuration? showDuration, StacDuration? exitDuration, bool enableTapToDismiss = true, StacTooltipTriggerMode? triggerMode, bool? enableFeedback, StacWidget? child})
Creates a StacTooltip that displays a text label on long press.
const
StacTooltip.fromJson(Map<String, dynamic> json)
Creates a StacTooltip from a JSON map.
factory

Properties

child → StacWidget?
The widget below this widget in the tree.
final
constraints → StacBoxConstraints?
The additional constraints to apply to the tooltip's child.
final
decoration → StacBoxDecoration?
The visual decoration to use for the tooltip.
final
enableFeedback → bool?
Whether the tooltip should provide acoustic and/or haptic feedback.
final
enableTapToDismiss → bool
Whether the tooltip can be dismissed by tapping the screen.
final
excludeFromSemantics → bool?
Whether the tooltip's message should be excluded from the semantics tree.
final
exitDuration → StacDuration?
The length of time that the tooltip takes to fade out after the showDuration has passed.
final
hashCode → int
The hash code for this object.
no setterinherited
jsonData → Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
margin → StacEdgeInsets?
The empty space that surrounds the tooltip.
final
message → String?
The text to display in the tooltip.
final
padding → StacEdgeInsets?
The amount of space by which to inset the tooltip's child.
final
preferBelow → bool?
Whether the tooltip defaults to being displayed below the widget.
final
richMessage → StacTextSpan?
The rich text to display in the tooltip.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showDuration → StacDuration?
The length of time that the tooltip will be shown after a long press is released (if triggerMode is StacTooltipTriggerMode.longPress) or a tap is released (if triggerMode is StacTooltipTriggerMode.tap).
final
textAlign → StacTextAlign?
How the message of the tooltip is aligned horizontally.
final
textStyle → StacTextStyle?
The style to use for the message of the tooltip.
final
triggerMode → StacTooltipTriggerMode?
Defines how this widget can be triggered. Defaults to StacTooltipTriggerMode.longPress in the Flutter widget.
final
type → String
The type of the widget
no setteroverride
verticalOffset → double?
The vertical gap between the widget and the displayed tooltip.
final
waitDuration → StacDuration?
The length of time that a pointer must hover over a tooltip's widget before the tooltip will be shown.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(BuildContext context) → Widget?

Available on StacWidget?, provided by the StacWidgetParser extension

parsePreferredSizeWidget(BuildContext context) → PreferredSizeWidget?

Available on StacWidget?, provided by the StacWidgetParser extension

toJson() → Map<String, dynamic>
Converts this StacTooltip to JSON.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited