mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-27 12:29:41 +00:00
42 lines
No EOL
1.3 KiB
Text
42 lines
No EOL
1.3 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
import { Palette } from "styling.slint";
|
|
|
|
export component ProgressIndicator {
|
|
in property<float> progress;
|
|
in property <bool> indeterminate;
|
|
|
|
min-height: 6px;
|
|
horizontal-stretch: 1;
|
|
vertical-stretch: 0;
|
|
accessible-role: none;
|
|
accessible-value: root.progress;
|
|
|
|
Rectangle {
|
|
clip: true;
|
|
border-radius: 3px;
|
|
|
|
i-rail := Rectangle {
|
|
border-radius: parent.border-radius;
|
|
background: Palette.surface-alt;
|
|
border-width: 0.5px;
|
|
border-color: Palette.border;
|
|
clip: true;
|
|
|
|
Rectangle {
|
|
border-width: 1px;
|
|
border-color: @radial-gradient(circle, #00000026, #00000000);
|
|
border-radius: parent.border-radius;
|
|
}
|
|
}
|
|
|
|
i-track := Rectangle {
|
|
width: !root.indeterminate ? parent.width * min(1, max(0, root.progress)) : parent.width;
|
|
height: 100%;
|
|
x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
|
|
border-radius: parent.border-radius;
|
|
background: Palette.accent;
|
|
}
|
|
}
|
|
} |