mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-04-25 01:58:52 +02:00
feat: add onsubmit for textfield
This commit is contained in:
@@ -71,12 +71,12 @@ struct Toolbar: View {
|
|||||||
.clipShape(.rect(cornerRadius: 8))
|
.clipShape(.rect(cornerRadius: 8))
|
||||||
.contentShape(.rect(cornerRadius: 8))
|
.contentShape(.rect(cornerRadius: 8))
|
||||||
}
|
}
|
||||||
|
.disabled(title.isEmpty)
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.hoverEffect(.lift)
|
.hoverEffect(.lift)
|
||||||
#else
|
#else
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
#endif
|
#endif
|
||||||
.disabled(textFieldState)
|
|
||||||
.transition(.move(edge: .top).combined(with: .blurReplace))
|
.transition(.move(edge: .top).combined(with: .blurReplace))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +102,9 @@ struct Toolbar: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.transition(.move(edge: .top).combined(with: .blurReplace))
|
.transition(.move(edge: .top).combined(with: .blurReplace))
|
||||||
|
.onSubmit(of: .text) {
|
||||||
|
textFieldState = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var historyControl: some View {
|
private var historyControl: some View {
|
||||||
@@ -135,7 +138,6 @@ struct Toolbar: View {
|
|||||||
}
|
}
|
||||||
.background(.regularMaterial)
|
.background(.regularMaterial)
|
||||||
.clipShape(.rect(cornerRadius: 8))
|
.clipShape(.rect(cornerRadius: 8))
|
||||||
.disabled(textFieldState)
|
|
||||||
.transition(.move(edge: .top).combined(with: .blurReplace))
|
.transition(.move(edge: .top).combined(with: .blurReplace))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user