StyledBlock class
A fluent builder for creating styled blocks (Symfony-style).
Provides a chainable API for styled block configuration with support for the new Style system and multiple display styles.
final block = StyledBlock()
.info()
.message('Operation completed successfully!')
.displayStyle(StyledBlockDisplayStyle.fullWidth)
.render();
print(block);
// Or with custom styling
final customBlock = StyledBlock()
.message('Custom block')
.prefix('[CUSTOM]')
.backgroundColor(Colors.magenta)
.foregroundColor(Colors.white)
.render();
- Inheritance
-
- Object
- Model
- ViewComponent
- StaticComponent
- DisplayComponent
- StyledBlock
- Available extensions
Constructors
- StyledBlock({RenderConfig renderConfig = const RenderConfig()})
- Creates a new empty styled block builder.
Properties
Methods
-
backgroundColor(
Color color) → StyledBlock - Sets the background color (for fullWidth display).
-
border(
Border border) → StyledBlock - Sets the border style (for bordered display).
-
bordered(
) → StyledBlock - Sets the block to bordered display.
-
borderStyle(
Style style) → StyledBlock - Sets the border text style.
-
contentStyle(
Style style) → StyledBlock - Sets the content style.
-
contentStyleFunc(
StyledBlockStyleFunc func) → StyledBlock - Sets the content style function for per-line styling.
-
displayStyle(
StyledBlockDisplayStyle style) → StyledBlock - Sets the display style.
-
error(
) → StyledBlock - Sets the block to error type.
-
foregroundColor(
Color color) → StyledBlock - Sets the foreground (text) color.
-
fullWidth(
) → StyledBlock - Sets the block to full-width background display.
-
info(
) → StyledBlock - Sets the block to info type.
-
init(
) → Cmd? -
Returns an optional command to execute on program startup.
inherited
-
inline(
) → StyledBlock - Sets the block to inline display.
-
maxWidth(
int value) → StyledBlock - Sets the maximum width.
-
message(
String text) → StyledBlock - Sets the block message.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
note(
) → StyledBlock - Sets the block to note type.
-
padding(
int value) → StyledBlock - Sets the padding.
-
prefix(
String prefix) → StyledBlock - Sets a custom prefix (overrides type prefix).
-
prefixStyle(
Style style) → StyledBlock - Sets the prefix style.
-
render(
) → String -
Renders the component as a string.
override
-
success(
) → StyledBlock - Sets the block to success type.
-
toString(
) → String -
A string representation of this object.
inherited
-
type(
BlockStyleType type) → StyledBlock - Sets the block type.
-
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
-
warning(
) → StyledBlock - Sets the block to warning type.
-
width(
int value) → StyledBlock - Sets the width.
-
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