slint/internal/compiler/widgets/material-base/widget-groupbox.slint
Florian Blasius b4472b9118
Added switch widget (#2798)
* Add material Switch

* Add fluent switch

* Add native Switch and cleanup

* Rebase fix

* Update internal/compiler/widgets/fluent-base/std-widgets-impl.slint

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update examples/gallery/ui/pages/controls_page.slint

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review tweak on gallery layout

* Code review tweak on gallery layout

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-05-31 14:57:23 +02:00

48 lines
1.3 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
import { md } from "md.slint";
// A container widget with a title.
export component GroupBox {
in property <string> title <=> label.text;
in property<bool> enabled: true;
VerticalLayout {
spacing: 4px;
label := Text {
color: md.sys.color.on-surface;
// FIXME after Roboto font can be loaded
//font-family: md.sys.typescale.body-small.font;
font-size: md.sys.typescale.body-large.size;
font-weight: md.sys.typescale.body-small.weight;
overflow: elide;
horizontal-alignment: center;
}
container := Rectangle {
border-radius: 16px;
border-width: 1px;
border-color: md.sys.color.outline;
vertical-stretch: 1;
background: md.sys.color.surface;
HorizontalLayout {
padding: 16px;
GridLayout {
@children
}
}
}
}
states [
disabled when !root.enabled : {
container.border-color: md.sys.color.on-surface;
container.opacity: 0.38;
label.opacity: 0.38;
}
]
}