fix(app): padding fixes
Also removes some unnecessary code for the applet context drawer content.
This commit is contained in:
parent
8d8536da21
commit
8512fad641
3 changed files with 15 additions and 48 deletions
|
|
@ -22,23 +22,21 @@ use crate::pages::sound;
|
||||||
use crate::pages::{self, system, time};
|
use crate::pages::{self, system, time};
|
||||||
use crate::subscription::desktop_files;
|
use crate::subscription::desktop_files;
|
||||||
use crate::widget::{page_title, search_header};
|
use crate::widget::{page_title, search_header};
|
||||||
use cosmic::app::context_drawer::ContextDrawer;
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
use cosmic::cctk::{sctk::output::OutputInfo, wayland_client::protocol::wl_output::WlOutput};
|
use cosmic::cctk::{sctk::output::OutputInfo, wayland_client::protocol::wl_output::WlOutput};
|
||||||
use cosmic::iced::Subscription;
|
|
||||||
use cosmic::widget::{self, button, row, text_input};
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Element,
|
Element,
|
||||||
app::{Core, Task},
|
app::{Core, Task, context_drawer::ContextDrawer},
|
||||||
iced::{
|
iced::{
|
||||||
self, Length,
|
self, Length, Subscription,
|
||||||
event::{self, PlatformSpecific},
|
event::{self, PlatformSpecific},
|
||||||
window,
|
window,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
surface,
|
surface,
|
||||||
widget::{
|
widget::{
|
||||||
column, container, icon, id_container, nav_bar, scrollable, segmented_button, settings,
|
button, column, container, icon, id_container, nav_bar, row, scrollable, segmented_button,
|
||||||
|
settings, text_input,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
|
|
@ -800,9 +798,7 @@ impl cosmic::Application for SettingsApp {
|
||||||
return self.page_container(row::row());
|
return self.page_container(row::row());
|
||||||
};
|
};
|
||||||
|
|
||||||
container(view)
|
container(view).into()
|
||||||
.padding([cosmic::theme::active().cosmic().space_xxs(), 0])
|
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
|
|
@ -999,11 +995,8 @@ impl SettingsApp {
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.apply(|w| id_container(w, self.id()));
|
.apply(|w| id_container(w, self.id()));
|
||||||
|
|
||||||
widget::column::with_capacity(3)
|
column::with_capacity(2)
|
||||||
.push(self.page_container(header))
|
.push(self.page_container(header))
|
||||||
.push(widget::vertical_space().height(Length::Fixed(
|
|
||||||
cosmic::theme::active().cosmic().space_m().into(),
|
|
||||||
)))
|
|
||||||
.push(view)
|
.push(view)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.into()
|
.into()
|
||||||
|
|
@ -1103,8 +1096,8 @@ impl SettingsApp {
|
||||||
{
|
{
|
||||||
let section = (section.view_fn)(&self.pages, model.as_ref(), section)
|
let section = (section.view_fn)(&self.pages, model.as_ref(), section)
|
||||||
.map(Message::PageMessage)
|
.map(Message::PageMessage)
|
||||||
.apply(iced::widget::container)
|
.apply(container)
|
||||||
.padding([0, 0, 0, cosmic::theme::active().cosmic().space_xl()]);
|
.padding([0, 0, 0, cosmic::theme::active().cosmic().space_l()]);
|
||||||
|
|
||||||
sections.push(section.into());
|
sections.push(section.into());
|
||||||
}
|
}
|
||||||
|
|
@ -1137,14 +1130,12 @@ impl SettingsApp {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.spacing(theme.cosmic().space_s())
|
.spacing(theme.cosmic().space_s())
|
||||||
.padding(0)
|
|
||||||
.apply(|widget| scrollable(self.page_container(widget)).height(Length::Fill))
|
.apply(|widget| scrollable(self.page_container(widget)).height(Length::Fill))
|
||||||
.apply(Element::from)
|
.apply(Element::from)
|
||||||
.map(Message::Page);
|
.map(Message::Page);
|
||||||
|
|
||||||
widget::column::with_capacity(3)
|
column::with_capacity(2)
|
||||||
.push(self.page_container(page_title(&self.pages.info[self.active_page])))
|
.push(self.page_container(page_title(&self.pages.info[self.active_page])))
|
||||||
.push(widget::vertical_space().height(theme.cosmic().space_m()))
|
|
||||||
.push(page_list)
|
.push(page_list)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.into()
|
.into()
|
||||||
|
|
@ -1161,13 +1152,15 @@ impl SettingsApp {
|
||||||
} else {
|
} else {
|
||||||
theme.cosmic().space_l()
|
theme.cosmic().space_l()
|
||||||
};
|
};
|
||||||
|
// prevents content from touching window edge on bottom of scroll
|
||||||
|
let bottom_spacer = theme.cosmic().space_m();
|
||||||
|
|
||||||
container(content.into())
|
container(content.into())
|
||||||
.max_width(800)
|
.max_width(800)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.apply(container)
|
.apply(container)
|
||||||
.center_x(Length::Fill)
|
.center_x(Length::Fill)
|
||||||
.padding([0, padding])
|
.padding([0, padding, bottom_spacer, padding])
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -417,11 +417,11 @@ fn apps() -> Section<crate::pages::Message> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let add_input_source = widget::button::standard(fl!("startup-apps", "add"))
|
let add_startup_app = widget::button::standard(fl!("startup-apps", "add"))
|
||||||
.on_press(Message::ShowApplicationSidebar(directory_type.clone()));
|
.on_press(Message::ShowApplicationSidebar(directory_type.clone()));
|
||||||
|
|
||||||
view = view.push(section).push(widget::container(
|
view = view.push(section).push(widget::container(
|
||||||
widget::container(add_input_source)
|
widget::container(add_startup_app)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.align_x(Alignment::End),
|
.align_x(Alignment::End),
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use button::Catalog as ButtonStyleSheet;
|
|
||||||
use cosmic::iced::clipboard::dnd::{
|
use cosmic::iced::clipboard::dnd::{
|
||||||
DndAction, DndDestinationRectangle, DndEvent, OfferEvent, SourceEvent,
|
DndAction, DndDestinationRectangle, DndEvent, OfferEvent, SourceEvent,
|
||||||
};
|
};
|
||||||
|
|
@ -267,32 +266,7 @@ impl Page {
|
||||||
.spacing(space_xxxs)
|
.spacing(space_xxxs)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
button::standard(fl!("add"))
|
button::text(fl!("add"))
|
||||||
.class(button::ButtonClass::Custom {
|
|
||||||
active: Box::new(|focused, theme| {
|
|
||||||
let mut style =
|
|
||||||
theme.active(focused, false, &button::ButtonClass::Text);
|
|
||||||
style.text_color = Some(theme.cosmic().accent_color().into());
|
|
||||||
style
|
|
||||||
}),
|
|
||||||
disabled: Box::new(|theme| {
|
|
||||||
let mut style = theme.disabled(&button::ButtonClass::Text);
|
|
||||||
let mut text_color: Color = theme.cosmic().accent_color().into();
|
|
||||||
text_color.a *= 0.5;
|
|
||||||
style.text_color = Some(text_color);
|
|
||||||
style
|
|
||||||
}),
|
|
||||||
hovered: Box::new(|focused, theme| {
|
|
||||||
let mut style = theme.hovered(focused, false, &theme::Button::Text);
|
|
||||||
style.text_color = Some(theme.cosmic().accent_color().into());
|
|
||||||
style
|
|
||||||
}),
|
|
||||||
pressed: Box::new(|focused, theme| {
|
|
||||||
let mut style = theme.pressed(focused, false, &theme::Button::Text);
|
|
||||||
style.text_color = Some(theme.cosmic().accent_color().into());
|
|
||||||
style
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
.on_press(msg_map(Message::AddApplet(info.clone())))
|
.on_press(msg_map(Message::AddApplet(info.clone())))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue