Include Cosmic theme in libcosmic, instead of in Iced fork
I think it's best to only include things in the Iced fork that can't be done without forking Iced, and/or are expected to be merged upstream. The theme doesn't seem to be either, so it fits more appropriately in libcosmic. That should make it easier to keep up with upstream, and it may help to have all the Cosmic parts in one place. Based on https://github.com/pop-os/iced commit ad9026e.
This commit is contained in:
parent
a6d93de47f
commit
947532413a
13 changed files with 1145 additions and 19 deletions
|
|
@ -1,12 +1,11 @@
|
|||
use std::vec;
|
||||
|
||||
use crate::{list_box_row, separator, widget::ListRow};
|
||||
use crate::{list_box_row, separator, theme, widget::ListRow, Element, Renderer, Theme};
|
||||
use apply::Apply;
|
||||
use derive_setters::Setters;
|
||||
use iced::{
|
||||
theme,
|
||||
widget::{self, button, container, horizontal_space, row, text, Column},
|
||||
Alignment, Background, Element, Length, Renderer, Theme,
|
||||
Alignment, Background, Length,
|
||||
};
|
||||
use iced_lazy::Component;
|
||||
use iced_native::widget::{column, event_container};
|
||||
|
|
@ -86,14 +85,14 @@ impl<'a, Message: Clone + 'a> Component<Message, Renderer> for Expander<'a, Mess
|
|||
}
|
||||
|
||||
fn view(&self, state: &Self::State) -> Element<Self::Event> {
|
||||
let heading: Element<ExpanderEvent, Renderer> = {
|
||||
let heading: Element<ExpanderEvent> = {
|
||||
let mut captions = vec![text(&self.title).size(18).into()];
|
||||
if let Some(subtitle) = &self.subtitle {
|
||||
captions.push(text(subtitle).size(16).into());
|
||||
}
|
||||
let text = column(captions);
|
||||
let space: Element<ExpanderEvent, Renderer> = horizontal_space(Length::Fill).into();
|
||||
let toggler: Element<ExpanderEvent, Renderer> = {
|
||||
let space: Element<ExpanderEvent> = horizontal_space(Length::Fill).into();
|
||||
let toggler: Element<ExpanderEvent> = {
|
||||
let mut icon = super::icon(
|
||||
if state.expanded {
|
||||
"go-down-symbolic"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use apply::Apply;
|
||||
use derive_setters::*;
|
||||
use iced::{self, alignment::Vertical, theme, widget, Element, Length, Renderer};
|
||||
use iced::{self, alignment::Vertical, widget, Length};
|
||||
use iced_lazy::Component;
|
||||
use crate::{theme, Element, Renderer};
|
||||
|
||||
#[derive(Setters)]
|
||||
pub struct HeaderBar<Message> {
|
||||
|
|
@ -103,7 +104,7 @@ impl<Message: Clone> Component<Message, Renderer> for HeaderBar<Message> {
|
|||
.into();
|
||||
|
||||
let window_controls = {
|
||||
let mut widgets: Vec<Element<HeaderEvent, _>> = Vec::with_capacity(3);
|
||||
let mut widgets: Vec<Element<HeaderEvent>> = Vec::with_capacity(3);
|
||||
|
||||
let icon = |name, size, on_press| {
|
||||
super::icon(name, size)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::separator;
|
||||
use crate::theme::{self, Container};
|
||||
use derive_setters::Setters;
|
||||
use iced::mouse::Interaction;
|
||||
use iced::{overlay, Alignment, Length, Padding, Point, Rectangle};
|
||||
|
|
@ -12,8 +13,6 @@ use iced_native::{
|
|||
renderer, row, Background, Clipboard, Color, Element, Event, Layout, Shell, Widget,
|
||||
};
|
||||
use iced_style::container::{Appearance, StyleSheet};
|
||||
use iced_style::theme;
|
||||
use iced_style::theme::Container;
|
||||
|
||||
#[derive(Setters)]
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
pub use iced::{widget, Background, Color, Theme};
|
||||
pub use iced::{widget, Background, Color};
|
||||
pub use crate::Theme;
|
||||
|
||||
pub mod list_view {
|
||||
#[macro_export]
|
||||
|
|
@ -82,7 +83,7 @@ pub mod list_view {
|
|||
|
||||
use crate::widget::{Background, Color};
|
||||
use iced::widget;
|
||||
use iced_style::Theme;
|
||||
use crate::Theme;
|
||||
|
||||
pub use list_view;
|
||||
pub use list_view_item;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
pub mod nav_bar {
|
||||
use iced::{widget, Background, Color, Theme};
|
||||
use iced::{widget, Background, Color};
|
||||
use crate::Theme;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! nav_button {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
use crate::scrollable;
|
||||
use crate::widget::nav_bar::{nav_bar_pages_style, nav_bar_sections_style};
|
||||
use crate::widget::{icon, Background};
|
||||
use crate::{theme, Theme};
|
||||
use derive_setters::Setters;
|
||||
use iced::Length;
|
||||
use iced_lazy::Component;
|
||||
use iced_native::widget::{button, column, container, text};
|
||||
use iced_native::{row, Alignment, Element};
|
||||
use iced_style::button::Appearance;
|
||||
use iced_style::{scrollable, theme, Theme};
|
||||
use iced_style::scrollable;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[derive(Setters, Default)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue