MongolRichText class
A string of rich text in vertical Mongolian layout.
Based on RichText of Flutter version 1.5. After that RichText became a MultiChildRenderObjectWidget in order to support InlineSpans.
The MongolRichText widget displays text that uses multiple different styles. The text to display is described using a tree of TextSpan objects, each of which has an associated style that is used for that subtree. The text might break across multiple lines or might all be displayed on the same line depending on the layout constraints.
Text displayed in a MongolRichText widget must be explicitly styled. When picking which style to use, consider using DefaultTextStyle.of the current BuildContext to provide defaults. For more details on how to style text in a MongolRichText widget, see the documentation for TextStyle.
Consider using the MongolText widget to integrate with the DefaultTextStyle automatically. When all the text uses the same style, the default constructor is less verbose. The MongolText.rich constructor allows you to style multiple spans with the default text style while still allowing specified styles per span.
{@tool snippet}
This sample demonstrates how to mix and match text with different text styles using the MongolRichText Widget. It displays the text "Hello bold world," emphasizing the word "bold" using a bold font weight.
MongolRichText(
text: TextSpan(
text: 'Hello ',
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: ' world!'),
],
),
)
{@end-tool}
See also:
- TextStyle, which discusses how to style text.
- TextSpan, which is used to describe the text in a paragraph.
- MongolText, which automatically applies the ambient styles described by a DefaultTextStyle to a single string.
- MongolText.rich, a const text widget that provides similar functionality
as MongolRichText.
MongokText.rich
will inherit TextStyle from DefaultTextStyle.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- RenderObjectWidget
- LeafRenderObjectWidget
- MongolRichText
Constructors
- MongolRichText({Key? key, required TextSpan text, MongolTextAlign textAlign = MongolTextAlign.top, bool softWrap = true, TextOverflow overflow = TextOverflow.clip, double textScaleFactor = 1.0, int? maxLines})
-
Creates a paragraph of rich text in vertical orientation for traditional
Mongolian.
const
Properties
- 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?
-
An optional maximum number of lines for the text to span, wrapping if
necessary. If the text exceeds the given number of lines, it will be
truncated according to overflow.
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
- text → TextSpan
-
The text to display in this widget.
final
- textAlign → MongolTextAlign
-
How the text should be aligned vertically.
final
- textScaleFactor → double
-
The number of font pixels for each logical pixel.
final
Methods
-
createElement(
) → LeafRenderObjectElement -
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
-
createRenderObject(
BuildContext context) → MongolRenderParagraph -
Creates an instance of the RenderObject class that this
RenderObjectWidget represents, using the configuration described by this
RenderObjectWidget.
override
-
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.
override
-
didUnmountRenderObject(
covariant RenderObject renderObject) → void -
A render object previously associated with this widget has been removed
from the tree. The given RenderObject will be of the same type as
returned by this object's createRenderObject.
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}) → 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
-
updateRenderObject(
BuildContext context, covariant MongolRenderParagraph renderObject) → void -
Copies the configuration described by this RenderObjectWidget to the
given RenderObject, which will be of the same type as returned by this
object's createRenderObject.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited