fix: better styling of button & popup

This commit is contained in:
Ashley Wulber 2022-11-14 15:43:39 +01:00
parent ae89afcc5f
commit b3977bed34
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820

View file

@ -1,7 +1,10 @@
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};
use cosmic::iced_style::application::{self, Appearance};
use cosmic::separator; use cosmic::separator;
use cosmic::theme::Container;
use cosmic::widget::widget::container;
use cosmic::{ use cosmic::{
iced::widget::{column, radio, text}, iced::widget::{column, radio, text},
iced::{self, Application, Command, Length}, iced::{self, Application, Command, Length},
@ -10,6 +13,7 @@ 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; use iced_sctk::alignment::Horizontal;
use iced_sctk::commands::popup::{destroy_popup, get_popup}; use iced_sctk::commands::popup::{destroy_popup, get_popup};
use zbus::Connection; use zbus::Connection;
@ -210,7 +214,7 @@ impl Application for Window {
.into() .into()
} }
}; };
column(vec![ container(column(vec![
text("Graphics Mode") text("Graphics Mode")
.width(Length::Fill) .width(Length::Fill)
.horizontal_alignment(Horizontal::Center) .horizontal_alignment(Horizontal::Center)
@ -218,9 +222,16 @@ impl Application for Window {
.into(), .into(),
separator!(1).into(), separator!(1).into(),
content, 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()
} }
@ -240,6 +251,10 @@ impl Application for Window {
unimplemented!() unimplemented!()
} }
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() })
}
fn view_window(&self, _: window::Id) -> Element<Message> { fn view_window(&self, _: window::Id) -> Element<Message> {
// TODO use panel config crate after resolving version mismatch // TODO use panel config crate after resolving version mismatch