mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
45e73faafb
BREAKING CHANGE: Package name changed due to name collision with existing rensbreur/SwiftTUI package. Changes: - Rename package from SwiftTUI to TUIKit in Package.swift - Rename Sources/SwiftTUI to Sources/TUIKit - Rename Sources/SwiftTUIExample to Sources/TUIKitExample - Rename Tests/SwiftTUITests to Tests/TUIKitTests - Rename SwiftTUI.swift to TUIKit.swift - Update all imports: import SwiftTUI -> import TUIKit - Update all code references: SwiftTUI.renderToBuffer -> TUIKit.renderToBuffer - Update documentation comments - Rename swiftTUIVersion to tuiKitVersion All 181 tests passing.
73 lines
1.9 KiB
Swift
73 lines
1.9 KiB
Swift
//
|
|
// LayoutPage.swift
|
|
// TUIKitExample
|
|
//
|
|
// Demonstrates layout system capabilities.
|
|
//
|
|
|
|
import TUIKit
|
|
|
|
/// Layout system demo page.
|
|
///
|
|
/// Shows various layout options including:
|
|
/// - VStack (vertical stacking)
|
|
/// - HStack (horizontal stacking)
|
|
/// - Spacer (flexible space)
|
|
/// - Padding and frame modifiers
|
|
struct LayoutPage: View {
|
|
var body: some View {
|
|
VStack(spacing: 1) {
|
|
HeaderView(title: "Layout System Demo")
|
|
|
|
DemoSection("VStack (Vertical)") {
|
|
Box(.rounded, color: .brightBlack) {
|
|
VStack(spacing: 0) {
|
|
Text("Item 1")
|
|
Text("Item 2")
|
|
Text("Item 3")
|
|
}
|
|
}
|
|
}
|
|
|
|
DemoSection("HStack (Horizontal)") {
|
|
Box(.rounded, color: .brightBlack) {
|
|
HStack(spacing: 2) {
|
|
Text("Left")
|
|
Text("Center")
|
|
Text("Right")
|
|
}
|
|
}
|
|
}
|
|
|
|
DemoSection("Spacer") {
|
|
Box(.rounded, color: .brightBlack) {
|
|
HStack {
|
|
Text("Start")
|
|
Spacer()
|
|
Text("End")
|
|
}
|
|
}
|
|
}
|
|
|
|
DemoSection("Padding & Frame") {
|
|
HStack(spacing: 2) {
|
|
VStack {
|
|
Text(".padding()").dim()
|
|
Text("Padded")
|
|
.padding(EdgeInsets(all: 1))
|
|
.border(.line)
|
|
}
|
|
VStack {
|
|
Text(".frame()").dim()
|
|
Text("Framed")
|
|
.frame(width: 15, alignment: .center)
|
|
.border(.line)
|
|
}
|
|
}
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|