fix(entry): entry bg alpha typo & border radius fixes
This commit is contained in:
parent
ff78cfe1ca
commit
b510b89b98
3 changed files with 30 additions and 12 deletions
|
|
@ -176,7 +176,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
Bluetooth(bluetooth::Message),
|
Bluetooth(bluetooth::Message),
|
||||||
Close,
|
Close,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use apply::Apply;
|
use apply::Apply;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
cosmic_theme,
|
cosmic_theme,
|
||||||
iced::widget::{checkbox, pick_list, progress_bar, radio, row, slider, text},
|
iced::widget::{checkbox, pick_list, progress_bar, radio, row, slider, text, text_input},
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
theme::{self, Button as ButtonTheme, Theme},
|
theme::{self, Button as ButtonTheme, Theme},
|
||||||
widget::{
|
widget::{
|
||||||
|
|
@ -11,6 +11,7 @@ use cosmic::{
|
||||||
Element,
|
Element,
|
||||||
};
|
};
|
||||||
use fraction::{Decimal, ToPrimitive};
|
use fraction::{Decimal, ToPrimitive};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use super::{Page, Window};
|
use super::{Page, Window};
|
||||||
|
|
||||||
|
|
@ -28,8 +29,9 @@ pub enum MultiOption {
|
||||||
OptionD,
|
OptionD,
|
||||||
OptionE,
|
OptionE,
|
||||||
}
|
}
|
||||||
|
static INPUT_ID: Lazy<text_input::Id> = Lazy::new(text_input::Id::unique);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
ButtonPressed,
|
ButtonPressed,
|
||||||
CheckboxToggled(bool),
|
CheckboxToggled(bool),
|
||||||
|
|
@ -46,6 +48,7 @@ pub enum Message {
|
||||||
ToggleWarning,
|
ToggleWarning,
|
||||||
TogglerToggled(bool),
|
TogglerToggled(bool),
|
||||||
ViewSwitcher(segmented_button::Entity),
|
ViewSwitcher(segmented_button::Entity),
|
||||||
|
InputChanged(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Output {
|
pub enum Output {
|
||||||
|
|
@ -67,6 +70,7 @@ pub struct State {
|
||||||
pub spin_button: spin_button::Model<i32>,
|
pub spin_button: spin_button::Model<i32>,
|
||||||
pub toggler_value: bool,
|
pub toggler_value: bool,
|
||||||
pub view_switcher: segmented_button::SingleSelectModel,
|
pub view_switcher: segmented_button::SingleSelectModel,
|
||||||
|
pub entry_value: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for State {
|
impl Default for State {
|
||||||
|
|
@ -104,6 +108,7 @@ impl Default for State {
|
||||||
.insert(|b| b.text("Segmented Button").data(DemoView::TabB))
|
.insert(|b| b.text("Segmented Button").data(DemoView::TabB))
|
||||||
.insert(|b| b.text("Tab C").data(DemoView::TabC))
|
.insert(|b| b.text("Tab C").data(DemoView::TabC))
|
||||||
.build(),
|
.build(),
|
||||||
|
entry_value: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -136,6 +141,9 @@ impl State {
|
||||||
cosmic::settings::set_default_icon_theme(theme);
|
cosmic::settings::set_default_icon_theme(theme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Message::InputChanged(s) => {
|
||||||
|
self.entry_value = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
@ -390,6 +398,16 @@ impl State {
|
||||||
.padding(8)
|
.padding(8)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
|
text_input(
|
||||||
|
"Type to search apps or type “?” for more options...",
|
||||||
|
&self.entry_value,
|
||||||
|
Message::InputChanged,
|
||||||
|
)
|
||||||
|
// .on_submit(Message::Activate(None))
|
||||||
|
.padding(8)
|
||||||
|
.size(20)
|
||||||
|
.id(INPUT_ID.clone())
|
||||||
|
.into(),
|
||||||
])
|
])
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -988,17 +988,17 @@ impl text_input::StyleSheet for Theme {
|
||||||
fn active(&self, style: &Self::Style) -> text_input::Appearance {
|
fn active(&self, style: &Self::Style) -> text_input::Appearance {
|
||||||
let palette = self.cosmic();
|
let palette = self.cosmic();
|
||||||
let mut bg = palette.palette.neutral_7;
|
let mut bg = palette.palette.neutral_7;
|
||||||
bg.alpha = 0.75;
|
bg.alpha = 0.25;
|
||||||
match style {
|
match style {
|
||||||
TextInput::Default => text_input::Appearance {
|
TextInput::Default => text_input::Appearance {
|
||||||
background: Color::from(bg).into(),
|
background: Color::from(bg).into(),
|
||||||
border_radius: 2.0,
|
border_radius: 8.0,
|
||||||
border_width: 1.0,
|
border_width: 1.0,
|
||||||
border_color: self.current_container().component.divider.into(),
|
border_color: self.current_container().component.divider.into(),
|
||||||
},
|
},
|
||||||
TextInput::Search => text_input::Appearance {
|
TextInput::Search => text_input::Appearance {
|
||||||
background: Color::from(bg).into(),
|
background: Color::from(bg).into(),
|
||||||
border_radius: 0.0,
|
border_radius: 24.0,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
},
|
},
|
||||||
|
|
@ -1008,18 +1008,18 @@ impl text_input::StyleSheet for Theme {
|
||||||
fn hovered(&self, style: &Self::Style) -> text_input::Appearance {
|
fn hovered(&self, style: &Self::Style) -> text_input::Appearance {
|
||||||
let palette = self.cosmic();
|
let palette = self.cosmic();
|
||||||
let mut bg = palette.palette.neutral_7;
|
let mut bg = palette.palette.neutral_7;
|
||||||
bg.alpha = 0.75;
|
bg.alpha = 0.25;
|
||||||
|
|
||||||
match style {
|
match style {
|
||||||
TextInput::Default => text_input::Appearance {
|
TextInput::Default => text_input::Appearance {
|
||||||
background: Color::from(bg).into(),
|
background: Color::from(bg).into(),
|
||||||
border_radius: 2.0,
|
border_radius: 8.0,
|
||||||
border_width: 1.0,
|
border_width: 1.0,
|
||||||
border_color: palette.accent.base.into(),
|
border_color: palette.accent.base.into(),
|
||||||
},
|
},
|
||||||
TextInput::Search => text_input::Appearance {
|
TextInput::Search => text_input::Appearance {
|
||||||
background: Color::from(bg).into(),
|
background: Color::from(bg).into(),
|
||||||
border_radius: 0.0,
|
border_radius: 24.0,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
},
|
},
|
||||||
|
|
@ -1029,18 +1029,18 @@ impl text_input::StyleSheet for Theme {
|
||||||
fn focused(&self, style: &Self::Style) -> text_input::Appearance {
|
fn focused(&self, style: &Self::Style) -> text_input::Appearance {
|
||||||
let palette = self.cosmic();
|
let palette = self.cosmic();
|
||||||
let mut bg = palette.palette.neutral_7;
|
let mut bg = palette.palette.neutral_7;
|
||||||
bg.alpha = 0.75;
|
bg.alpha = 0.25;
|
||||||
|
|
||||||
match style {
|
match style {
|
||||||
TextInput::Default => text_input::Appearance {
|
TextInput::Default => text_input::Appearance {
|
||||||
background: Color::from(bg).into(),
|
background: Color::from(bg).into(),
|
||||||
border_radius: 2.0,
|
border_radius: 8.0,
|
||||||
border_width: 1.0,
|
border_width: 1.0,
|
||||||
border_color: palette.accent.base.into(),
|
border_color: palette.accent.base.into(),
|
||||||
},
|
},
|
||||||
TextInput::Search => text_input::Appearance {
|
TextInput::Search => text_input::Appearance {
|
||||||
background: Color::from(bg).into(),
|
background: Color::from(bg).into(),
|
||||||
border_radius: 0.0,
|
border_radius: 24.0,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue