Move more code to libcosmic
This commit is contained in:
parent
5ad54bd3b1
commit
bfcaf829eb
4 changed files with 56 additions and 41 deletions
|
|
@ -1,4 +1,7 @@
|
|||
use iced::widget::svg;
|
||||
use iced::{
|
||||
Length,
|
||||
widget::svg,
|
||||
};
|
||||
|
||||
pub fn icon(name: &str, size: u16) -> svg::Svg {
|
||||
let handle = match freedesktop_icons::lookup(name)
|
||||
|
|
@ -15,4 +18,6 @@ pub fn icon(name: &str, size: u16) -> svg::Svg {
|
|||
},
|
||||
};
|
||||
svg::Svg::new(handle)
|
||||
.width(Length::Units(size))
|
||||
.height(Length::Units(size))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ mod list_view;
|
|||
pub use list_view::list_view_style;
|
||||
|
||||
mod nav_bar;
|
||||
pub use nav_bar::nav_bar_style;
|
||||
pub use nav_bar::{nav_bar, nav_bar_style};
|
||||
|
|
|
|||
|
|
@ -2,13 +2,29 @@ use iced::{
|
|||
Background,
|
||||
Color,
|
||||
Theme,
|
||||
widget::{
|
||||
container,
|
||||
},
|
||||
widget
|
||||
};
|
||||
|
||||
pub fn nav_bar_style(theme: &Theme) -> container::Appearance {
|
||||
container::Appearance {
|
||||
#[macro_export]
|
||||
macro_rules! nav_bar {
|
||||
($($x:expr),+ $(,)?) => (
|
||||
$crate::iced::widget::Container::new(
|
||||
$crate::iced::widget::Column::with_children(
|
||||
vec![$($crate::iced::Element::from($x)),+]
|
||||
)
|
||||
.spacing(12)
|
||||
)
|
||||
.max_width(300)
|
||||
.padding(12)
|
||||
.style(theme::Container::Custom(
|
||||
$crate::widget::nav_bar_style
|
||||
))
|
||||
);
|
||||
}
|
||||
pub use nav_bar;
|
||||
|
||||
pub fn nav_bar_style(theme: &Theme) -> widget::container::Appearance {
|
||||
widget::container::Appearance {
|
||||
text_color: None,
|
||||
background: Some(Background::Color(
|
||||
match theme {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue