chore: dialog default to overlay
This commit is contained in:
parent
cde1989e78
commit
94d2c18a23
2 changed files with 15 additions and 5 deletions
|
|
@ -393,7 +393,7 @@ pub enum Container<'a> {
|
||||||
transparent: bool,
|
transparent: bool,
|
||||||
},
|
},
|
||||||
Custom(Box<dyn Fn(&Theme) -> iced_container::Style + 'a>),
|
Custom(Box<dyn Fn(&Theme) -> iced_container::Style + 'a>),
|
||||||
Dialog,
|
Dialog(bool),
|
||||||
Dropdown,
|
Dropdown,
|
||||||
HeaderBar {
|
HeaderBar {
|
||||||
focused: bool,
|
focused: bool,
|
||||||
|
|
@ -688,14 +688,17 @@ impl iced_container::Catalog for Theme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Container::Dialog => iced_container::Style {
|
Container::Dialog(is_overlay) => iced_container::Style {
|
||||||
icon_color: Some(Color::from(cosmic.primary(self.transparent).on)),
|
icon_color: Some(Color::from(cosmic.primary(self.transparent).on)),
|
||||||
text_color: Some(Color::from(cosmic.primary(self.transparent).on)),
|
text_color: Some(Color::from(cosmic.primary(self.transparent).on)),
|
||||||
background: Some(iced::Background::Color(
|
background: Some(iced::Background::Color(
|
||||||
cosmic.primary(self.transparent).base.into(),
|
cosmic.primary(self.transparent && !is_overlay).base.into(),
|
||||||
)),
|
)),
|
||||||
border: Border {
|
border: Border {
|
||||||
color: cosmic.primary(self.transparent).divider.into(),
|
color: cosmic
|
||||||
|
.primary(self.transparent && !is_overlay)
|
||||||
|
.divider
|
||||||
|
.into(),
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
radius: cosmic.corner_radii.radius_m.into(),
|
radius: cosmic.corner_radii.radius_m.into(),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ pub struct Dialog<'a, Message> {
|
||||||
height: Option<Length>,
|
height: Option<Length>,
|
||||||
max_width: Option<Pixels>,
|
max_width: Option<Pixels>,
|
||||||
max_height: Option<Pixels>,
|
max_height: Option<Pixels>,
|
||||||
|
is_overlay: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message> Default for Dialog<'_, Message> {
|
impl<Message> Default for Dialog<'_, Message> {
|
||||||
|
|
@ -40,6 +41,7 @@ impl<'a, Message> Dialog<'a, Message> {
|
||||||
height: None,
|
height: None,
|
||||||
max_width: None,
|
max_width: None,
|
||||||
max_height: None,
|
max_height: None,
|
||||||
|
is_overlay: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,6 +99,11 @@ impl<'a, Message> Dialog<'a, Message> {
|
||||||
self.max_width = Some(max_width.into());
|
self.max_width = Some(max_width.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_overlay(mut self, is_overlay: bool) -> Self {
|
||||||
|
self.is_overlay = is_overlay;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Message: Clone + 'static> From<Dialog<'a, Message>> for Element<'a, Message> {
|
impl<'a, Message: Clone + 'static> From<Dialog<'a, Message>> for Element<'a, Message> {
|
||||||
|
|
@ -157,7 +164,7 @@ impl<'a, Message: Clone + 'static> From<Dialog<'a, Message>> for Element<'a, Mes
|
||||||
let mut container = widget::container(
|
let mut container = widget::container(
|
||||||
widget::column::with_children([content_row.into(), button_row.into()]).spacing(space_l),
|
widget::column::with_children([content_row.into(), button_row.into()]).spacing(space_l),
|
||||||
)
|
)
|
||||||
.class(style::Container::Dialog)
|
.class(style::Container::Dialog(dialog.is_overlay))
|
||||||
.padding(space_m)
|
.padding(space_m)
|
||||||
.width(dialog.width.unwrap_or(Length::Fixed(570.0)));
|
.width(dialog.width.unwrap_or(Length::Fixed(570.0)));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue