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 importURL: String = ""
@State var toImportName: String = "" @State var toImportName: String = ""
let grid = GridItem( let grid: GridItem = GridItem(
.adaptive(minimum: 80, maximum: 150), .fixed(90),
spacing: 0, spacing: 8,
alignment: .center alignment: .center
) )
var body: some View { var body: some View {
GeometryReader { geo in GeometryReader { geo in
NavigationStack { NavigationStack {
let columns = Int(geo.size.width/150)
ScrollView(.horizontal) { 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 ForEach(hostsManager.themes) { theme in
ThemePreview(theme: theme) ThemePreview(theme: theme)
} }
} }
} }
.frame(height: 160)
.scrollIndicators(.hidden) .scrollIndicators(.hidden)
.alert("Enter URL", isPresented: $showAlert) { .alert("Enter URL", isPresented: $showAlert) {
TextField("", text: $importURL, prompt: Text("URL")) TextField("", text: $importURL, prompt: Text("URL"))

View File

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