From d35dfad48609c63ddccf46a7299b1be6dd34615a Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 23 Aug 2023 17:42:21 -0400 Subject: [PATCH] fix: search input border style --- examples/cosmic/src/window/demo.rs | 8 ++++++++ src/widget/text_input/style.rs | 21 ++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/examples/cosmic/src/window/demo.rs b/examples/cosmic/src/window/demo.rs index 375b704..0609ea9 100644 --- a/examples/cosmic/src/window/demo.rs +++ b/examples/cosmic/src/window/demo.rs @@ -508,6 +508,14 @@ impl State { .width(Length::Fill) .on_input(Message::InputChanged) .into(), + cosmic::widget::search_input( + "test", + &self.entry_value, + Some(Message::InputChanged("".to_string())), + ) + .width(Length::Fill) + .on_input(Message::InputChanged) + .into(), ]) .into() } diff --git a/src/widget/text_input/style.rs b/src/widget/text_input/style.rs index fe383cd..1a3f3b8 100644 --- a/src/widget/text_input/style.rs +++ b/src/widget/text_input/style.rs @@ -94,9 +94,9 @@ impl StyleSheet for crate::Theme { TextInput::Search => Appearance { background: Color::from(bg).into(), border_radius: corner.radius_xl.into(), - border_width: 0.0, + border_width: 1.0, border_offset: None, - border_color: Color::TRANSPARENT, + border_color: self.current_container().component.divider.into(), text_color: self.current_container().on.into(), selected_text_color: palette.on_accent_color().into(), selected_fill: palette.accent_color().into(), @@ -179,7 +179,18 @@ impl StyleSheet for crate::Theme { selected_fill: palette.accent_color().into(), label_color: label_color.into(), }, - TextInput::Search | TextInput::ExpandableSearch => Appearance { + TextInput::Search => Appearance { + background: Color::from(bg).into(), + border_radius: corner.radius_xl.into(), + border_offset: None, + border_width: 1.0, + border_color: palette.accent.base.into(), + text_color: self.current_container().on.into(), + selected_text_color: palette.on_accent_color().into(), + selected_fill: palette.accent_color().into(), + label_color: label_color.into(), + }, + TextInput::ExpandableSearch => Appearance { background: Color::from(bg).into(), border_radius: corner.radius_xl.into(), border_offset: None, @@ -226,9 +237,9 @@ impl StyleSheet for crate::Theme { TextInput::Search | TextInput::ExpandableSearch => Appearance { background: Color::from(bg).into(), border_radius: corner.radius_xl.into(), - border_width: 0.0, + border_width: 1.0, border_offset: Some(2.0), - border_color: Color::TRANSPARENT, + border_color: palette.accent.base.into(), text_color: self.current_container().on.into(), selected_text_color: palette.on_accent_color().into(), selected_fill: palette.accent_color().into(),