slint/internal/compiler/widgets/material-base/widget-item.slint
Florian Blasius f2aab576f4
Add StandardTableView widget (#2032)
* Text only StandardTableView with column and rows
* Text editing of cells
* Sort by column ascending and descending
* Variants of the TableView for native, fluent and material
2023-01-12 19:41:12 +01:00

45 lines
No EOL
1.3 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
import { StateLayer } from "comp-state-layer.slint";
import { md } from "md.slint";
// A selectable item that is used by `StandardListView` and `ComboBox`.
export component Item inherits Rectangle {
callback clicked <=> state-layer.clicked;
in property<bool> selected;
in property<string> text;
// background: md.sys.color.background;
height: 48px;
state-layer := StateLayer {
checked: root.selected;
background: md.sys.color.primary;
selection-background: md.sys.color.secondary-container;
ripple-color: md.sys.color.primary-ripple;
has-ripple: true;
}
HorizontalLayout {
padding-left: 12px;
padding-right: 12px;
label := Text {
text: root.text;
color: md.sys.color.on-surface;
vertical-alignment: center;
// FIXME after Roboto font can be loaded
//font-family: md.sys.typescale.label-large.font;
font-size: md.sys.typescale.label-large.size;
font-weight: md.sys.typescale.label-large.weight;
}
}
states [
selected when root.selected : {
state-layer.background: md.sys.color.secondary-container;
}
]
}