Paragraph class Null safety
A paragraph of text.
A paragraph retains the size and position of each glyph in the text and can be efficiently resized and painted.
To create a Paragraph object, use a ParagraphBuilder.
Paragraphs can be displayed on a Canvas using the Canvas.drawParagraph method.
Properties
- alphabeticBaseline → double
- The distance from the top of the paragraph to the alphabetic baseline of the first line, in logical pixels.
- didExceedMaxLines → bool
-
True if there is more vertical content, but the text was truncated, either
because we reached
maxLines
lines of text or because themaxLines
was null,ellipsis
was not null, and one of the lines exceeded the width constraint. - hashCode → int
-
The hash code for this object.
read-onlyinherited
- height → double
- The amount of vertical space this paragraph occupies.
- ideographicBaseline → double
- The distance from the top of the paragraph to the ideographic baseline of the first line, in logical pixels.
- longestLine → double
- The distance from the left edge of the leftmost glyph to the right edge of the rightmost glyph in the paragraph.
- maxIntrinsicWidth → double
- Returns the smallest width beyond which increasing the width never decreases the height.
- minIntrinsicWidth → double
- The minimum width that this paragraph could be without failing to paint its contents within itself.
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- width → double
- The amount of horizontal space this paragraph occupies.
Methods
-
computeLineMetrics(
) → List< LineMetrics> -
Returns the full list of
LineMetrics
that describe in detail the various metrics of each laid out line. -
getBoxesForPlaceholders(
) → List< TextBox> - Returns a list of text boxes that enclose all placeholders in the paragraph.
-
getBoxesForRange(
int start, int end, {BoxHeightStyle boxHeightStyle = BoxHeightStyle.tight, BoxWidthStyle boxWidthStyle = BoxWidthStyle.tight}) → List< TextBox> - Returns a list of text boxes that enclose the given text range.
-
getLineBoundary(
TextPosition position) → TextRange - Returns the TextRange of the line at the given TextPosition.
-
getPositionForOffset(
Offset offset) → TextPosition - Returns the text position closest to the given offset.
-
getWordBoundary(
TextPosition position) → TextRange - Returns the TextRange of the word at the given TextPosition.
-
layout(
ParagraphConstraints constraints) → void - Computes the size and position of each glyph in the paragraph.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited