slint/demos/usecases/ui/widgets/container.slint
FloVanGH 0ce68f2922
usecases demo: adjust material style for android (#7766)
* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-04 09:05:35 +00:00

44 lines
1.1 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { Palette, VerticalBox } from "std-widgets.slint";
import { UsecasesPalette } from "styling.slint";
export component StateContainer inherits Rectangle {
callback clicked <=> touch-area.clicked;
in property <bool> checked;
background: Palette.alternate-background;
border-radius: 8px;
touch-area := TouchArea {}
state-layer := Rectangle {
border-radius: root.border-radius;
states [
pressed when touch-area.pressed : {
state-layer.background: UsecasesPalette.state-pressed;
}
hover when touch-area.has-hover : {
state-layer.background: UsecasesPalette.state-hover;
}
checked when root.checked : {
state-layer.background: UsecasesPalette.state-selected;
}
]
}
@children
}
export component Container inherits Rectangle {
background: Palette.alternate-background;
border-radius: 8px;
border-width: 1px;
VerticalBox {
@children
}
}