material: ActionChip SearchBar: avatar -> avatar-icon (https://github.com/slint-ui/material-components/issues/154)

Imported from 5de14badc5
This commit is contained in:
Nigel Breslaw 2025-09-05 11:30:54 +03:00 committed by Olivier Goffart
parent d43bc60b09
commit 2bc3328ab4
5 changed files with 11 additions and 11 deletions

View file

@ -28,7 +28,7 @@ A `SearchBar` is a text input field designed for search functionality, with opti
## Properties
### avatar
<SlintProperty propName="avatar" typeName="image">
<SlintProperty propName="avatar-icon" typeName="image">
An optional avatar image displayed in the search bar.
</SlintProperty>

View file

@ -28,8 +28,8 @@ An `ActionChip` is a compact element that represents an action or choice. It can
## Properties
### avatar
<SlintProperty propName="avatar" typeName="image">
### avatar-icon
<SlintProperty propName="avatar-icon" typeName="image">
An optional avatar image displayed on the chip.
</SlintProperty>

View file

@ -18,11 +18,11 @@ export component BaseButton inherits StateLayerArea {
in property <length> min_layout_width: MaterialStyleMetrics.size_40;
in property <length> min_layout_height: MaterialStyleMetrics.size_40;
in property <length> icon_size: MaterialStyleMetrics.icon_size_18;
in property <image> avatar;
in property <image> avatar_icon;
in property <length> avatar_size;
in property <color> avatar_background: #00000000;
out property <bool> has_icon: root.icon.width > 0 && root.icon.height > 0;
out property <bool> has_avatar: root.avatar.width > 0 && root.avatar.height > 0;
out property <bool> has_avatar: root.avatar_icon.width > 0 && root.avatar_icon.height > 0;
min_width: max(root.min_layout_width, layout.min_width);
min_height: max(root.min_layout_height, layout.min_height);
@ -46,7 +46,7 @@ export component BaseButton inherits StateLayerArea {
if root.has_avatar && root.avatar_size > 0 : Avatar {
width: root.avatar_size;
height: self.width;
image: root.avatar;
image: root.avatar_icon;
background: root.avatar_background;
}

View file

@ -14,7 +14,7 @@ export component ActionChip {
in property <string> text <=> base.text;
in property <bool> enabled <=> base.enabled;
in property <string> tooltip <=> base.tooltip;
in property <image> avatar <=> base.avatar;
in property <image> avatar_icon <=> base.avatar-icon;
in property <color> avatar_background <=> base.avatar_background;
callback clicked <=> base.clicked;
@ -117,7 +117,7 @@ export component FilterChip {
export component InputChip {
in property <image> leading_icon <=> base.icon;
in property <image> trailing_icon;
in property <image> avatar <=> base.avatar;
in property <image> avatar <=> base.avatar-icon;
in property <color> avatar_background <=> base.avatar_background;
in property <string> text <=> base.text;
in property <bool> enabled <=> base.enabled;

View file

@ -119,7 +119,7 @@ component SearchTextInput {
export component SearchBar {
in property <image> leading_icon: Icons.menu;
in property <image> trailing_icon;
in property <image> avatar;
in property <image> avatar_icon;
in property <color> avatar_background: #00000000;
in property <string> placeholder;
in property <string> empty_text;
@ -176,11 +176,11 @@ export component SearchBar {
color: root.color;
}
if (root.avatar.width > 0 && root.avatar.height > 0) || root.avatar_background != #00000000 : VerticalLayout {
if (root.avatar_icon.width > 0 && root.avatar_icon.height > 0) || root.avatar_background != #00000000 : VerticalLayout {
alignment: center;
Avatar {
image: root.avatar;
image: root.avatar_icon;
background: root.avatar_background;
}
}