Implement changes on GNOME
This commit is contained in:
parent
7b38fd8381
commit
0c2ac1ca57
@ -93,6 +93,16 @@ public struct Alert: SimpleView {
|
||||
dialog = dialog.cancelButton(close.0, action: close.1)
|
||||
return dialog
|
||||
#else
|
||||
let extraChild: Body?
|
||||
if let textField {
|
||||
extraChild = [
|
||||
Form {
|
||||
EntryRow(textField.0, text: textField.1)
|
||||
}
|
||||
]
|
||||
} else {
|
||||
extraChild = nil
|
||||
}
|
||||
var dialog = AlertDialog(
|
||||
visible: $visible,
|
||||
child: child,
|
||||
|
||||
@ -264,12 +264,14 @@ public struct FlatNavigation<Item>: View where Item: FlatNavigationItem {
|
||||
return [flat]
|
||||
}
|
||||
#else
|
||||
HierarchicalNavigation(stack: stack, initialPageLabel: navigationTitle ?? "") { item in
|
||||
content(item)
|
||||
} initialView: {
|
||||
self
|
||||
}
|
||||
.hideDefaultToolbar()
|
||||
[
|
||||
HierarchicalNavigation(stack: stack, initialPageLabel: navigationTitle ?? "") { item in
|
||||
content(item)
|
||||
} initialView: {
|
||||
self
|
||||
}
|
||||
.hideDefaultToolbar()
|
||||
]
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,7 @@ struct ContentView: WindowView {
|
||||
@State private var forceSplitView = true
|
||||
@State private var stack: NavigationStack<GenericItem> = .init()
|
||||
@State private var showAlert = false
|
||||
@State private var text = ""
|
||||
|
||||
var view: Body {
|
||||
FlatNavigation(Item.allCases, selection: $selectedItem) {
|
||||
@ -128,9 +129,10 @@ struct ContentView: WindowView {
|
||||
.alert(visible: $showAlert, title: "Sample Alert", content: "This is the main content", closeLabel: "Close") {
|
||||
print("Close")
|
||||
}
|
||||
.primaryResponse("Primary", style: .suggested) {
|
||||
.primaryResponse(text, style: .suggested) {
|
||||
print("Primary")
|
||||
}
|
||||
.textField("Hello", text: $text)
|
||||
}
|
||||
|
||||
func window(_ window: Window) -> Window {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user