improv(about): use ListButton
This commit is contained in:
parent
8d7bcab258
commit
c423ad1bfc
2 changed files with 23 additions and 13 deletions
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use crate::Element;
|
||||
use crate::widget::list_column::IntoListItem;
|
||||
use crate::widget::{ListColumn, column, text};
|
||||
use crate::widget::{ListColumn, column, list_column, text};
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// A section within a settings view column.
|
||||
|
|
@ -11,6 +11,11 @@ pub fn section<'a, Message: Clone + 'static>() -> Section<'a, Message> {
|
|||
with_column(ListColumn::default())
|
||||
}
|
||||
|
||||
/// A section with a pre-defined list column of a given capacity.
|
||||
pub fn with_capacity<'a, Message: Clone + 'static>(capacity: usize) -> Section<'a, Message> {
|
||||
with_column(list_column::with_capacity(capacity))
|
||||
}
|
||||
|
||||
/// A section with a pre-defined list column.
|
||||
pub fn with_column<Message: Clone + 'static>(
|
||||
children: ListColumn<'_, Message>,
|
||||
|
|
@ -47,7 +52,7 @@ impl<'a, Message: Clone + 'static> Section<'a, Message> {
|
|||
}
|
||||
|
||||
/// Add a child element to the section's list column, if `Some`.
|
||||
pub fn add_maybe(self, item: Option<impl Into<Element<'a, Message>>>) -> Self {
|
||||
pub fn add_maybe(self, item: Option<impl IntoListItem<'a, Message>>) -> Self {
|
||||
if let Some(item) = item {
|
||||
self.add(item)
|
||||
} else {
|
||||
|
|
@ -58,7 +63,7 @@ impl<'a, Message: Clone + 'static> Section<'a, Message> {
|
|||
/// Extends the [`Section`] with the given children.
|
||||
pub fn extend(
|
||||
self,
|
||||
children: impl IntoIterator<Item = impl Into<Element<'a, Message>>>,
|
||||
children: impl IntoIterator<Item = impl IntoListItem<'a, Message>>,
|
||||
) -> Self {
|
||||
children.into_iter().fold(self, Self::add)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue