fix: better popup container

This commit is contained in:
Ashley Wulber 2022-11-14 16:58:54 +01:00
parent b3977bed34
commit af1e16b1f5
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
2 changed files with 19 additions and 21 deletions

View file

@ -1546,7 +1546,7 @@ checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]] [[package]]
name = "libcosmic" name = "libcosmic"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic/?branch=sctk-cosmic-design-system#49f0f34270fb1cf4eba21ea4f45180dc37f224f9" source = "git+https://github.com/pop-os/libcosmic/?branch=sctk-cosmic-design-system#9174e4209964f3d924fb280c89301e8fba4967fb"
dependencies = [ dependencies = [
"apply", "apply",
"cosmic-panel-config", "cosmic-panel-config",

View file

@ -1,6 +1,6 @@
use crate::dbus::{self, PowerDaemonProxy}; use crate::dbus::{self, PowerDaemonProxy};
use crate::graphics::{get_current_graphics, set_graphics, Graphics}; use crate::graphics::{get_current_graphics, set_graphics, Graphics};
use cosmic::applet::{get_popup_settings, icon_button}; use cosmic::applet::{get_popup_settings, icon_button, popup_container};
use cosmic::iced_style::application::{self, Appearance}; use cosmic::iced_style::application::{self, Appearance};
use cosmic::separator; use cosmic::separator;
use cosmic::theme::Container; use cosmic::theme::Container;
@ -13,9 +13,9 @@ use cosmic::{
Element, Element,
}; };
use cosmic_panel_config::{PanelAnchor, PanelSize}; use cosmic_panel_config::{PanelAnchor, PanelSize};
use iced_sctk::Color; use iced_sctk::alignment::{Horizontal, Vertical};
use iced_sctk::alignment::Horizontal;
use iced_sctk::commands::popup::{destroy_popup, get_popup}; use iced_sctk::commands::popup::{destroy_popup, get_popup};
use iced_sctk::Color;
use zbus::Connection; use zbus::Connection;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
@ -214,24 +214,19 @@ impl Application for Window {
.into() .into()
} }
}; };
container(column(vec![ popup_container(
text("Graphics Mode") column(vec![
.width(Length::Fill) text("Graphics Mode")
.horizontal_alignment(Horizontal::Center) .width(Length::Fill)
.size(24) .horizontal_alignment(Horizontal::Center)
.into(), .size(24)
separator!(1).into(), .into(),
content, separator!(1).into(),
content,
]) ])
.padding(4) .padding(4)
.spacing(4)) .spacing(4),
.style(Container::Custom(|theme| container::Appearance { )
text_color: Some(theme.cosmic().on_bg_color().into()),
background: Some(theme.extended_palette().background.base.color.into()),
border_radius: 12.0,
border_width: 0.0,
border_color: Color::TRANSPARENT,
}))
.into() .into()
} }
@ -252,7 +247,10 @@ impl Application for Window {
} }
fn style(&self) -> <Self::Theme as application::StyleSheet>::Style { fn style(&self) -> <Self::Theme as application::StyleSheet>::Style {
<Self::Theme as application::StyleSheet>::Style::Custom(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into() }) <Self::Theme as application::StyleSheet>::Style::Custom(|theme| Appearance {
background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0),
text_color: theme.cosmic().on_bg_color().into(),
})
} }
fn view_window(&self, _: window::Id) -> Element<Message> { fn view_window(&self, _: window::Id) -> Element<Message> {