Skip to content

Commit 7aa50b2

Browse files
committed
Add frames playground
1 parent ff5e276 commit 7aa50b2

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#if canImport(AndroidSwiftUI)
2+
import AndroidSwiftUI
3+
#else
4+
import SwiftUI
5+
#endif
6+
7+
struct FramePlayground: View {
8+
var body: some View {
9+
ScrollView {
10+
VStack(alignment: .leading, spacing: 0) {
11+
Example("maxWidth: .infinity") {
12+
Text("Fills the width")
13+
.foregroundColor(.white)
14+
.padding()
15+
.frame(maxWidth: .infinity)
16+
.background(Color.blue)
17+
}
18+
Example("Fill, leading-aligned content") {
19+
Text("Left")
20+
.foregroundColor(.white)
21+
.frame(maxWidth: .infinity, alignment: .leading)
22+
.padding()
23+
.background(Color.green)
24+
}
25+
Example("Fill, trailing-aligned content") {
26+
Text("Right")
27+
.foregroundColor(.white)
28+
.frame(maxWidth: .infinity, alignment: .trailing)
29+
.padding()
30+
.background(Color.orange)
31+
}
32+
Example("Fixed 220x90, bottom-trailing content") {
33+
Text("corner")
34+
.foregroundColor(.white)
35+
.frame(width: 220, height: 90, alignment: .bottomTrailing)
36+
.background(Color.purple)
37+
}
38+
Example("Bounded width (min 120, max 200)") {
39+
Text("Bounded box grows to fit within limits")
40+
.padding()
41+
.frame(minWidth: 120, maxWidth: 200)
42+
.background(Color.pink)
43+
}
44+
}
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)