FitText class

Text widget with pre-built styles: Headline: based on TextTheme.headlineLarge. Title: based on TextTheme.titleLarge. Body: based on TextTheme.bodyLarge. Button: based on TextTheme.labelLarge. hint: based on TextTheme.labelSmall.

The text style is also based on FitTheme.baseTextStyle. Here is the order for merging the 3 styles together:

  1. Role style (headline, title, etc.)
  2. Base style (from FitTheme)
  3. Custom stlye (FitText.style)

FiText may also automatically wrap the Text widget inside a Container, if necessary. To be wrapped in a Container, at least one of the following properties needs to be non null:

Inheritance

Constructors

FitText.new(String text, {Key? key, TextStyle? style, EdgeInsets? margin, EdgeInsets? padding, TextAlign? textAlign, double? width, double? height, Alignment? alignment, int? maxLines = 5, TextOverflow? overflow})
Creates a basic text with no role styling.
const
FitText.body(String text, {Key? key, TextStyle? style, EdgeInsets? margin, EdgeInsets? padding, TextAlign? textAlign, double? width, double? height, Alignment? alignment, int? maxLines = 5, TextOverflow? overflow})
Creates a body text with the body role.
const
FitText.button(String text, {Key? key, TextStyle? style, EdgeInsets? margin, EdgeInsets? padding, TextAlign? textAlign, double? width, double? height, Alignment? alignment, int? maxLines = 5, TextOverflow? overflow})
Creates a button text with the button role.
const
FitText.headline(String text, {Key? key, TextStyle? style, EdgeInsets? margin, EdgeInsets? padding, TextAlign? textAlign, double? width, double? height, Alignment? alignment, int? maxLines = 5, TextOverflow? overflow})
Creates a headline text with the headline role.
const
FitText.hint(String text, {Key? key, TextStyle? style, EdgeInsets? margin, EdgeInsets? padding, TextAlign? textAlign, double? width, double? height, Alignment? alignment, int? maxLines = 5, TextOverflow? overflow})
Creates a hint text with the hint role.
const
FitText.title(String text, {Key? key, TextStyle? style, EdgeInsets? margin, EdgeInsets? padding, TextAlign? textAlign, double? width, double? height, Alignment? alignment, int? maxLines = 5, TextOverflow? overflow})
Creates a title text with the title role.
const

Properties

alignment Alignment?
Alignment of the container wrapping the text.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Height of the text.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsets?
Margin for the text.
final
maxLines int?
Text.maxLines.
final
overflow TextOverflow?
Text.overflow
final
padding EdgeInsets?
Padding for the text.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style TextStyle?
Custom styling to apply. This style will override the role style (Headline, Title, Body, Button, hint) and FitTheme.baseTextStyle.
final
text String
Text to display.
final
textAlign TextAlign?
Text.textAlign.
final
width double?
Width of the text.
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