Layout class

Layout utilities for composing rendered blocks.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

alignLines(List<String> lines, int width, HorizontalAlign align) List<String>
Aligns a list of lines within a given width.
alignText(String text, int width, HorizontalAlign align) String
Aligns text within a given width.
center(String text, int width, [String char = ' ']) String
Centers a string within a given width.
emitFrameCounters() → void
Emits per-frame counter summary to TuiTrace and resets all counters.
getHeight(String content) int
Gets the height of a block of text (number of lines).
getSize(String content) → ({int height, int width})
Gets the dimensions of a block of text.
getWidth(String content) int
Gets the width of a block of text (maximum line width).
height(String text) int
Returns the height of a string in cells.
joinHorizontal(VerticalAlign align, List<String> blocks, {int gap = 0, String gapChar = ' '}) String
Joins multiple blocks horizontally with vertical alignment.
joinVertical(HorizontalAlign align, List<String> blocks, {int gap = 0}) String
Joins multiple blocks vertically with horizontal alignment.
pad(String text, int width, [String char = ' ']) String
Pads a string to a given width, respecting ANSI codes.
padLeft(String text, int width, [String char = ' ']) String
Pads a string to a given width on the left.
place({required int width, required int height, required HorizontalAlign horizontal, required VerticalAlign vertical, required String content, WhitespaceOptions? whitespace}) String
Places content at a position within a container.
placeHeight({required int height, required VerticalAlign align, required String content, String fillChar = ' '}) String
Places content within a height, respecting the given alignment.
placeHorizontal(int width, HorizontalAlign pos, String str, {WhitespaceOptions? whitespace}) String
Places a string or text block horizontally in an unstyled block of a given width.
placeVertical(int height, VerticalAlign pos, String str, {WhitespaceOptions? whitespace}) String
Places a string or text block vertically in an unstyled block of a given height.
placeWidth({required int width, required HorizontalAlign align, required String content}) String
Places content within a width, respecting the given alignment.
size(String text) → (int, int)
Returns the width and height of a string in cells.
stack(List<String> blocks) String
Stacks multiple blocks of text on top of each other.
stripAnsi(String text) String
Strips all ANSI escape codes from a string.
truncate(String text, int maxWidth, {String ellipsis = EllipsisChars.horizontal}) String
Truncates text to a maximum width, adding an ellipsis if needed.
truncateHeight(String content, int maxHeight, {String? lastLineIndicator}) String
Truncates text to a maximum height (number of lines).
truncateLines(String content, int maxWidth, {String ellipsis = '…'}) String
Truncates each line of text to a maximum width.
visibleLength(String text) int
Returns the visible length of a string, ignoring ANSI escape codes.
width(String text) int
Returns the cell width of characters in the string.
wrap(String text, int maxWidth) String
Wraps text to a maximum width.
wrapLines(String content, int maxWidth) String
Wraps each line of text to a maximum width.