// Overlays over any page: a picker (Select) and a toast. The page under them // fades out first (Nothing-under-glass): app.slint dims it while one is open. import { Tv, GlassRect, GlassPane, GlassMenu, MenuItem, Icon } from "@sf-ui/sf-ui.slint"; // A list to choose from, centred. export component SelectOverlay inherits Rectangle { in property alpha; in property title; in property <[MenuItem]> items; in property focus-index; menu := GlassMenu { x: (root.width - self.width) / 2; y: (root.height - self.height) / 2; width: 640 * Tv.u; title: root.title; items: root.items; focused-index: root.focus-index; alpha: root.alpha; accent: #e50914; visible-rows: 9; } out property <[GlassRect]> glass: menu.glass; } // A short message at the bottom ("Elmentve", errors). export component Toast inherits Rectangle { in property text; in property bad; out property t: self.text != "" ? 1 : 0; animate t { duration: 300ms; easing: cubic-bezier(0.3, 1.18, 0.4, 1); } pane := GlassPane { x: (root.width - self.width) / 2; y: root.height - (64 + 96 * root.t) * Tv.u; width: min(1400 * Tv.u, label.preferred-width + 140 * Tv.u); height: 80 * Tv.u; radius: self.height / 2; frost: 2.4; tint: Tv.smoke.with-alpha(0.5); glow: root.bad ? Tv.danger : #ffffff; lit: 0.3; alpha: root.t; HorizontalLayout { padding-left: 36 * Tv.u; padding-right: 36 * Tv.u; spacing: 14 * Tv.u; alignment: center; opacity: root.t; Icon { y: (parent.height - self.height) / 2; name: root.bad ? "warning" : "check"; size: 30 * Tv.u; ink: root.bad ? Tv.danger-ink : Tv.ok-ink; } label := Text { vertical-alignment: center; text: root.text; font-size: 25 * Tv.u; font-weight: 600; color: Tv.text; overflow: elide; } } } out property <[GlassRect]> glass: [pane.glass]; }