improv: use spacing variables in more places
This commit is contained in:
parent
3c88edb217
commit
282700b987
3 changed files with 18 additions and 8 deletions
|
|
@ -4,7 +4,7 @@
|
|||
use iced_core::Padding;
|
||||
use iced_style::container::StyleSheet;
|
||||
|
||||
use crate::{widget::divider, Apply, Element};
|
||||
use crate::{theme, widget::divider, Apply, Element};
|
||||
|
||||
pub fn list_column<'a, Message: 'static>() -> ListColumn<'a, Message> {
|
||||
ListColumn::default()
|
||||
|
|
@ -21,7 +21,7 @@ pub struct ListColumn<'a, Message> {
|
|||
impl<'a, Message: 'static> Default for ListColumn<'a, Message> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
spacing: 8,
|
||||
spacing: theme::THEME.lock().unwrap().cosmic().spacing.space_xxs,
|
||||
padding: Padding::from(0),
|
||||
style: <crate::Theme as StyleSheet>::Style::List,
|
||||
children: Vec::with_capacity(4),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use crate::{
|
||||
theme,
|
||||
widget::{column, container, flex_row, horizontal_space, row, text, FlexRow, Row},
|
||||
Element,
|
||||
};
|
||||
|
|
@ -29,10 +30,13 @@ 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(12)
|
||||
.spacing(space_xs)
|
||||
.align_items(iced::Alignment::Center)
|
||||
.padding([0, 16])
|
||||
.padding([0, space_s])
|
||||
}
|
||||
|
||||
/// A settings item aligned in a flex row
|
||||
|
|
@ -50,9 +54,12 @@ 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, 16])
|
||||
.spacing(12)
|
||||
.padding([0, space_s])
|
||||
.spacing(space_xs)
|
||||
.min_item_width(200.0)
|
||||
.justify_items(iced::Alignment::Center)
|
||||
.justify_content(AlignContent::SpaceBetween)
|
||||
|
|
|
|||
|
|
@ -8,10 +8,13 @@ pub use self::item::{flex_item, flex_item_row, item, item_row};
|
|||
pub use self::section::{section, view_section, Section};
|
||||
|
||||
use crate::widget::{column, Column};
|
||||
use crate::Element;
|
||||
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> {
|
||||
column::with_children(children).spacing(24).padding([0, 24])
|
||||
let spacing = theme::THEME.lock().unwrap().cosmic().spacing;
|
||||
column::with_children(children)
|
||||
.spacing(spacing.space_m)
|
||||
.padding([0, spacing.space_m])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue