Make buttons scale with window

This commit is contained in:
TheAlgorithm476 2025-04-16 11:11:58 +02:00
parent 46232968f6
commit 5e6a56b594
1 changed files with 25 additions and 1 deletions

View File

@ -16,53 +16,77 @@ struct AdwaitaTemplate: App {
HStack(spacing: 8) { HStack(spacing: 8) {
Button("AC") {} Button("AC") {}
.keyboardShortcut("c", app: app) .keyboardShortcut("c", app: app)
.hexpand()
Button("") {} Button("") {}
.hexpand()
Button("%") {} Button("%") {}
.keyboardShortcut("percent", app: app) .keyboardShortcut("percent", app: app)
.hexpand()
Button("/") {} Button("/") {}
.keyboardShortcut("slash", app: app) .keyboardShortcut("slash", app: app)
.hexpand()
} }
.vexpand()
HStack(spacing: 8) { HStack(spacing: 8) {
Button("7") {} Button("7") {}
.keyboardShortcut("7", app: app) .keyboardShortcut("7", app: app)
.hexpand()
Button("8") {} Button("8") {}
.keyboardShortcut("8", app: app) .keyboardShortcut("8", app: app)
.hexpand()
Button("9") {} Button("9") {}
.keyboardShortcut("9", app: app) .keyboardShortcut("9", app: app)
.hexpand()
Button("*") {} Button("*") {}
.keyboardShortcut("asterisk", app: app) .keyboardShortcut("asterisk", app: app)
.hexpand()
} }
.vexpand()
HStack(spacing: 8) { HStack(spacing: 8) {
Button("4") {} Button("4") {}
.keyboardShortcut("4", app: app) .keyboardShortcut("4", app: app)
.hexpand()
Button("5") {} Button("5") {}
.keyboardShortcut("5", app: app) .keyboardShortcut("5", app: app)
.hexpand()
Button("6") {} Button("6") {}
.keyboardShortcut("6", app: app) .keyboardShortcut("6", app: app)
.hexpand()
Button("-") {} Button("-") {}
.keyboardShortcut("minus", app: app) .keyboardShortcut("minus", app: app)
.hexpand()
} }
.vexpand()
HStack(spacing: 8) { HStack(spacing: 8) {
Button("1") {} Button("1") {}
.keyboardShortcut("1", app: app) .keyboardShortcut("1", app: app)
.hexpand()
Button("2") {} Button("2") {}
.keyboardShortcut("2", app: app) .keyboardShortcut("2", app: app)
.hexpand()
Button("3") {} Button("3") {}
.keyboardShortcut("3", app: app) .keyboardShortcut("3", app: app)
.hexpand()
Button("+") {} Button("+") {}
.keyboardShortcut("plus", app: app) .keyboardShortcut("plus", app: app)
.hexpand()
} }
.vexpand()
HStack(spacing: 8) { HStack(spacing: 8) {
Button("0") {} Button("0") {}
.keyboardShortcut("0", app: app) .keyboardShortcut("0", app: app)
.hexpand()
Button("") {} Button("") {}
.hexpand()
Button(",") {} Button(",") {}
.keyboardShortcut("comma", app: app) .keyboardShortcut("comma", app: app)
.hexpand()
Button("=") {} Button("=") {}
.keyboardShortcut("equal", app: app) .keyboardShortcut("equal", app: app)
.hexpand()
} }
.vexpand()
} }
.frame(maxHeight: .none)
} }
.padding() .padding()
.topToolbar { .topToolbar {