Beacon class Hints
A pulsing dot that draws the eye, and opens a hint when tapped.
The quiet alternative to a tour: leave one next to a feature people keep missing, and let them find it in their own time.
Beacon(
message: 'Long-press a shift to duplicate it',
child: const Icon(Icons.calendar_month),
)
With no child the beacon is just the dot, which is what you want when it sits in a Stack over something else. With a child, the dot is positioned at alignment over it.
The pulse stops under MediaQueryData.disableAnimations, and the dot carries a semantic label so it is not an invisible affordance to a screen reader.
Testing
A pulsing beacon always has a frame scheduled, so tester.pumpAndSettle()
on a page containing one never returns. Either pass autoStart: false in
widget tests, or pump a fixed number of frames:
await tester.pump(const Duration(milliseconds: 300));
- Inheritance
Constructors
- Beacon({String? message, String? title, HintContentBuilder? contentBuilder, Widget? child, Color? color, double size = 10, AlignmentGeometry alignment = Alignment.topRight, Duration period = const Duration(milliseconds: 1800), bool autoStart = true, int? pulseCount, HintDirection direction = HintDirection.auto, HintThemeData? theme, bool interactive = false, String semanticsLabel = 'More information', VoidCallback? onShow, VoidCallback? onDismiss, Key? key})
-
Creates a beacon.
const
Properties
- alignment → AlignmentGeometry
-
Where the dot sits over child.
final
- autoStart → bool
-
Whether the pulse runs on its own.
final
- child → Widget?
-
The widget the dot is placed over.
final
- color → Color?
-
The dot's colour. Defaults to the theme's background colour, which is the
same colour the bubble it opens will be.
final
- contentBuilder → HintContentBuilder?
-
Rich content for the hint the beacon opens.
final
- direction → HintDirection
-
Which side the hint prefers.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- interactive → bool
-
Whether the hint's bubble may contain interactive content.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- message → String?
-
Body text of the hint the beacon opens.
final
- onDismiss → VoidCallback?
-
Called when the hint closes.
final
- onShow → VoidCallback?
-
Called when the hint opens.
final
- period → Duration
-
How long one pulse takes.
final
- pulseCount → int?
-
How many times to pulse before settling into a static dot.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String
-
Screen-reader label for the dot.
final
- size → double
-
Diameter of the solid dot. The ring grows to twice this.
final
- theme → HintThemeData?
-
Visual overrides for the hint and the dot.
final
- title → String?
-
Title of the hint the beacon opens.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Beacon> -
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