fix(applets context): center text without description
This commit is contained in:
parent
d76c564feb
commit
23ff6e9fcc
17 changed files with 325 additions and 303 deletions
498
Cargo.lock
generated
498
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -48,7 +48,7 @@ lto = "thin"
|
|||
# smithay-client-toolkit = { git = "https://github.com/smithay/client-toolkit//", rev = "c583de8" }
|
||||
|
||||
[patch.'https://github.com/pop-os/cosmic-protocols']
|
||||
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "27d70b6" }
|
||||
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "d218c76" }
|
||||
|
||||
# For development and testing purposes
|
||||
# [patch.'https://github.com/pop-os/libcosmic']
|
||||
|
|
|
|||
|
|
@ -932,7 +932,7 @@ impl SettingsApp {
|
|||
}
|
||||
|
||||
let view = self
|
||||
.page_container(settings::view_column(sections_column).padding(0))
|
||||
.page_container(settings::view_column(sections_column))
|
||||
.apply(scrollable)
|
||||
.height(Length::Fill)
|
||||
.apply(|w| id_container(w, self.id()));
|
||||
|
|
@ -1050,7 +1050,7 @@ impl SettingsApp {
|
|||
}
|
||||
}
|
||||
|
||||
self.page_container(settings::view_column(sections).padding(0))
|
||||
self.page_container(settings::view_column(sections))
|
||||
.apply(scrollable)
|
||||
.into()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ fn status() -> Section<crate::pages::Message> {
|
|||
} else {
|
||||
text::body(&descriptions[bluetooth_heading]).into()
|
||||
},
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
if page.popup_setting {
|
||||
widget::popover(
|
||||
widget::button::icon(widget::icon::from_name(
|
||||
|
|
@ -735,7 +735,7 @@ fn connected_devices() -> Section<crate::pages::Message> {
|
|||
.wrapping(Wrapping::Word)
|
||||
.into()
|
||||
},
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
match device.enabled {
|
||||
Active::Enabled => widget::text(&descriptions[device_connected]).into(),
|
||||
Active::Enabling => widget::text(&descriptions[device_connecting])
|
||||
|
|
@ -790,7 +790,7 @@ fn available_devices() -> Section<crate::pages::Message> {
|
|||
let mut items = vec![
|
||||
widget::icon::from_name(device.icon).size(16).into(),
|
||||
text(device.alias_or_addr()).wrapping(Wrapping::Word).into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
];
|
||||
|
||||
if device.enabled == Active::Enabling {
|
||||
|
|
@ -840,7 +840,7 @@ fn multiple_adapter() -> Section<crate::pages::Message> {
|
|||
.into(),
|
||||
widget::horizontal_space().width(theme.space_xxs()).into(),
|
||||
text(&adapter.alias).wrapping(Wrapping::Word).into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
widget::icon::from_name("go-next-symbolic").into(),
|
||||
];
|
||||
if page.adapter_connected(path) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use std::sync::Arc;
|
|||
|
||||
use cosmic::{
|
||||
config::{CosmicTk, FontConfig},
|
||||
iced::Length,
|
||||
iced_core::text::Wrapping,
|
||||
theme,
|
||||
widget::{self, settings, svg},
|
||||
|
|
@ -89,7 +88,7 @@ pub fn selection_context<'a>(
|
|||
widget::text::body(&**family)
|
||||
.wrapping(Wrapping::Word)
|
||||
.into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
if selected {
|
||||
widget::icon::from_name("object-select-symbolic")
|
||||
.size(16)
|
||||
|
|
|
|||
|
|
@ -1568,9 +1568,7 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
|
|||
.title(fl!("mode-and-colors"))
|
||||
.descriptions(descriptions)
|
||||
.view::<Page>(move |_binder, page, section| {
|
||||
let Spacing {
|
||||
space_xxs, space_s, ..
|
||||
} = cosmic::theme::active().cosmic().spacing;
|
||||
let Spacing { space_xxs, .. } = cosmic::theme::active().cosmic().spacing;
|
||||
|
||||
let descriptions = §ion.descriptions;
|
||||
let palette = &page.theme_builder.palette.as_ref();
|
||||
|
|
@ -1728,7 +1726,7 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
|
|||
)
|
||||
.direction(Direction::Horizontal(Scrollbar::new()))
|
||||
]
|
||||
.padding([16, space_s, 0, space_s])
|
||||
.padding([16, 0, 0, 0])
|
||||
.spacing(space_xxs),
|
||||
)
|
||||
.add(
|
||||
|
|
|
|||
|
|
@ -226,9 +226,8 @@ impl Page {
|
|||
) -> Element<crate::pages::Message> {
|
||||
let cosmic::cosmic_theme::Spacing {
|
||||
space_xxxs,
|
||||
space_xxs,
|
||||
space_xs,
|
||||
space_s,
|
||||
space_l,
|
||||
..
|
||||
} = theme::active().cosmic().spacing;
|
||||
let mut list_column = list_column();
|
||||
|
|
@ -262,7 +261,11 @@ impl Page {
|
|||
icon::from_name(&*info.icon).size(32).icon().into(),
|
||||
column::with_capacity(2)
|
||||
.push(text::body(info.name.clone()))
|
||||
.push(text::caption(info.description.clone()))
|
||||
.push_maybe(if info.description.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(text::caption(info.description.clone()))
|
||||
})
|
||||
.spacing(space_xxxs)
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
|
|
@ -295,7 +298,7 @@ impl Page {
|
|||
.on_press(msg_map(Message::AddApplet(info.clone())))
|
||||
.into(),
|
||||
])
|
||||
.padding([0, space_s])
|
||||
.padding([space_xxxs, 0])
|
||||
.spacing(space_xs)
|
||||
.align_y(Alignment::Center),
|
||||
);
|
||||
|
|
@ -317,7 +320,7 @@ impl Page {
|
|||
.push(search)
|
||||
.push(list_column)
|
||||
.align_x(Alignment::Center)
|
||||
.spacing(space_xxs)
|
||||
.spacing(space_l)
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ pub(crate) fn configuration<P: page::Page<crate::pages::Message> + PanelPage>(
|
|||
.find(|(_, v)| v.id == page.applets_page_id())
|
||||
{
|
||||
let control = row::with_children(vec![
|
||||
horizontal_space().width(Length::Fill).into(),
|
||||
horizontal_space().into(),
|
||||
icon::from_name("go-next-symbolic").size(16).into(),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1297,7 +1297,7 @@ pub fn settings() -> Section<crate::pages::Message> {
|
|||
},
|
||||
)
|
||||
.push(category_selection)
|
||||
.push(cosmic::widget::horizontal_space().width(Length::Fill))
|
||||
.push(cosmic::widget::horizontal_space())
|
||||
.push_maybe(add_button)
|
||||
.into(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1073,15 +1073,16 @@ pub fn display_arrangement() -> Section<crate::pages::Message> {
|
|||
.show_while::<Page>(|page| page.list.outputs.len() > 1)
|
||||
.view::<Page>(move |_binder, page, section| {
|
||||
let descriptions = §ion.descriptions;
|
||||
let theme = cosmic::theme::active();
|
||||
let cosmic::cosmic_theme::Spacing {
|
||||
space_xxs, space_m, ..
|
||||
} = cosmic::theme::active().cosmic().spacing;
|
||||
|
||||
column()
|
||||
.padding(cosmic::iced::Padding::from([
|
||||
theme.cosmic().space_s(),
|
||||
theme.cosmic().space_m(),
|
||||
]))
|
||||
.spacing(theme.cosmic().space_xs())
|
||||
.push(widget::text::body(&descriptions[display_arrangement_desc]))
|
||||
.push(
|
||||
text::body(&descriptions[display_arrangement_desc])
|
||||
.apply(container)
|
||||
.padding([space_xxs, space_m]),
|
||||
)
|
||||
.push({
|
||||
Arrangement::new(&page.list, &page.display_tabs)
|
||||
.on_select(|id| pages::Message::Displays(Message::Display(id)))
|
||||
|
|
@ -1094,9 +1095,12 @@ pub fn display_arrangement() -> Section<crate::pages::Message> {
|
|||
.width(Length::Shrink)
|
||||
.direction(Direction::Horizontal(Scrollbar::new()))
|
||||
.apply(container)
|
||||
.padding([48, 32, 32, 32])
|
||||
.center_x(Length::Fill)
|
||||
})
|
||||
.apply(widget::list::container)
|
||||
.apply(container)
|
||||
.class(cosmic::theme::Container::List)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
|
@ -1224,7 +1228,7 @@ pub fn display_configuration() -> Section<crate::pages::Message> {
|
|||
content = content.push(display_switcher).push(display_enable);
|
||||
} else {
|
||||
content = content
|
||||
.push(widget::text::heading(&descriptions[options_label]))
|
||||
.push(text::heading(&descriptions[options_label]))
|
||||
.push_maybe(display_options.map(|items| {
|
||||
let mut column = list_column();
|
||||
for item in items {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
use super::{Message, NightLight};
|
||||
use crate::pages;
|
||||
use cosmic::iced_core::{Alignment, Length, Padding};
|
||||
use cosmic::prelude::CollectionWidget;
|
||||
use cosmic::widget::{button, column, icon, list_column, row, toggler};
|
||||
use cosmic::iced_core::{Alignment, Length};
|
||||
use cosmic::widget::{
|
||||
button, column, container, icon, list_column, row, settings, text, toggler, vertical_space,
|
||||
};
|
||||
use cosmic::{Apply, Element, Task};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
@ -14,33 +15,40 @@ pub fn view(
|
|||
description: &'static str,
|
||||
button: Option<(&'static str, Message)>,
|
||||
) -> Element<'static, Message> {
|
||||
let theme = cosmic::theme::active();
|
||||
let theme = theme.cosmic();
|
||||
let cosmic::cosmic_theme::Spacing {
|
||||
space_xxs, space_l, ..
|
||||
} = cosmic::theme::active().cosmic().spacing;
|
||||
let has_checkmark = button.is_none();
|
||||
|
||||
let content = column::with_capacity(3)
|
||||
.padding(Padding::from([theme.space_xxs(), theme.space_l()]))
|
||||
.push(cosmic::widget::text::body(mode))
|
||||
.push(cosmic::widget::text::caption(description))
|
||||
.push(cosmic::widget::Space::new(Length::Fill, 12))
|
||||
let content = column::with_capacity(4)
|
||||
.padding([space_xxs, space_l])
|
||||
.push(text::body(mode))
|
||||
.push(text::caption(description))
|
||||
.push(vertical_space().height(12))
|
||||
.push_maybe(button.map(|(text, message)| {
|
||||
button::text(text)
|
||||
.class(cosmic::theme::Button::Link)
|
||||
.trailing_icon(icon::from_name("go-next-symbolic").size(16))
|
||||
.padding(0)
|
||||
.on_press(message)
|
||||
}));
|
||||
|
||||
if has_checkmark {
|
||||
row::with_capacity(2)
|
||||
.align_items(Alignment::Center)
|
||||
.align_y(Alignment::Center)
|
||||
.push(content)
|
||||
.push(icon::from_name("object-select-symbolic").size(24))
|
||||
.apply(Element::from)
|
||||
.apply(cosmic::widget::list::container)
|
||||
.apply(container)
|
||||
.class(cosmic::theme::Container::List)
|
||||
.padding(8)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
} else {
|
||||
cosmic::widget::list::container(content).into()
|
||||
container(content)
|
||||
.class(cosmic::theme::Container::List)
|
||||
.padding(8)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,14 +58,15 @@ impl super::Page {
|
|||
|
||||
// Displays the night light status, and a button for configuring it.
|
||||
container = container.add(
|
||||
cosmic::widget::settings::item::builder(&*super::text::NIGHT_LIGHT)
|
||||
settings::item::builder(&*super::text::NIGHT_LIGHT)
|
||||
.description(&*super::text::NIGHT_LIGHT_DESCRIPTION)
|
||||
.control(
|
||||
row()
|
||||
.align_items(Alignment::Center)
|
||||
.push(toggler(self.config.night_light_enabled, |enable| {
|
||||
Message::NightLight(NightLight::Toggle(enable))
|
||||
}))
|
||||
.align_y(Alignment::Center)
|
||||
.push(
|
||||
toggler(self.config.night_light_enabled)
|
||||
.on_toggle(Message::NightLight(NightLight::Toggle)),
|
||||
)
|
||||
.push(
|
||||
button::icon(icon::from_name("go-next-symbolic"))
|
||||
.extra_small()
|
||||
|
|
|
|||
|
|
@ -835,7 +835,7 @@ fn devices_view() -> Section<crate::pages::Message> {
|
|||
|
||||
let widget = widget::settings::item_row(vec![
|
||||
identifier.into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
controls.into(),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ fn devices_view() -> Section<crate::pages::Message> {
|
|||
|
||||
let widget = widget::settings::item_row(vec![
|
||||
identifier.into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
controls.into(),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ impl Page {
|
|||
|
||||
let widget = widget::settings::item_row(vec![
|
||||
identifier.into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
controls.into(),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use std::str::FromStr;
|
|||
use chrono::{Datelike, Timelike};
|
||||
use cosmic::{
|
||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||
iced::Length,
|
||||
iced_core::text::Wrapping,
|
||||
widget::{self, dropdown, settings},
|
||||
Apply, Element, Task,
|
||||
|
|
@ -339,7 +338,7 @@ impl Page {
|
|||
fn timezone_context_item<'a>(&self, id: usize, timezone: &'a str) -> Element<'a, Message> {
|
||||
widget::button::custom(widget::settings::item_row(vec![
|
||||
widget::text::body(timezone).wrapping(Wrapping::Word).into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
]))
|
||||
.on_press(Message::Timezone(id))
|
||||
.class(cosmic::theme::Button::Icon)
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ impl Page {
|
|||
})
|
||||
.wrapping(Wrapping::Word)
|
||||
.into(),
|
||||
widget::horizontal_space().width(Length::Fill).into(),
|
||||
widget::horizontal_space().into(),
|
||||
if is_installed {
|
||||
widget::icon::from_name("object-select-symbolic")
|
||||
.size(16)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ pub fn search_page_link<Message: 'static>(title: &str) -> button::TextButton<Mes
|
|||
pub fn page_title<Message: 'static>(page: &page::Info) -> Element<Message> {
|
||||
row::with_capacity(2)
|
||||
.push(text::title3(page.title.as_str()))
|
||||
.push(horizontal_space().width(Length::Fill))
|
||||
.push(horizontal_space())
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
@ -110,9 +110,9 @@ pub fn display_container<'a, Message: 'a>(widget: Element<'a, Message>) -> Eleme
|
|||
.class(crate::theme::display_container_frame());
|
||||
|
||||
row::with_capacity(3)
|
||||
.push(horizontal_space().width(Length::Fill))
|
||||
.push(horizontal_space())
|
||||
.push(display)
|
||||
.push(horizontal_space().width(Length::Fill))
|
||||
.push(horizontal_space())
|
||||
.padding([0, 0, 8, 0])
|
||||
.into()
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ pub fn sub_page_header<'a, Message: 'static + Clone>(
|
|||
pub fn go_next_item<Msg: Clone + 'static>(description: &str, msg: Msg) -> cosmic::Element<'_, Msg> {
|
||||
settings::item_row(vec![
|
||||
text::body(description).wrapping(Wrapping::Word).into(),
|
||||
horizontal_space().width(Length::Fill).into(),
|
||||
horizontal_space().into(),
|
||||
icon::from_name("go-next-symbolic").size(16).icon().into(),
|
||||
])
|
||||
.apply(widget::container)
|
||||
|
|
@ -208,7 +208,7 @@ pub fn go_next_with_item<'a, Msg: Clone + 'static>(
|
|||
) -> cosmic::Element<'_, Msg> {
|
||||
settings::item_row(vec![
|
||||
text::body(description).wrapping(Wrapping::Word).into(),
|
||||
horizontal_space().width(Length::Fill).into(),
|
||||
horizontal_space().into(),
|
||||
widget::row::with_capacity(2)
|
||||
.push(item)
|
||||
.push(icon::from_name("go-next-symbolic").size(16).icon())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue