feat(widget): add functions for columns and rows

This commit is contained in:
Michael Aaron Murphy 2023-09-01 07:23:24 +02:00 committed by Michael Murphy
parent e9035a9582
commit 26777464c5

View file

@ -22,9 +22,51 @@ pub use button::*;
pub mod card;
pub use card::*;
pub use column::{column, Column};
pub mod column {
pub use iced::widget::Column;
#[must_use]
pub fn column<'a, Message>() -> Column<'a, Message, crate::Renderer> {
Column::new()
}
#[must_use]
pub fn with_capacity<'a, Message>(capacity: usize) -> Column<'a, Message, crate::Renderer> {
Column::with_children(Vec::with_capacity(capacity))
}
#[must_use]
pub fn with_children<Message>(
children: Vec<crate::Element<Message>>,
) -> Column<Message, crate::Renderer> {
Column::with_children(children)
}
}
pub mod cosmic_container;
pub use cosmic_container::LayerContainer;
/// An element to distinguish a boundary between two elements.
pub mod divider {
/// Horizontal variant of a divider.
pub mod horizontal {
use iced::widget::{horizontal_rule, Rule};
/// Horizontal divider with light thickness
#[must_use]
pub fn light() -> Rule<crate::Renderer> {
horizontal_rule(4).style(crate::theme::Rule::LightDivider)
}
/// Horizontal divider with heavy thickness.
#[must_use]
pub fn heavy() -> Rule<crate::Renderer> {
horizontal_rule(10).style(crate::theme::Rule::HeavyDivider)
}
}
}
pub mod flex_row;
pub use flex_row::{flex_row, FlexRow};
@ -32,7 +74,7 @@ mod header_bar;
pub use header_bar::{header_bar, HeaderBar};
pub mod icon;
pub use icon::{icon, Icon, IconSource};
pub use icon::{icon, Icon};
#[cfg(feature = "animated-image")]
pub mod frames;
@ -51,6 +93,28 @@ pub use popover::{popover, Popover};
pub mod rectangle_tracker;
pub use row::{row, Row};
pub mod row {
pub use iced::widget::Row;
#[must_use]
pub fn row<'a, Message>() -> Row<'a, Message, crate::Renderer> {
Row::new()
}
#[must_use]
pub fn with_capacity<'a, Message>(capacity: usize) -> Row<'a, Message, crate::Renderer> {
Row::with_children(Vec::with_capacity(capacity))
}
#[must_use]
pub fn with_children<Message>(
children: Vec<crate::Element<Message>>,
) -> Row<Message, crate::Renderer> {
Row::with_children(children)
}
}
mod scrollable;
pub use scrollable::*;
@ -79,23 +143,3 @@ pub use view_switcher::vertical as vertical_view_switcher;
pub mod warning;
pub use warning::*;
/// An element to distinguish a boundary between two elements.
pub mod divider {
/// Horizontal variant of a divider.
pub mod horizontal {
use iced::widget::{horizontal_rule, Rule};
/// Horizontal divider with light thickness
#[must_use]
pub fn light() -> Rule<crate::Renderer> {
horizontal_rule(4).style(crate::theme::Rule::LightDivider)
}
/// Horizontal divider with heavy thickness.
#[must_use]
pub fn heavy() -> Rule<crate::Renderer> {
horizontal_rule(10).style(crate::theme::Rule::HeavyDivider)
}
}
}