Scaffold
Creates a top-level app layout with optional AppBar, Body, and Floating Action Button (FAB).
Basic Usage
Scaffold(
Body(Text("Hello, World!")),
)
Options
| Option | Type | Description | Example |
|---|---|---|---|
AppBar |
Widget |
Sets the app bar at the top | AppBar(TitleBar("My App")) |
Body |
Widget |
Sets the main content area | Body(Center(Text("Content"))) |
FAB |
Widget |
Sets the floating action button (bottom-right) | FAB(Button("+")) |
TitleBar Helper
TitleBar(title) creates a simple title bar widget:
TitleBar("My Application")
Examples
// Simple scaffold with body only
Scaffold(
Body(Center(Text("Hello!"))),
)
// Scaffold with app bar
Scaffold(
AppBar(TitleBar("My App")),
Body(Center(Text("Content"))),
)
// Scaffold with FAB
Scaffold(
Body(Center(Text("Main content"))),
FAB(Button("+")),
)
// Full scaffold with all options
Scaffold(
AppBar(TitleBar("My Application")),
Body(
Column([]any{
Text("Welcome"),
Button("Get Started"),
}),
),
FAB(Button("Add", Variant(Filled))),
)
// Custom app bar
Scaffold(
AppBar(
Container(
Padding(InsetsAll(16), Text("Custom Header", Style(H4))),
Background(Blue),
),
),
Body(content),
)