chore: re-export iced row and column

This removes the custom row and column implementations and uses the iced ones directly.
This commit is contained in:
Vukašin Vojinović 2026-04-01 23:24:53 +02:00 committed by Michael Murphy
parent a9e0671075
commit fdf3369cea
20 changed files with 103 additions and 227 deletions

View file

@ -4,7 +4,7 @@
use std::borrow::Cow;
use crate::{
Element, theme,
Element, Theme, theme,
widget::{FlexRow, Row, column, container, flex_row, row, text},
};
use derive_setters::Setters;
@ -18,12 +18,12 @@ use taffy::AlignContent;
pub fn item<'a, Message: 'static>(
title: impl Into<Cow<'a, str>> + 'a,
widget: impl Into<Element<'a, Message>> + 'a,
) -> Row<'a, Message> {
) -> Row<'a, Message, Theme> {
#[inline(never)]
fn inner<'a, Message: 'static>(
title: Cow<'a, str>,
widget: Element<'a, Message>,
) -> Row<'a, Message> {
) -> Row<'a, Message, Theme> {
item_row(vec![
text(title).wrapping(Wrapping::Word).into(),
space::horizontal().into(),
@ -37,7 +37,7 @@ pub fn item<'a, Message: 'static>(
/// A settings item aligned in a row
#[must_use]
#[allow(clippy::module_name_repetitions)]
pub fn item_row<Message>(children: Vec<Element<Message>>) -> Row<Message> {
pub fn item_row<Message>(children: Vec<Element<Message>>) -> Row<Message, Theme> {
row::with_children(children)
.spacing(theme::spacing().space_xs)
.align_y(iced::Alignment::Center)
@ -105,7 +105,7 @@ pub struct Item<'a, Message> {
impl<'a, Message: 'static> Item<'a, Message> {
/// Assigns a control to the item.
pub fn control(self, widget: impl Into<Element<'a, Message>>) -> Row<'a, Message> {
pub fn control(self, widget: impl Into<Element<'a, Message>>) -> Row<'a, Message, Theme> {
item_row(self.control_(widget.into()))
}
@ -142,7 +142,7 @@ impl<'a, Message: 'static> Item<'a, Message> {
self,
is_checked: bool,
message: impl Fn(bool) -> Message + 'static,
) -> Row<'a, Message> {
) -> Row<'a, Message, Theme> {
self.control(
crate::widget::toggler(is_checked)
.width(Length::Shrink)

View file

@ -8,10 +8,10 @@ pub use self::item::{flex_item, flex_item_row, item, item_row};
pub use self::section::{Section, section};
use crate::widget::{Column, column};
use crate::{Element, theme};
use crate::{Element, Theme, theme};
/// 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> {
pub fn view_column<Message: 'static>(children: Vec<Element<Message>>) -> Column<Message, Theme> {
column::with_children(children).spacing(theme::spacing().space_m)
}