fix(list_column): match padding/spacing to designs

This commit is contained in:
Vukašin Vojinović 2024-11-28 15:24:15 +01:00 committed by Michael Murphy
parent a6c08d68f9
commit de0c1921f7
11 changed files with 65 additions and 75 deletions

View file

@ -21,7 +21,7 @@ pub fn item<'a, Message: 'static>(
) -> Row<'a, Message> {
item_row(vec![
text(title).wrapping(Wrapping::Word).into(),
horizontal_space().width(iced::Length::Fill).into(),
horizontal_space().into(),
widget.into(),
])
}
@ -30,13 +30,9 @@ pub fn item<'a, Message: 'static>(
#[must_use]
#[allow(clippy::module_name_repetitions)]
pub fn item_row<Message>(children: Vec<Element<Message>>) -> Row<Message> {
let cosmic_theme::Spacing {
space_s, space_xs, ..
} = theme::THEME.lock().unwrap().cosmic().spacing;
row::with_children(children)
.spacing(space_xs)
.spacing(theme::active().cosmic().space_xs())
.align_y(iced::Alignment::Center)
.padding([0, space_s])
}
/// A settings item aligned in a flex row
@ -57,12 +53,8 @@ pub fn flex_item<'a, Message: 'static>(
/// A settings item aligned in a flex row
#[allow(clippy::module_name_repetitions)]
pub fn flex_item_row<Message>(children: Vec<Element<Message>>) -> FlexRow<Message> {
let cosmic_theme::Spacing {
space_s, space_xs, ..
} = theme::THEME.lock().unwrap().cosmic().spacing;
flex_row(children)
.padding([0, space_s])
.spacing(space_xs)
.spacing(theme::active().cosmic().space_xs())
.min_item_width(200.0)
.justify_items(iced::Alignment::Center)
.justify_content(AlignContent::SpaceBetween)

View file

@ -13,8 +13,5 @@ use crate::{theme, Element};
/// A column with a predefined style for creating a settings panel
#[must_use]
pub fn view_column<Message: 'static>(children: Vec<Element<Message>>) -> Column<Message> {
let space_m = theme::THEME.lock().unwrap().cosmic().spacing.space_m;
column::with_children(children)
.spacing(space_m)
.padding([0, space_m])
column::with_children(children).spacing(theme::active().cosmic().space_m())
}

View file

@ -1,7 +1,6 @@
// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
use crate::ext::CollectionWidget;
use crate::widget::{column, text, ListColumn};
use crate::Element;
use std::borrow::Cow;