FlexiText class

A responsive and flexible text widget that adapts its font size to either a fixed size or screen width breakpoints.

You can provide:

  • size for a single fixed font size
  • sizes for responsive font sizes across breakpoints

Additional options include alignment, min/max font size clamping, text style, and tap handling.

Inheritance

Constructors

FlexiText({Key? key, required String title, Map<double, double>? sizes, double? size, TextStyle? style, double? minFontSize, double? maxFontSize, String? semanticsLabel, TextAlign? textAlign, int? maxLines, TextOverflow? overflow, Alignment? alignment, VoidCallback? onTap})
Creates a FlexiText widget.
const

Properties

alignment Alignment?
Optional alignment wrapper.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxFontSize double?
Maximum font size (to avoid being too large).
final
maxLines int?
Maximum number of lines.
final
minFontSize double?
Minimum font size (to avoid being too small).
final
onTap VoidCallback?
Optional tap handler.
final
overflow TextOverflow?
Overflow handling when the text is too long.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabel String?
Optional semantics label for accessibility.
final
size double?
Single fixed font size. If provided, sizes is ignored.
final
sizes Map<double, double>?
Map of screen width breakpoints to font sizes. Example: {300: 12, 600: 16, 1200: 24}.
final
style TextStyle?
Optional text style.
final
textAlign TextAlign?
Optional text alignment.
final
title String
The text to display.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
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
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