RichText Widget

Flutter – RichText Widget

With the RichText widget, you can show text in some different ways. A tree of TextSpan objects describes the text that is shown. Each object in the tree has its own style used for that subtree. The text may be split across several lines or shown on one line, depending on how the style is set up.

Properties of RichText Widget

RichText Widget

children: The widgets in the tree are located underneath this widget.

hashCode: The code that is used to hash this object.

key: Specifies how one widget can replace another widget in the tree.

Runtime Type: The runtime type of the object is represented by this representation.

Text: This widget’s text will be displayed in it.

TextAlign: How the text ought to be oriented over the horizontal plane RichText Widget.

Local: This attribute uses the Locale class as its object. The font used for the text depends on the language being used.

MaxLines: An int value must be passed in as the object for the maxLines attribute. It regulates the maximum number of lines present so that the text can expand or wrap around itself.

Overflow: Text Overflow enum is the object that a class receives, and it is responsible for controlling the text if it overflows flutter forum.

SoftWrap: An object that is a boolean value is what this property accepts as input. If it is set to false, the gulphs in the text will expand in size.

TextDirection: The TextDirection class is the object used by this property to determine the direction in which the text is displayed. Either from left to right or right to left is a valid direction.

TextHightBehavior: This property is assigned to the TextHeightBehavior class as the object to be executed. This determines how the text will be highlighted.

TextScale-factor: This attribute is used as the object to determine the relative size of the font, and it is taken in a double-value representation.

TextWidthBasis: This property’s object is the TextWidthBasis enum it is associated with. It controls the width of a single line of text being measured RichText Widget. 

Conclusion

The rich text incorporates numerous styles into a single block. The Rich Text widget makes creating rich text in Flutter easy by merging multiple text spans with different styles into one paragraph. Displaying text with several styles within your app is especially helpful for keeping everything organized and on one line.

Similar Posts