Panel class

A fluent builder for creating styled panels.

Provides a chainable API for panel configuration with support for the new Style system, custom borders, and per-line content styling.

final panel = Panel()
    .title('Welcome')
    .content('Hello, World!\nThis is a styled panel.')
    .border(Border.rounded)
    .titleStyle(Style().bold().foreground(Colors.cyan))
    .borderStyle(Style().foreground(Colors.gray))
    .padding(1, 2)
    .width(50)
    .render();

print(panel);
Inheritance
Available extensions

Constructors

Panel({RenderConfig renderConfig = const RenderConfig()})
Creates a new empty panel builder.

Properties

hashCode → int
The hash code for this object.
no setterinherited
lineCount → int
Number of lines in the rendered output.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

border(Border border) → Panel
Sets the border style (characters).
borderStyle(Style style) → Panel
Sets the border text style.
content(String text) → Panel
Sets the panel content from a string.
contentAlign(PanelAlignment align) → Panel
Sets the content alignment.
contentStyle(Style style) → Panel
Sets the content text style (applied to all content).
contentStyleFunc(PanelContentStyleFunc func) → Panel
Sets the content style function for per-line styling.
init() → Cmd?
Returns an optional command to execute on program startup.
inherited
line(String text) → Panel
Adds a line to the panel content.
lines(List<String> lines) → Panel
Sets the panel content from a list of lines.
maxWidth(int value) → Panel
Sets the maximum width of the panel.
minWidth(int value) → Panel
Sets the minimum width of the panel.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
padding(int vertical, [int? horizontal]) → Panel
Sets uniform padding (all sides).
paddingAll({int? top, int? right, int? bottom, int? left}) → Panel
Sets individual padding values.
render() → String
Renders the component as a styled string.
override
title(String title) → Panel
Sets the panel title.
titleAlign(PanelAlignment align) → Panel
Sets the title alignment.
titleStyle(Style style) → Panel
Sets the title text style.
toString() → String
A string representation of this object.
inherited
update(Msg msg) → (ViewComponent, Cmd?)
Updates the component state in response to a message.
inherited
view() → String
Renders the current model state for display.
inherited
width(int value) → Panel
Sets the fixed width of the panel.
writelnTo(Console io) → void

Available on DisplayComponent, provided by the DisplayComponentExtension extension

Renders the component and writes it to the console.

Operators

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