WText class

A text widget with TailwindCSS-like styling support.

WText extends Flutter's Text widget with utility-first styling capabilities. It supports className-based styling for typography, colors, and text alignment.

Supported Style Classes

Font Sizes

  • text-xs: 12px
  • text-sm: 14px
  • text-base: 16px (default)
  • text-lg: 18px
  • text-xl: 20px
  • text-2xl: 24px

Font Weights

  • font-thin: FontWeight.w100
  • font-light: FontWeight.w300
  • font-normal: FontWeight.w400
  • font-medium: FontWeight.w500
  • font-semibold: FontWeight.w600
  • font-bold: FontWeight.w700
  • font-extrabold: FontWeight.w800
  • font-black: FontWeight.w900

Text Colors

  • text-{color}: text color (text-gray-900, text-blue-500, text-red-500)

Text Alignment

  • text-left: left alignment
  • text-center: center alignment
  • text-right: right alignment
  • text-justify: justify alignment

Example

WText(
  'Hello World',
  className: 'text-xl font-bold text-blue-600 text-center',
)

This creates text with:

  • 20px font size
  • Bold font weight
  • Blue color
  • Center alignment
Inheritance

Constructors

WText.new(String text, {Key? key, String? className, TextStyle? style, Color? color, double? fontSize, FontWeight? fontWeight, TextAlign? textAlign, int? maxLines, TextOverflow? overflow, double? letterSpacing, double? wordSpacing, double? height, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle})
Creates a Wind-styled text widget.
const

Properties

className String?
TailwindCSS-like class names for styling.
final
color Color?
The color of the text.
final
decoration TextDecoration?
The decoration to paint near the text.
final
decorationColor Color?
The color in which to paint the text decoration.
final
decorationStyle TextDecorationStyle?
The style in which to paint the text decoration.
final
fontSize double?
The font size of the text.
final
fontWeight FontWeight?
The font weight of the text.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of this text span, as a multiple of the font size.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
letterSpacing double?
The amount of space between each letter.
final
maxLines int?
The maximum number of lines for the text to span.
final
overflow TextOverflow?
How visual overflow should be handled.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style TextStyle?
The text style to apply.
final
text String
The text to display.
final
textAlign TextAlign?
How the text should be aligned horizontally.
final
wordSpacing double?
The amount of space between each word.
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