SmartText class

A text widget that uses typography tokens.

Use SmartText for consistent typography based on your design system tokens.

Example:

SmartText(
  'Hello World',
  style: TypographyStyle.headlineLarge,
)

// Responsive text
SmartText.responsive(
  'Hello World',
  mobile: TypographyStyle.bodyMedium,
  tablet: TypographyStyle.bodyLarge,
  desktop: TypographyStyle.headlineSmall,
)
Inheritance
Available extensions

Constructors

SmartText(String text, {Key? key, TypographyStyle style = TypographyStyle.bodyMedium, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, int? maxLines, bool? softWrap, Color? textColor, TextStyle? customStyle})
Creates a SmartText widget with a typography style.
const
SmartText.responsive(String text, {Key? key, TypographyStyle? watch, TypographyStyle? mobile, TypographyStyle? tablet, TypographyStyle? desktop, TypographyStyle? tv, TextAlign? textAlign, TextDirection? textDirection, TextOverflow? overflow, int? maxLines, bool? softWrap, Color? textColor, TextStyle? customStyle})
Creates a SmartText widget with responsive typography styles.
const

Properties

customStyle TextStyle?
A custom TextStyle to merge with the typography style.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxLines int?
Maximum number of lines.
final
overflow TextOverflow?
How visual overflow should be handled.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
softWrap bool?
Whether the text should break at soft line breaks.
final
style TypographyStyle
The typography style to use.
final
text String
The text to display.
final
textAlign TextAlign?
How the text should be aligned horizontally.
final
textColor Color?
The color of the text.
final
textDirection TextDirection?
The direction of the text.
final

Methods

aligned(AlignmentGeometry alignment) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Aligns this widget within its parent.
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
centered() Widget

Available on Widget, provided by the SmartWidgetExtension extension

Centers this widget.
clipped({BorderRadius borderRadius = BorderRadius.zero}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget with a ClipRRect.
constrained({double? minWidth, double? maxWidth, double? minHeight, double? maxHeight}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a ConstrainedBox.
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
decorated(BoxDecoration decoration) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a DecoratedBox.
expanded({int flex = 1}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Expands this widget to fill available space.
flexible({int flex = 1, FlexFit fit = FlexFit.loose}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Makes this widget flexible.
hideOn(List<SmartBreakpoint> breakpoints, {Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Hides this widget on the specified breakpoints.
hideOnDesktop({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Hides this widget on desktop and TV breakpoints.
hideOnMobile({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Hides this widget on mobile and watch breakpoints.
inkWell({VoidCallback? onTap, BorderRadius? borderRadius}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget with Material and InkWell for ripple effects.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTap(VoidCallback? onTap) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a GestureDetector.
opacity(double opacity) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds opacity to this widget.
padded(EdgeInsets padding) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds padding using EdgeInsets.
paddedAll(double value) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds equal padding on all sides.
paddedHorizontal(double value) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds horizontal padding.
paddedSymmetric({double horizontal = 0, double vertical = 0}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds symmetric padding.
paddedVertical(double value) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds vertical padding.
responsivePadding({EdgeInsets? watch, EdgeInsets? mobile, EdgeInsets? tablet, EdgeInsets? desktop, EdgeInsets? tv}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds responsive padding to this widget.
safeArea({bool left = true, bool top = true, bool right = true, bool bottom = true}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a SafeArea.
scrollable({Axis scrollDirection = Axis.vertical, EdgeInsets? padding}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a SingleChildScrollView.
showOnDesktop({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on desktop and TV breakpoints.
showOnly(List<SmartBreakpoint> breakpoints, {Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on the specified breakpoints.
showOnMobile({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on mobile and watch breakpoints.
showOnTablet({Widget? replacement}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Shows this widget only on tablet breakpoint.
sized({double? width, double? height}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Wraps this widget in a SizedBox with the given dimensions.
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
withPadding(SpacingSize size) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds padding using spacing tokens.
withPaddingOnly({SpacingSize? left, SpacingSize? top, SpacingSize? right, SpacingSize? bottom}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds padding on specific sides using spacing tokens.
withSymmetricPadding({SpacingSize? horizontal, SpacingSize? vertical}) Widget

Available on Widget, provided by the SmartWidgetExtension extension

Adds symmetric padding using spacing tokens.

Operators

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