Polish demo app

This commit is contained in:
david-swift 2024-05-06 16:18:49 +02:00
parent 932e4aeb8c
commit 212af591f1
11 changed files with 38 additions and 31 deletions

View File

@ -20,6 +20,7 @@ struct AlertDialogDemo: View {
dialog = true dialog = true
} }
.style("pill") .style("pill")
.style("suggested-action")
.frame(maxWidth: 100) .frame(maxWidth: 100)
.padding() .padding()
} }

View File

@ -100,6 +100,7 @@ struct Demo: App {
} }
} }
} content: { } content: {
ViewStack(element: selection) { selection in
StatusPage( StatusPage(
selection.label, selection.label,
icon: selection.icon, icon: selection.icon,
@ -111,11 +112,9 @@ struct Demo: App {
.tooltip("Toggle Sidebar") .tooltip("Toggle Sidebar")
} end: { } end: {
if sidebarVisible { if sidebarVisible {
Text("") Text("").transition(.crossfade)
.transition(.crossfade)
} else { } else {
menu menu.transition(.crossfade)
.transition(.crossfade)
} }
} }
.headerBarTitle { .headerBarTitle {
@ -130,6 +129,7 @@ struct Demo: App {
} }
.toast("This is a toast!", signal: toast) .toast("This is a toast!", signal: toast)
} }
}
.aboutDialog( .aboutDialog(
visible: $about, visible: $about,
app: "Demo", app: "Demo",

View File

@ -22,6 +22,7 @@ struct DialogDemo: View {
dialog = true dialog = true
} }
.style("pill") .style("pill")
.style("suggested-action")
.frame(maxWidth: 100) .frame(maxWidth: 100)
.padding() .padding()
} }

View File

@ -19,6 +19,7 @@ struct FormDemo: View {
app.showWindow("form-demo") app.showWindow("form-demo")
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
} }
} }

View File

@ -23,11 +23,9 @@ struct IdleDemo: View {
.valign(.center) .valign(.center)
.frame(maxWidth: maxWidth) .frame(maxWidth: maxWidth)
Button("Play") { Button("Play") {
Task {
Idle {
activeProcess = true activeProcess = true
progress = 0 progress = 0
} Task {
Idle(delay: .seconds(delayFactor / max)) { Idle(delay: .seconds(delayFactor / max)) {
progress += 1 progress += 1
let done = progress == max let done = progress == max

View File

@ -19,6 +19,7 @@ struct NavigationViewDemo: View {
app.showWindow("navigation") app.showWindow("navigation")
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
.padding() .padding()
} }

View File

@ -10,7 +10,7 @@
import Adwaita import Adwaita
import Foundation import Foundation
enum Page: String, Identifiable, CaseIterable, Codable { enum Page: String, Identifiable, CaseIterable, Codable, CustomStringConvertible {
case welcome case welcome
case counter case counter

View File

@ -19,6 +19,7 @@ struct PopoverDemo: View {
visible = true visible = true
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
.popover(visible: $visible) { .popover(visible: $visible) {
CounterDemo() CounterDemo()

View File

@ -19,6 +19,7 @@ struct ToastDemo: View {
toast.signal() toast.signal()
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
} }
} }

View File

@ -19,6 +19,7 @@ struct ToolbarDemo: View {
app.showWindow("toolbar-demo") app.showWindow("toolbar-demo")
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
} }
} }
@ -34,6 +35,7 @@ struct ToolbarDemo: View {
visible.toggle() visible.toggle()
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
.padding(15) .padding(15)
} }

View File

@ -19,6 +19,7 @@ struct ViewSwitcherDemo: View {
app.showWindow("switcher-demo") app.showWindow("switcher-demo")
} }
.style("suggested-action") .style("suggested-action")
.style("pill")
.frame(maxWidth: 100) .frame(maxWidth: 100)
} }
} }