Files
Unlucky-Launcher/crates/app/ui/components/progress-bar.slint
T
AskaEth d517f28140
Release / 选槽位(默认两个 Windows) (push) Canceled after 0s
Release / build (${{ matrix.slot }}) (push) Canceled after 0s
Release / GitHub Release (push) Canceled after 0s
Unlucky Launcher v0.2.1
Single-commit source snapshot of the v0.2.1 release.
2026-11-06 12:35:56 +08:00

35 lines
1.1 KiB
Plaintext

// 细进度条(0.0~1.0):安装进度 / 下载页顶部 / 向导进度共用。
// 未知总量(known = false)时画一条不确定态的弱色轨道,而不是假装 0%。
import { Theme } from "../theme/tokens.slint";
import { Metrics } from "../theme/metrics.slint";
export component ProgressBar inherits Rectangle {
in property <float> ratio: 0.0;
in property <bool> known: true;
in property <length> bar-height: 6px;
height: root.bar-height;
border-radius: root.bar-height / 2;
background: Theme.bg-hover;
clip: true;
Rectangle {
x: 0;
y: 0;
width: root.known ? max(0px, root.width * clamp(root.ratio, 0.0, 1.0)) : 0px;
height: root.height;
border-radius: root.bar-height / 2;
background: Theme.accent;
animate width { duration: 180ms; easing: ease-out; }
}
if !root.known : Rectangle {
x: 0;
y: 0;
width: root.width / 3;
height: root.height;
border-radius: root.bar-height / 2;
background: Theme.accent-soft;
}
}