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.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::alphabeticBaseline', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::alphabeticBaseline', isLeaf: true)read-only
didExceedMaxLines bool
True if there is more vertical content, but the text was truncated, either because we reached maxLines lines of text or because the maxLines was null, ellipsis was not null, and one of the lines exceeded the width constraint.
FfiNative<Bool Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::didExceedMaxLines', isLeaf: true)">@FfiNative<Bool Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::didExceedMaxLines', isLeaf: true)read-only
hashCode int
The hash code for this object.
read-onlyinherited
height double
The amount of vertical space this paragraph occupies.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::height', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::height', isLeaf: true)read-only
ideographicBaseline double
The distance from the top of the paragraph to the ideographic baseline of the first line, in logical pixels.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::ideographicBaseline', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::ideographicBaseline', isLeaf: true)read-only
longestLine double
The distance from the left edge of the leftmost glyph to the right edge of the rightmost glyph in the paragraph.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::longestLine', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::longestLine', isLeaf: true)read-only
maxIntrinsicWidth double
Returns the smallest width beyond which increasing the width never decreases the height.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::maxIntrinsicWidth', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::maxIntrinsicWidth', isLeaf: true)read-only
minIntrinsicWidth double
The minimum width that this paragraph could be without failing to paint its contents within itself.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::minIntrinsicWidth', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::minIntrinsicWidth', isLeaf: true)read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
width double
The amount of horizontal space this paragraph occupies.
FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::width', isLeaf: true)">@FfiNative<Double Function(Pointer<Void>)>(Pointer<Void>)>('Paragraph::width', isLeaf: true)read-only

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