FloatingLabel class

A text label that continuously bobs up and down as if floating in zero gravity.

The float animation is a smooth sine wave applied via Transform.translate. An optional glow effect reinforces the floating appearance.

Usage

FloatingLabel(
  'Score: 9999',
  style:     TextStyle(color: Colors.amber, fontSize: 22, fontWeight: FontWeight.bold),
  amplitude: 8,
  period:    Duration(milliseconds: 2000),
  glow:      true,
  glowColor: Colors.amber,
)
Inheritance

Constructors

FloatingLabel(String text, {Key? key, TextStyle? style, double amplitude = 6, Duration period = const Duration(milliseconds: 2000), bool glow = false, Color? glowColor, double phaseOffset = 0})
const

Properties

amplitude double
Amplitude of the vertical oscillation in logical pixels.
final
glow bool
Whether to add a soft glow shadow behind the text.
final
glowColor Color?
Glow colour. Defaults to the text colour.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
period Duration
Duration of one complete up-down cycle.
final
phaseOffset double
Phase offset (0.0–1.0) for staggering multiple FloatingLabels.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style TextStyle?
final
text String
final

Methods

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