fix(text_input): make icon padding fixed

This prevents the icons from becoming too large or too small relative to the input box, that leads to visual issues.
This commit is contained in:
Vukašin Vojinović 2024-09-21 18:44:44 +02:00 committed by Ashley Wulber
parent 0a34660a80
commit 9bfb159977

View file

@ -107,7 +107,7 @@ where
crate::widget::icon::from_name("system-search-symbolic") crate::widget::icon::from_name("system-search-symbolic")
.size(16) .size(16)
.apply(crate::widget::container) .apply(crate::widget::container)
.padding([spacing, spacing, spacing, spacing]) .padding(8)
.into(), .into(),
) )
} }
@ -131,7 +131,7 @@ where
crate::widget::icon::from_name("system-lock-screen-symbolic") crate::widget::icon::from_name("system-lock-screen-symbolic")
.size(16) .size(16)
.apply(crate::widget::container) .apply(crate::widget::container)
.padding([spacing, spacing, spacing, spacing]) .padding(8)
.into(), .into(),
); );
if hidden { if hidden {
@ -148,7 +148,7 @@ where
.apply(crate::widget::button::custom) .apply(crate::widget::button::custom)
.style(crate::theme::Button::Icon) .style(crate::theme::Button::Icon)
.on_press(msg) .on_press(msg)
.padding([spacing, spacing, spacing, spacing]) .padding(8)
.into(), .into(),
) )
} else { } else {
@ -496,17 +496,13 @@ where
} }
pub fn on_clear(self, on_clear: Message) -> Self { pub fn on_clear(self, on_clear: Message) -> Self {
let spacing = THEME.lock().unwrap().cosmic().space_xxs();
self.trailing_icon( self.trailing_icon(
crate::widget::icon::from_name("edit-clear-symbolic") crate::widget::icon::from_name("edit-clear-symbolic")
.size(16) .size(16)
.apply(crate::widget::button::custom) .apply(crate::widget::button::custom)
.style(crate::theme::Button::Icon) .style(crate::theme::Button::Icon)
.width(32)
.height(32)
.on_press(on_clear) .on_press(on_clear)
.padding([spacing, spacing, spacing, spacing]) .padding(8)
.into(), .into(),
) )
} }