Skip to content

Commit

Permalink
fix: search input border style
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Aug 24, 2023
1 parent 55416c8 commit d35dfad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions examples/cosmic/src/window/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
21 changes: 16 additions & 5 deletions src/widget/text_input/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit d35dfad

Please sign in to comment.