fix: condensed padding

This commit is contained in:
Vukašin Vojinović 2024-11-01 02:18:38 +01:00 committed by Michael Murphy
parent ef051c3b13
commit d9735c9b76
15 changed files with 246 additions and 209 deletions

View file

@ -1082,7 +1082,7 @@ impl SettingsApp {
let theme = cosmic::theme::active();
let padding = if self.core.is_condensed() {
theme.cosmic().space_xxs()
theme.cosmic().space_s()
} else {
theme.cosmic().space_l()
};

View file

@ -1,7 +1,7 @@
// Copyright 2024 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::iced::{alignment, color, Length};
use cosmic::iced::{color, Alignment, Length};
use cosmic::iced_core::text::Wrapping;
use cosmic::widget::{self, settings, text};
use cosmic::Task;
@ -121,7 +121,7 @@ impl page::Page<crate::pages::Message> for Page {
let pin = widget::text::title1(itoa::Buffer::new().format(*passkey).to_owned())
.width(Length::Fill)
.align_x(alignment::Horizontal::Center)
.align_x(Alignment::Center)
.wrapping(Wrapping::None);
let control = widget::column::with_capacity(2)
@ -641,7 +641,7 @@ fn popup_button(message: Option<Message>, text: &str) -> Element<'_, Message> {
let theme = cosmic::theme::active();
let theme = theme.cosmic();
widget::text::body(text)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.apply(widget::button::custom)
.padding([theme.space_xxxs(), theme.space_xs()])
.width(Length::Fill)

View file

@ -17,7 +17,7 @@ use cosmic::cosmic_theme::{
CornerRadii, Density, Spacing, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID,
LIGHT_THEME_BUILDER_ID,
};
use cosmic::iced_core::{alignment, Color, Length};
use cosmic::iced_core::{Alignment, Color, Length};
use cosmic::iced_widget::scrollable::{Direction, Scrollbar};
use cosmic::widget::icon::{from_name, icon};
use cosmic::widget::{
@ -1431,7 +1431,7 @@ impl page::Page<crate::pages::Message> for Page {
.push(button::standard(fl!("export")).on_press(Message::StartExport))
.apply(container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Right)
.align_x(Alignment::End)
.apply(Element::from)
.map(crate::pages::Message::Appearance);
@ -1609,7 +1609,7 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
]
.spacing(space_xxs)
.width(Length::FillPortion(1))
.align_x(cosmic::iced_core::Alignment::Center),
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
icon(light_mode_illustration.clone(),)
@ -1624,14 +1624,13 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
]
.spacing(space_xxs)
.width(Length::FillPortion(1))
.align_x(cosmic::iced_core::Alignment::Center)
.align_x(Alignment::Center)
]
.spacing(48)
.align_y(cosmic::iced_core::Alignment::Center)
.align_y(Alignment::Center)
.width(Length::Fixed(424.0)),
)
.width(Length::Fill)
.align_x(cosmic::iced_core::alignment::Horizontal::Center),
.center_x(Length::Fill),
)
.add(
settings::item::builder(&descriptions[auto_switch])
@ -1864,7 +1863,7 @@ pub fn style() -> Section<crate::pages::Message> {
]
.spacing(8)
.width(Length::FillPortion(1))
.align_x(cosmic::iced_core::Alignment::Center),
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
icon(
@ -1886,7 +1885,7 @@ pub fn style() -> Section<crate::pages::Message> {
]
.spacing(8)
.width(Length::FillPortion(1))
.align_x(cosmic::iced_core::Alignment::Center),
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
icon(
@ -1908,15 +1907,14 @@ pub fn style() -> Section<crate::pages::Message> {
text::body(&descriptions[square])
]
.spacing(8)
.align_x(cosmic::iced_core::Alignment::Center)
.align_x(Alignment::Center)
.width(Length::FillPortion(1))
]
.spacing(12)
.width(Length::Fixed(628.0))
.align_y(cosmic::iced_core::Alignment::Center),
.align_y(Alignment::Center),
)
.width(Length::Fill)
.align_x(cosmic::iced_core::alignment::Horizontal::Center),
.center_x(Length::Fill),
)
.apply(Element::from)
.map(crate::pages::Message::Appearance)

View file

@ -1,6 +1,6 @@
use cosmic::{
cosmic_config::CosmicConfigEntry,
iced::{alignment, Length},
iced::{Alignment, Length},
widget::{button, container, row},
Apply, Element, Task,
};
@ -82,17 +82,16 @@ impl page::Page<crate::pages::Message> for Page {
}
fn header_view(&self) -> Option<Element<'_, crate::pages::Message>> {
let theme = cosmic::theme::active();
let spacing = theme.cosmic().spacing;
let space_xxs = cosmic::theme::active().cosmic().spacing.space_xxs;
let content = row::with_capacity(2)
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.push(
button::standard(fl!("add-applet"))
.on_press(Message(applets_inner::Message::AddAppletDrawer)),
)
.apply(container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Right)
.align_x(Alignment::End)
.apply(Element::from)
.map(crate::pages::Message::DockApplet);

View file

@ -4,7 +4,7 @@ use cosmic::iced::clipboard::dnd::{
};
use cosmic::iced::clipboard::mime::AsMimeTypes;
use cosmic::iced::id::Internal;
use cosmic::iced::{alignment, Vector};
use cosmic::iced::Vector;
use cosmic::iced_core;
use cosmic::widget::{button, column, container, icon, list_column, row, text, text_input, Column};
@ -12,9 +12,8 @@ use cosmic::widget::{button, column, container, icon, list_column, row, text, te
use cosmic::{
cosmic_config::{Config, CosmicConfigEntry},
iced::{
alignment::{Horizontal, Vertical},
core::window,
event, mouse, overlay, touch, Alignment, Color, Length, Point, Rectangle, Size,
core::window, event, mouse, overlay, touch, Alignment, Color, Length, Point, Rectangle,
Size,
},
iced_runtime::{core::id::Id, Task},
iced_widget::core::{
@ -120,14 +119,13 @@ impl page::Page<crate::pages::Message> for Page {
}
fn header_view(&self) -> Option<Element<'_, crate::pages::Message>> {
let theme = cosmic::theme::active();
let spacing = theme.cosmic().spacing;
let space_xxs = theme::active().cosmic().spacing.space_xxs;
let content = row::with_capacity(2)
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.push(button::standard(fl!("add-applet")).on_press(Message::AddAppletDrawer))
.apply(container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Right)
.align_x(Alignment::End)
.apply(Element::from)
.map(crate::pages::Message::PanelApplet);
@ -226,7 +224,13 @@ impl Page {
&self,
msg_map: T,
) -> Element<crate::pages::Message> {
let spacing = cosmic::theme::active().cosmic().spacing;
let cosmic::cosmic_theme::Spacing {
space_xxxs,
space_xxs,
space_xs,
space_l,
..
} = theme::active().cosmic().spacing;
let mut list_column = list_column();
let mut has_some = false;
for info in self
@ -259,7 +263,7 @@ impl Page {
column::with_capacity(2)
.push(text::body(info.name.clone()))
.push(text::caption(info.description.clone()))
.spacing(spacing.space_xxxs)
.spacing(space_xxxs)
.width(Length::Fill)
.into(),
button::standard(fl!("add"))
@ -291,8 +295,8 @@ impl Page {
.on_press(msg_map(Message::AddApplet(info.clone())))
.into(),
])
.padding([0, spacing.space_l])
.spacing(spacing.space_xs)
.padding([0, space_l])
.spacing(space_xs)
.align_y(Alignment::Center),
);
}
@ -300,7 +304,7 @@ impl Page {
list_column = list_column.add(
text::body(fl!("no-applets-found"))
.width(Length::Fill)
.align_x(Horizontal::Center),
.align_x(Alignment::Center),
);
}
@ -313,7 +317,7 @@ impl Page {
list_column.into(),
])
.align_x(Alignment::Center)
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.into()
}
@ -456,7 +460,12 @@ pub fn lists<
msg_map: T,
) -> Section<crate::pages::Message> {
Section::default().view::<P>(move |_binder, page, _section| {
let spacing = cosmic::theme::active().cosmic().spacing;
let cosmic::cosmic_theme::Spacing {
space_xxs,
space_xs,
space_s,
..
} = theme::active().cosmic().spacing;
let page = page.inner();
let Some(config) = page.current_config.as_ref() else {
return Element::from(text::body(fl!("unknown")));
@ -492,7 +501,7 @@ pub fn lists<
)
.into(),
])
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.into(),
column::with_children(vec![
text::body(fl!("center-segment")).into(),
@ -522,7 +531,7 @@ pub fn lists<
)
.into(),
])
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.into(),
column::with_children(vec![
text::body(fl!("end-segment")).into(),
@ -553,11 +562,11 @@ pub fn lists<
)
.into(),
])
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.into(),
])
.padding([0, spacing.space_s])
.spacing(spacing.space_xs)
.padding([0, space_s])
.spacing(space_xs)
.apply(Element::from)
.map(msg_map)
})
@ -651,7 +660,12 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
on_cancel: Message,
active_dnd: Option<Applet<'a>>,
) -> Self {
let spacing = cosmic::theme::active().cosmic().spacing;
let cosmic::cosmic_theme::Spacing {
space_xxxs,
space_xxs,
space_xs,
..
} = theme::active().cosmic().spacing;
let applet_buttons = info
.clone()
.into_iter()
@ -666,7 +680,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
.into(),
icon::from_name(info.icon).size(32).into(),
column::with_capacity(2)
.spacing(spacing.space_xxxs)
.spacing(space_xxxs)
.width(Length::Fill)
.push(text::body(info.name))
.push_maybe(if info.description.is_empty() {
@ -680,7 +694,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
.on_press(on_remove(id_clone.clone()))
.into(),
])
.spacing(spacing.space_xs)
.spacing(space_xs)
.align_y(Alignment::Center),
)
.width(Length::Fill)
@ -711,8 +725,8 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
text::body(fl!("drop-here"))
.width(Length::Fill)
.height(Length::Fill)
.align_y(Vertical::Center)
.align_x(Horizontal::Center),
.align_y(Alignment::Center)
.align_x(Alignment::Center),
)
.width(Length::Fill)
.height(Length::Fixed(48.0))
@ -728,7 +742,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
.into()
} else {
Column::with_children(applet_buttons)
.spacing(spacing.space_xxs)
.spacing(space_xxs)
.into()
},
active_applet_offer: active_dnd,
@ -746,7 +760,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
pos: Point,
offered_applet: Applet<'a>,
) -> Vec<Applet<'a>> {
let spacing = cosmic::theme::active().cosmic().spacing;
let space_xxs = theme::active().cosmic().spacing.space_xxs;
let mut reordered: Vec<_> = self.info.clone();
if !layout.bounds().contains(pos) {
@ -767,8 +781,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
return reordered;
}
let height = (layout.bounds().height
- spacing.space_xxs as f32 * (self.info.len() - 1) as f32)
let height = (layout.bounds().height - space_xxs as f32 * (self.info.len() - 1) as f32)
/ self.info.len() as f32;
let mut found = false;
@ -778,7 +791,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> {
if i == 0 || i == reordered.len() {
y += height / 2.0;
} else {
y += height + spacing.space_xxs as f32;
y += height + space_xxs as f32;
}
if pos.y <= y {
reordered.insert(i, offered_applet.clone());
@ -926,7 +939,7 @@ where
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
) -> event::Status {
let spacing = cosmic::theme::active().cosmic().spacing;
let space_xxs = theme::active().cosmic().spacing.space_xxs;
let mut ret = match self.inner.as_widget_mut().on_event(
&mut tree.children[0],
event.clone(),
@ -942,7 +955,7 @@ where
};
let height = (layout.bounds().height
- spacing.space_xxs as f32 * (self.info.len().saturating_sub(1)) as f32)
- space_xxs as f32 * (self.info.len().saturating_sub(1)) as f32)
/ self.info.len() as f32;
let state = tree.state.downcast_mut::<ReorderWidgetState>();
@ -995,8 +1008,7 @@ where
self.info.iter().enumerate().find(|(i, _)| {
start.y
< layout.bounds().y
+ (*i + 1) as f32
* (height + spacing.space_xxs as f32)
+ (*i + 1) as f32 * (height + space_xxs as f32)
})
{
let applet = applet.clone().into_owned();

View file

@ -16,19 +16,17 @@ use std::{
#[cfg(feature = "xdg-portal")]
use cosmic::dialog::file_chooser;
use cosmic::iced::{Color, Length};
use cosmic::iced::{Alignment, Color, Length};
use cosmic::iced_runtime::core::image::Handle as ImageHandle;
use cosmic::widget::{
button, dropdown, list_column, row,
segmented_button::{self, SingleSelectModel},
settings, tab_bar, text, toggler,
};
use cosmic::{iced_core::alignment, iced_runtime::core::image::Handle as ImageHandle};
use cosmic::{iced_core::Alignment, widget::icon};
use cosmic::{
widget::{color_picker::ColorPickerUpdate, ColorPickerModel},
Element,
widget::{color_picker::ColorPickerUpdate, icon, ColorPickerModel},
Apply, Element, Task,
};
use cosmic::{Apply, Task};
use cosmic_bg_config::Source;
use cosmic_settings_page::Section;
use cosmic_settings_page::{self as page, section};
@ -1214,10 +1212,9 @@ pub fn settings() -> Section<crate::pages::Message> {
));
if page.wallpaper_service_config.same_on_all {
let element = text(fl!("all-displays"))
.font(cosmic::font::semibold())
.align_x(alignment::Horizontal::Center)
.align_y(alignment::Vertical::Center)
let element = text::heading(fl!("all-displays"))
.align_x(Alignment::Center)
.align_y(Alignment::Center)
.width(Length::Fill)
.height(Length::Fill)
.apply(cosmic::widget::container)
@ -1374,7 +1371,7 @@ pub fn settings() -> Section<crate::pages::Message> {
// .push(content)
// .width(Length::Fill)
// .height(Length::Fill)
// .align_items(cosmic::iced_core::Alignment::Center)
// .align_y(Alignment::Center)
// .apply(Element::from)
// }

View file

@ -4,7 +4,7 @@ use std::cmp;
use cosmic::{
cosmic_config::{self, ConfigSet},
iced::{self, Length},
iced::{Alignment, Color, Length},
iced_core::Border,
theme,
widget::{self, button, container, icon, radio, row, settings, ListColumn},
@ -203,7 +203,7 @@ fn popover_menu(id: DefaultKey) -> cosmic::Element<'static, Message> {
container::Style {
icon_color: Some(theme.cosmic().background.on.into()),
text_color: Some(theme.cosmic().background.on.into()),
background: Some(iced::Color::from(theme.cosmic().background.base).into()),
background: Some(Color::from(theme.cosmic().background.base).into()),
border: Border {
radius: cosmic.corner_radii.radius_m.into(),
..Default::default()
@ -654,7 +654,7 @@ fn input_sources() -> Section<crate::pages::Message> {
.push(
widget::container(add_input_source)
.width(Length::Fill)
.align_x(iced::alignment::Horizontal::Right),
.align_x(Alignment::End),
)
.apply(Element::from)
.map(crate::pages::Message::Keyboard)
@ -752,7 +752,7 @@ fn keyboard_typing_assist() -> Section<crate::pages::Message> {
.max_width(250);
row::with_capacity(3)
.align_y(iced::Alignment::Center)
.align_y(Alignment::Center)
.spacing(theme.cosmic().space_s())
.push(widget::text::body(&descriptions[short]))
.push(delay_slider)
@ -772,7 +772,7 @@ fn keyboard_typing_assist() -> Section<crate::pages::Message> {
.max_width(250);
row::with_capacity(3)
.align_y(iced::Alignment::Center)
.align_y(Alignment::Center)
.spacing(theme.cosmic().space_s())
.push(widget::text::body(&descriptions[slow]))
.push(rate_slider)

View file

@ -1,4 +1,3 @@
use cosmic::iced::alignment::Horizontal;
use cosmic::iced::{Alignment, Length};
use cosmic::widget::{self, button, icon, settings, text};
use cosmic::{theme, Apply, Element, Task};
@ -546,7 +545,7 @@ fn context_drawer(
.spacing(space_xs)
.apply(widget::container)
.width(Length::Fill)
.align_x(Horizontal::Right);
.align_x(Alignment::End);
widget::column::with_capacity(if show_action { 3 } else { 2 })
.spacing(space_l)

View file

@ -1,8 +1,8 @@
use std::str::FromStr;
use super::{ShortcutBinding, ShortcutMessage, ShortcutModel};
use cosmic::iced::alignment::Horizontal;
use cosmic::iced::Length;
use cosmic::iced::{Alignment, Length};
use cosmic::widget::{self, button, icon};
use cosmic::{Apply, Element, Task};
use cosmic_settings_config::shortcuts::{Action, Shortcuts};
@ -279,7 +279,7 @@ impl Page {
.on_press(Message::AddShortcut)
.apply(widget::container)
.width(Length::Fill)
.align_x(Horizontal::Right);
.align_x(Alignment::End);
widget::column()
.spacing(32)
@ -435,7 +435,7 @@ fn shortcuts() -> Section<crate::pages::Message> {
.on_press(Message::ShortcutContext)
.apply(widget::container)
.width(Length::Fill)
.align_x(Horizontal::Right);
.align_x(Alignment::End);
widget::column()
.push(content)

View file

@ -8,7 +8,7 @@ use std::sync::Arc;
use anyhow::Context;
use ashpd::desktop::file_chooser::FileFilter;
use cosmic::{
iced::{alignment, Length},
iced::{Alignment, Length},
iced_core::text::Wrapping,
widget::{self, icon},
Apply, Element, Task,
@ -324,7 +324,7 @@ impl page::Page<crate::pages::Message> for Page {
.on_press(Message::AddNetwork)
.apply(widget::container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Right)
.align_x(Alignment::End)
.apply(Element::from)
.map(crate::pages::Message::Vpn),
)
@ -781,7 +781,7 @@ fn devices_view() -> Section<crate::pages::Message> {
widget::button::text(connect_txt).on_press(msg).into()
} else {
widget::text::body(connect_txt)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.into()
};
@ -826,7 +826,7 @@ fn devices_view() -> Section<crate::pages::Message> {
let controls = widget::row::with_capacity(2)
.push(connect)
.push_maybe(view_more)
.align_y(alignment::Alignment::Center)
.align_y(Alignment::Center)
.spacing(spacing.space_xxs);
let widget = widget::settings::item_row(vec![
@ -852,7 +852,7 @@ fn popup_button(message: Message, text: &str) -> Element<'_, Message> {
let theme = cosmic::theme::active();
let theme = theme.cosmic();
widget::text::body(text)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.apply(widget::button::custom)
.padding([theme.space_xxxs(), theme.space_xs()])
.width(Length::Fill)

View file

@ -8,7 +8,7 @@ use std::{
use anyhow::Context;
use cosmic::{
iced::{alignment, Length},
iced::{Alignment, Length},
iced_core::text::Wrapping,
widget::{self, icon},
Apply, Element, Task,
@ -193,7 +193,7 @@ impl page::Page<crate::pages::Message> for Page {
.on_press(Message::AddNetwork)
.apply(widget::container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Right)
.align_x(Alignment::End)
.apply(Element::from)
.map(crate::pages::Message::WiFi),
)
@ -545,10 +545,9 @@ fn devices_view() -> Section<crate::pages::Message> {
.push(icon::from_name("airplane-mode-symbolic"))
.push(widget::text::body(&section.descriptions[airplane_mode_txt]))
.spacing(8)
.align_y(alignment::Alignment::Center)
.align_y(Alignment::Center)
.apply(widget::container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Center)
.center_x(Length::Fill)
}));
if !state.airplane_mode
@ -557,8 +556,7 @@ fn devices_view() -> Section<crate::pages::Message> {
{
let no_networks_found =
widget::container(widget::text::body(&section.descriptions[no_networks_txt]))
.align_x(alignment::Horizontal::Center)
.width(Length::Fill);
.center_x(Length::Fill);
view = view.push(no_networks_found);
} else {
@ -622,7 +620,7 @@ fn devices_view() -> Section<crate::pages::Message> {
widget::button::text(connect_txt).on_press(msg).into()
} else {
widget::text::body(connect_txt)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.into()
};
@ -671,7 +669,7 @@ fn devices_view() -> Section<crate::pages::Message> {
let controls = widget::row::with_capacity(2)
.push(connect)
.push_maybe(view_more)
.align_y(alignment::Alignment::Center)
.align_y(Alignment::Center)
.spacing(spacing.space_xxs);
let widget = widget::settings::item_row(vec![
@ -721,7 +719,7 @@ fn popup_button(message: Message, text: &str) -> Element<'_, Message> {
let theme = cosmic::theme::active();
let theme = theme.cosmic();
widget::text::body(text)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.apply(widget::button::custom)
.padding([theme.space_xxxs(), theme.space_xs()])
.width(Length::Fill)

View file

@ -5,7 +5,7 @@ use std::{collections::BTreeSet, sync::Arc};
use anyhow::Context;
use cosmic::{
iced::{alignment, Length},
iced::{Alignment, Length},
iced_core::text::Wrapping,
widget::{self, icon},
Apply, Element, Task,
@ -149,7 +149,7 @@ impl page::Page<crate::pages::Message> for Page {
.on_press(Message::AddNetwork)
.apply(widget::container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Right)
.align_x(Alignment::End)
.apply(Element::from)
.map(crate::pages::Message::Wired),
)
@ -487,7 +487,7 @@ impl Page {
widget::button::text(connect_txt).on_press(msg).into()
} else {
widget::text::body(connect_txt)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.into()
};
@ -535,7 +535,7 @@ impl Page {
let controls = widget::row::with_capacity(2)
.push(connect)
.push_maybe(view_more)
.align_y(alignment::Alignment::Center)
.align_y(Alignment::Center)
.spacing(spacing.space_xxs);
let widget = widget::settings::item_row(vec![
@ -607,7 +607,7 @@ fn popup_button(message: Message, text: &str) -> Element<'_, Message> {
let theme = cosmic::theme::active();
let theme = theme.cosmic();
widget::text::body(text)
.align_y(alignment::Vertical::Center)
.align_y(Alignment::Center)
.apply(widget::button::custom)
.padding([theme.space_xxxs(), theme.space_xs()])
.width(Length::Fill)

View file

@ -386,6 +386,7 @@ fn power_saving() -> Section<crate::pages::Message> {
.title(fl!("power-saving"))
.descriptions(descriptions)
.view::<Page>(move |_binder, page, section| {
let descriptions = &section.descriptions;
let screen_off_time = page
.idle_conf
.screen_off_time
@ -398,17 +399,17 @@ fn power_saving() -> Section<crate::pages::Message> {
.idle_conf
.suspend_on_battery_time
.map(|t| Duration::from_millis(t.into()));
let mut section_view = settings::section()
let mut section = settings::section()
.title(&section.title)
.add(power_saving_row(
&section.descriptions[turn_off_screen_desc],
&descriptions[turn_off_screen_desc],
&page.screen_off_labels,
screen_off_time,
SCREEN_OFF_TIMES,
Message::ScreenOffTimeChange,
))
.add(power_saving_row(
&section.descriptions[if page.battery.is_present {
&descriptions[if page.battery.is_present {
auto_suspend_ac_desc
} else {
auto_suspend_desc
@ -419,15 +420,15 @@ fn power_saving() -> Section<crate::pages::Message> {
Message::SuspendOnAcTimeChange,
));
if page.battery.is_present {
section_view = section_view.add(power_saving_row(
&section.descriptions[auto_suspend_battery_desc],
section = section.add(power_saving_row(
&descriptions[auto_suspend_battery_desc],
&page.suspend_labels,
suspend_on_battery_time,
SUSPEND_TIMES,
Message::SuspendOnBatteryTimeChange,
));
}
section_view
section
.apply(cosmic::Element::from)
.map(crate::pages::Message::Power)
})

View file

@ -4,7 +4,7 @@
use std::borrow::Cow;
use cosmic::cosmic_theme::Spacing;
use cosmic::iced::{alignment, Length};
use cosmic::iced::{Alignment, Length};
use cosmic::iced_core::text::Wrapping;
use cosmic::widget::color_picker::ColorPickerUpdate;
use cosmic::widget::{
@ -37,13 +37,12 @@ pub fn color_picker_context_view<'a, Message: Clone + 'static>(
)
.apply(container)
.width(Length::Fixed(248.0))
.align_x(alignment::Horizontal::Center)
.align_x(Alignment::Center)
.apply(container)
.width(Length::Fill)
.align_x(alignment::Horizontal::Center),
.center_x(Length::Fill),
)
.padding(spacing.space_l)
.align_x(cosmic::iced_core::Alignment::Center)
.align_x(Alignment::Center)
.spacing(spacing.space_m)
.width(Length::Fill)
.apply(Element::from)
@ -147,13 +146,13 @@ pub fn page_list_item<'a, Message: 'static + Clone>(
row::with_capacity(2)
.push(text::body(info))
.push(container(icon::from_name("go-next-symbolic").size(20)).padding(8))
.align_y(alignment::Alignment::Center),
.align_y(Alignment::Center),
)
.padding(0)
.spacing(space_xxs)
.apply(container)
.padding([space_s, space_m])
.align_x(alignment::Horizontal::Center)
.align_x(Alignment::Center)
.class(theme::Container::List)
.apply(button::custom)
.padding(0)
@ -211,7 +210,7 @@ pub fn go_next_with_item<'a, Msg: Clone + 'static>(
widget::row::with_capacity(2)
.push(item)
.push(icon::from_name("go-next-symbolic").size(16).icon())
.align_y(alignment::Alignment::Center)
.align_y(Alignment::Center)
.spacing(cosmic::theme::active().cosmic().spacing.space_s)
.into(),
])