licence + column

This commit is contained in:
wiiznokes 2024-07-02 17:53:59 +02:00
parent aab22435ea
commit 5bd1303d3e
2 changed files with 10 additions and 4 deletions

View file

@ -1,5 +1,5 @@
// Copyright 2024 wiiznokes // Copyright 2024 wiiznokes
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MPL-2.0
//! A widget that displays toasts. //! A widget that displays toasts.
@ -14,6 +14,7 @@ use widget::Toaster;
use crate::ext::CollectionWidget; use crate::ext::CollectionWidget;
use super::column;
use super::{button, row, text}; use super::{button, row, text};
mod widget; mod widget;
@ -40,8 +41,13 @@ where
.style(crate::style::Container::Card) .style(crate::style::Container::Card)
}; };
let col = let col = toasts
Column::with_children(toasts.toasts.iter().rev().map(|t| make_toast(t).into())).spacing(5); .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() Toaster::new(col.into(), content.into(), toasts.toasts.is_empty()).into()
} }

View file

@ -1,5 +1,5 @@
// Copyright 2024 wiiznokes // Copyright 2024 wiiznokes
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MPL-2.0
use iced::{Limits, Size}; use iced::{Limits, Size};
use iced_core::layout::Node; use iced_core::layout::Node;