slint/internal/compiler/widgets/material-base/progressindicator.slint
2023-06-20 14:54:10 +02:00

28 lines
No EOL
950 B
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.0 OR LicenseRef-Slint-commercial
import { Palette } from "styling.slint";
export component ProgressIndicator {
in property <float> progress;
in property <bool> indeterminate;
min-height: 4px;
horizontal-stretch: 1;
vertical-stretch: 0;
accessible-role: none;
accessible-value: root.progress;
i-background := Rectangle {
background: Palette.surface-variant;
clip: true;
i-track := Rectangle {
background: Palette.primary;
x: !root.indeterminate ? 0px : -parent.width + (parent.width * mod(animation-tick(), 2s) / 1s);
y: (parent.height - self.height) / 2;
width: !root.indeterminate ? parent.width * min(1, max(0, root.progress)) : parent.width;
border-radius: i-background.border-radius;
}
}
}