CNLiquidText class

A native text widget with a Liquid Glass effect applied.

On iOS 26+, renders text using native SwiftUI glassEffect(). On older platforms or non-iOS, falls back to a plain Text widget.

Example:

CNLiquidText(
  text: 'Hello',
  fontSize: 18,
  fontWeight: FontWeight.semiBold,
  glassConfig: LiquidGlassConfig(interactive: true),
  padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
)
Inheritance
Available extensions

Constructors

CNLiquidText({Key? key, required String text, double fontSize = 16.0, FontWeight fontWeight = FontWeight.normal, Color? textColor, LiquidGlassConfig glassConfig = const LiquidGlassConfig(), EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), TextStyle? fallbackStyle})
Creates a native text widget with a Liquid Glass effect.
const

Properties

fallbackStyle TextStyle?
TextStyle used on platforms where the native view is not available.
final
fontSize double
Font size in logical pixels.
final
fontWeight FontWeight
Font weight. Mapped to the nearest Swift Font.Weight value.
final
glassConfig LiquidGlassConfig
Glass effect configuration (shape, tint, interactive, …).
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
padding EdgeInsets
Padding around the text inside the glass bubble.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
The text to display.
final
textColor Color?
Optional text color. When null, the native side uses semantic .primary.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<CNLiquidText>
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
liquidGlass({CNGlassEffect effect = CNGlassEffect.regular, CNGlassEffectShape shape = CNGlassEffectShape.capsule, double? cornerRadius, Color? tint, bool interactive = false}) Widget

Available on Widget, provided by the LiquidGlassExtension extension

Applies a Liquid Glass effect to this widget.
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