Fix the issue of repeatedly setting the input background color (#129)

This commit is contained in:
Floyd Wang 2024-08-09 16:09:22 +08:00
parent ebf8a7f6f3
commit e073b60bc1

View file

@ -1036,19 +1036,18 @@ impl Render for TextInput {
.input_py(self.size) .input_py(self.size)
.input_h(self.size) .input_h(self.size)
.when(self.appearance, |this| { .when(self.appearance, |this| {
this.bg(cx.theme().input) this.bg(if self.disabled {
.border_color(cx.theme().input) cx.theme().muted
.border_1() } else {
.rounded(px(cx.theme().radius)) cx.theme().background
.shadow_sm() })
.when(focused, |this| this.outline(cx)) .border_color(cx.theme().input)
.when(prefix.is_none(), |this| this.input_pl(self.size)) .border_1()
.when(suffix.is_none(), |this| this.input_pr(self.size)) .rounded(px(cx.theme().radius))
.bg(if self.disabled { .shadow_sm()
cx.theme().muted .when(focused, |this| this.outline(cx))
} else { .when(prefix.is_none(), |this| this.input_pl(self.size))
cx.theme().background .when(suffix.is_none(), |this| this.input_pr(self.size))
})
}) })
.children(prefix) .children(prefix)
.gap_1() .gap_1()