Sideband/sbapp/kivymd/uix/chip/chip.kv
2022-07-07 22:16:10 +02:00

111 lines
3.2 KiB
Plaintext

<MDScalableCheckIcon>
scale_value_x: 0
scale_value_y: 0
scale_value_z: 0
<MDChip>
size_hint_y: None
height: "32dp"
spacing: "8dp"
adaptive_width: True
radius: 16 if self.radius == [0, 0, 0, 0] else self.radius
padding:
"12dp" if not self.icon_left else "4dp", \
0, \
"12dp" if not self.icon_right else "8dp", \
0
md_bg_color:
( \
app.theme_cls.bg_darkest \
if app.theme_cls.theme_style == "Light" else \
app.theme_cls.bg_light \
) \
if not self.disabled else app.theme_cls.disabled_hint_text_color
canvas.before:
Color:
rgba:
self.line_color \
if not self.disabled else \
app.theme_cls.disabled_hint_text_color
Line:
width: 1
rounded_rectangle:
( \
self.x, \
self.y, \
self.width, \
self.height, \
*self.radius, \
self.height \
)
MDRelativeLayout:
id: relative_box
size_hint: None, None
size: ("24dp", "24dp") if root.icon_left else (0, 0)
pos_hint: {"center_y": .5}
radius: [int(self.height / 2),]
MDIcon:
id: icon_left
icon: root.icon_left
size_hint: None, None
size: ("28dp", "28dp") if root.icon_left else (0, 0)
theme_text_color: "Custom"
pos_hint: {"center_y": .5}
pos: 0, -2
text_color:
( \
root.icon_left_color \
if root.icon_left_color else \
root.theme_cls.disabled_hint_text_color \
) \
if not self.disabled else app.theme_cls.disabled_hint_text_color
MDBoxLayout:
id: icon_left_box
size_hint: None, None
radius: [int(self.height / 2),]
size: ("28dp", "28dp") if root.icon_left else (0, 0)
pos: 0, -2
MDScalableCheckIcon:
id: check_icon
icon: "check"
size_hint: None, None
size: "28dp", "28dp"
color: (1, 1, 1, 1) if not root.icon_check_color else root.icon_check_color
pos: 2, -2
MDLabel:
id: label
text: root.text
adaptive_size: True
markup: True
pos_hint: {"center_y": .5}
color:
( \
root.text_color \
if root.text_color else \
root.theme_cls.disabled_hint_text_color \
) \
if not self.disabled else app.theme_cls.disabled_hint_text_color
MDIcon:
id: icon_right
icon: root.icon_right
size_hint: None, None
size: ("18dp", "18dp") if root.icon_right else (0, 0)
font_size: "18sp" if root.icon_right else 0
theme_text_color: "Custom"
pos_hint: {"center_y": .5}
text_color:
( \
root.icon_right_color \
if root.icon_right_color else \
root.theme_cls.disabled_hint_text_color \
) \
if not self.disabled else app.theme_cls.disabled_hint_text_color