Release Keyboard Release

Nucleic-Session: FD190A87-E8F7-4C72-A15E-E35B88EF5921
This commit is contained in:
Nucleic
2026-06-26 20:22:19 -07:00
parent 4b6e51ab03
commit 0f1c1e8ffd
@@ -103,6 +103,26 @@ extension Risk {
} }
} }
/// Adds a "Done" button to the keyboard's accessory toolbar so any focused composer can always
/// dismiss the keyboard. The multiline composers (`axis: .vertical`) turn Return into a newline,
/// so without this there's no way to release the keyboard once it opens. The modifier carries its
/// own `@FocusState` and binds it to the field, keeping callers to a single `.keyboardDismissable()`.
struct KeyboardDismissable: ViewModifier {
@FocusState private var focused: Bool
func body(content: Content) -> some View {
content
.focused($focused)
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button { focused = false } label: {
Label("Done", systemImage: "keyboard.chevron.compact.down")
}
}
}
}
}
/// A lifted card surface with a hairline border — the mobile echo of `AppTheme.surface`. /// A lifted card surface with a hairline border — the mobile echo of `AppTheme.surface`.
struct CardBackground: ViewModifier { struct CardBackground: ViewModifier {
var padding: CGFloat = 14 var padding: CGFloat = 14