fixed ui clipping

made the radius concentric and the padding perfect
This commit is contained in:
neon443
2025-06-27 21:20:27 +01:00
parent 3698232a51
commit a607996ca5
2 changed files with 15 additions and 15 deletions

View File

@@ -14,23 +14,23 @@ struct ThemeManagerView: View {
@State var importURL: String = ""
@State var toImportName: String = ""
let grid = GridItem(
.adaptive(minimum: 80, maximum: 150),
spacing: 0,
let grid: GridItem = GridItem(
.fixed(90),
spacing: 8,
alignment: .center
)
var body: some View {
GeometryReader { geo in
NavigationStack {
let columns = Int(geo.size.width/150)
ScrollView(.horizontal) {
LazyHGrid(rows: Array(repeating: grid, count: columns), alignment: .center, spacing: 0) {
LazyHGrid(rows: [grid, grid], alignment: .center, spacing: 8) {
ForEach(hostsManager.themes) { theme in
ThemePreview(theme: theme)
}
}
}
.frame(height: 160)
.scrollIndicators(.hidden)
.alert("Enter URL", isPresented: $showAlert) {
TextField("", text: $importURL, prompt: Text("URL"))

View File

@@ -12,31 +12,31 @@ struct ThemePreview: View {
var body: some View {
ZStack(alignment: .center) {
RoundedRectangle(cornerRadius: 5)
RoundedRectangle(cornerRadius: 10)
.fill(theme.background.suiColor)
VStack(alignment: .leading) {
Text(theme.name)
.foregroundStyle(theme.foreground.suiColor)
.font(.headline)
HStack {
Spacer()
HStack(spacing: 8) {
ForEach(0..<8, id: \.self) { index in
Rectangle()
.frame(width: 15, height: 15)
RoundedRectangle(cornerRadius: 2)
.frame(width: 16, height: 16)
.foregroundStyle(theme.ansi[index].suiColor)
}
}
HStack {
HStack(spacing: 8) {
ForEach(8..<16, id: \.self) { index in
Rectangle()
.frame(width: 15, height: 15)
RoundedRectangle(cornerRadius: 2)
.frame(width: 16, height: 16)
.foregroundStyle(theme.ansi[index].suiColor)
}
}
}
.padding(5)
.padding(8)
}
.fixedSize()
.frame(maxWidth: 150, maxHeight: 80)
.frame(maxWidth: 200, maxHeight: 90)
}
}