From 5bd1303d3e5be6af0f299866f5f4997f96026326 Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Tue, 2 Jul 2024 17:53:59 +0200 Subject: [PATCH] licence + column --- src/widget/toaster/mod.rs | 12 +++++++++--- src/widget/toaster/widget.rs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/widget/toaster/mod.rs b/src/widget/toaster/mod.rs index 8a7e1e41..b61038fe 100644 --- a/src/widget/toaster/mod.rs +++ b/src/widget/toaster/mod.rs @@ -1,5 +1,5 @@ // Copyright 2024 wiiznokes -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: MPL-2.0 //! A widget that displays toasts. @@ -14,6 +14,7 @@ use widget::Toaster; use crate::ext::CollectionWidget; +use super::column; use super::{button, row, text}; mod widget; @@ -40,8 +41,13 @@ where .style(crate::style::Container::Card) }; - let col = - Column::with_children(toasts.toasts.iter().rev().map(|t| make_toast(t).into())).spacing(5); + let col = toasts + .toasts + .iter() + .rev() + .map(make_toast) + .fold(column::with_capacity(toasts.toasts.len()), Column::push) + .spacing(crate::theme::active().cosmic().space_xxxs()); Toaster::new(col.into(), content.into(), toasts.toasts.is_empty()).into() } diff --git a/src/widget/toaster/widget.rs b/src/widget/toaster/widget.rs index f76da9b3..c1137732 100644 --- a/src/widget/toaster/widget.rs +++ b/src/widget/toaster/widget.rs @@ -1,5 +1,5 @@ // Copyright 2024 wiiznokes -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: MPL-2.0 use iced::{Limits, Size}; use iced_core::layout::Node;