feat(widget): add editable_input widget
This commit is contained in:
parent
02acbd343c
commit
0ac4172b74
2 changed files with 184 additions and 63 deletions
|
|
@ -11,6 +11,7 @@ use iced_core::Color;
|
|||
pub enum TextInput {
|
||||
#[default]
|
||||
Default,
|
||||
EditableText,
|
||||
ExpandableSearch,
|
||||
Search,
|
||||
Inline,
|
||||
|
|
@ -52,6 +53,22 @@ impl StyleSheet for crate::Theme {
|
|||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::EditableText => Appearance {
|
||||
background: Color::TRANSPARENT.into(),
|
||||
border_radius: corner.radius_0.into(),
|
||||
border_width: 0.0,
|
||||
border_offset: None,
|
||||
border_color: Color::TRANSPARENT,
|
||||
icon_color: container.on.into(),
|
||||
text_color: container.on.into(),
|
||||
placeholder_color: {
|
||||
let color: Color = container.on.into();
|
||||
color.blend_alpha(background, 0.7)
|
||||
},
|
||||
selected_text_color: palette.on_accent_color().into(),
|
||||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::ExpandableSearch => Appearance {
|
||||
background: Color::TRANSPARENT.into(),
|
||||
border_radius: corner.radius_xl.into(),
|
||||
|
|
@ -147,7 +164,7 @@ impl StyleSheet for crate::Theme {
|
|||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::Inline => Appearance {
|
||||
TextInput::EditableText | TextInput::Inline => Appearance {
|
||||
background: Color::TRANSPARENT.into(),
|
||||
border_radius: corner.radius_0.into(),
|
||||
border_width: 0.0,
|
||||
|
|
@ -226,6 +243,22 @@ impl StyleSheet for crate::Theme {
|
|||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::EditableText => Appearance {
|
||||
background: Color::TRANSPARENT.into(),
|
||||
border_radius: corner.radius_0.into(),
|
||||
border_width: 0.0,
|
||||
border_offset: None,
|
||||
border_color: Color::TRANSPARENT,
|
||||
icon_color: container.on.into(),
|
||||
text_color: container.on.into(),
|
||||
placeholder_color: {
|
||||
let color: Color = container.on.into();
|
||||
color.blend_alpha(background, 0.7)
|
||||
},
|
||||
selected_text_color: palette.on_accent_color().into(),
|
||||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::Inline => Appearance {
|
||||
background: Color::from(container.component.hover).into(),
|
||||
border_radius: corner.radius_0.into(),
|
||||
|
|
@ -289,6 +322,24 @@ impl StyleSheet for crate::Theme {
|
|||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::EditableText => Appearance {
|
||||
background: Color::TRANSPARENT.into(),
|
||||
border_radius: corner.radius_0.into(),
|
||||
border_width: 0.0,
|
||||
border_offset: None,
|
||||
border_color: Color::TRANSPARENT,
|
||||
icon_color: container.on.into(),
|
||||
// TODO use regular text color here after text rendering handles multiple colors
|
||||
// in this case, for selected and unselected text
|
||||
text_color: container.on.into(),
|
||||
placeholder_color: {
|
||||
let color: Color = container.on.into();
|
||||
color.blend_alpha(background, 0.7)
|
||||
},
|
||||
selected_text_color: palette.on_accent_color().into(),
|
||||
selected_fill: palette.accent_color().into(),
|
||||
label_color: label_color.into(),
|
||||
},
|
||||
TextInput::Inline => Appearance {
|
||||
background: Color::from(palette.accent.base).into(),
|
||||
border_radius: corner.radius_0.into(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue