Infinite List widget from upstream feature/list-widget-reloaded branch

This commit is contained in:
Héctor Ramón Jiménez 2024-05-04 13:34:41 +02:00 committed by Ashley Wulber
parent 6829724ac0
commit 0b068e486e
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
6 changed files with 932 additions and 0 deletions

View file

@ -10,6 +10,7 @@ use crate::core::window;
use crate::core::{Element, Length, Size, Widget};
use crate::float::{self, Float};
use crate::keyed;
use crate::list::{self, List};
use crate::overlay;
use crate::pane_grid::{self, PaneGrid};
use crate::pick_list::{self, PickList};
@ -1054,6 +1055,18 @@ where
Scrollable::new(content)
}
/// Creates a new [`List`] with the provided [`Content`] and
/// closure to view an item of the [`List`].
///
/// [`List`]: crate::List
/// [`Content`]: crate::list::Content
pub fn list<'a, T, Message, Theme, Renderer>(
content: &'a list::Content<T>,
view_item: impl Fn(usize, &'a T) -> Element<'a, Message, Theme, Renderer> + 'a,
) -> List<'a, T, Message, Theme, Renderer> {
List::new(content, view_item)
}
/// Creates a new [`Button`] with the provided content.
///
/// # Example