mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-13 16:15:18 +00:00

Instead of having all style duplicated and re-using a base, we just hack into the funciton that queries the dark/light theme based on the style suffix known at compile time. This removes one of the problem that happens when trying to work on the widget style with the extension, as it relies on include path hacks
35 lines
1.1 KiB
Text
35 lines
1.1 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
import { FluentPalette } from "styling.slint";
|
|
|
|
export component ProgressIndicator {
|
|
in property <float> progress;
|
|
in property <bool> indeterminate;
|
|
|
|
min-height: 3px;
|
|
horizontal-stretch: 1;
|
|
vertical-stretch: 0;
|
|
accessible-role: progress-indicator;
|
|
accessible-value: !root.indeterminate ? root.progress : "";
|
|
accessible-value-minimum: 0.0;
|
|
accessible-value-maximum: 1.0;
|
|
|
|
Rectangle {
|
|
clip: true;
|
|
|
|
i-rail := Rectangle {
|
|
height: 1px;
|
|
background: FluentPalette.border;
|
|
border-radius: 1px;
|
|
}
|
|
|
|
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: 3px;
|
|
background: FluentPalette.accent-background;
|
|
}
|
|
}
|
|
}
|