Skip to main content

SliverReorderableList

Struct SliverReorderableList 

Source
pub struct SliverReorderableList {
Show 14 fields pub key: Option<KeyRef>, pub item_builder: IndexedWidgetBuilder, pub find_child_index_callback: Option<ChildIndexGetter>, pub item_count: i32, pub on_reorder: Option<ReorderCallback>, pub on_reorder_item: Option<ReorderCallback>, pub on_reorder_start: Option<ReorderIndexCallback>, pub on_reorder_end: Option<ReorderIndexCallback>, pub proxy_decorator: Option<ReorderItemProxyDecorator>, pub item_extent: Option<f64>, pub item_extent_builder: Option<ItemExtentBuilder>, pub prototype_item: Option<WidgetRef>, pub auto_scroller_velocity_scalar: f64, pub drag_boundary_provider: Option<ReorderDragBoundaryProvider>,
}
Expand description

A sliver list that allows the user to interactively reorder the list items.

It is up to the application to wrap each child (or an internal part of the child) with a drag listener that will recognize the start of an item drag and then start the reorder by calling SliverReorderableListState::start_item_drag_reorder. This is most easily achieved by wrapping each child in a ReorderableDragStartListener or a ReorderableDelayedDragStartListener. These will take care of recognizing the start of a drag gesture and call the list state’s start item drag method.

This widget’s SliverReorderableListState can be used to manually start an item reorder, or cancel a current drag that’s already underway. To refer to the SliverReorderableListState either provide a GlobalKey or use the static SliverReorderableList::of method from an item’s build method.

See also:

  • ReorderableList, a regular widget list that allows the user to reorder its items.
  • ReorderableListView, a Material Design list that allows the user to reorder its items.

Fields§

§key: Option<KeyRef>§item_builder: IndexedWidgetBuilder

Called, as needed, to build list item widgets; see ReorderableList::item_builder.

§find_child_index_callback: Option<ChildIndexGetter>

Called to find the new index of a child based on its key in case of reordering.

§item_count: i32

The number of items in the list; see ReorderableList::item_count.

§on_reorder: Option<ReorderCallback>§on_reorder_item: Option<ReorderCallback>§on_reorder_start: Option<ReorderIndexCallback>§on_reorder_end: Option<ReorderIndexCallback>§proxy_decorator: Option<ReorderItemProxyDecorator>§item_extent: Option<f64>§item_extent_builder: Option<ItemExtentBuilder>§prototype_item: Option<WidgetRef>§auto_scroller_velocity_scalar: f64

The velocity scalar per pixel over scroll of the auto scroller.

Defaults to 50 if not set or set to None.

§drag_boundary_provider: Option<ReorderDragBoundaryProvider>

Implementations§

Source§

impl SliverReorderableList

Source

pub fn new( item_builder: impl Fn(&mut App, BuildContext, i32) -> WidgetRef + 'static, item_count: i32, ) -> SliverReorderableList

Creates a sliver list that allows the user to interactively reorder its items.

The item_count must be greater than or equal to zero.

Source

pub fn from_builder( item_builder: IndexedWidgetBuilder, item_count: i32, ) -> SliverReorderableList

new from a shared builder, which ReorderableList passes on.

Source

pub fn key(self, key: KeyRef) -> SliverReorderableList

Dart SliverReorderableList(key:).

Source

pub fn find_child_index_callback( self, find_child_index_callback: impl Fn(&KeyRef) -> Option<i32> + 'static, ) -> SliverReorderableList

Dart SliverReorderableList(findChildIndexCallback:).

Source

pub fn on_reorder( self, on_reorder: impl Fn(&mut App, i32, i32) + 'static, ) -> SliverReorderableList

👎Deprecated:

Use the on_reorder_item callback instead. The on_reorder_item callback adjusts the new_index parameter for a removed item at the old_index.

Dart SliverReorderableList(onReorder:).

Source

pub fn on_reorder_item( self, on_reorder_item: impl Fn(&mut App, i32, i32) + 'static, ) -> SliverReorderableList

Dart SliverReorderableList(onReorderItem:).

Source

pub fn on_reorder_start( self, on_reorder_start: impl Fn(&mut App, i32) + 'static, ) -> SliverReorderableList

Dart SliverReorderableList(onReorderStart:).

Source

pub fn on_reorder_end( self, on_reorder_end: impl Fn(&mut App, i32) + 'static, ) -> SliverReorderableList

Dart SliverReorderableList(onReorderEnd:).

Source

pub fn item_extent(self, item_extent: f64) -> SliverReorderableList

Dart SliverReorderableList(itemExtent:).

Source

pub fn item_extent_builder( self, item_extent_builder: ItemExtentBuilder, ) -> SliverReorderableList

Dart SliverReorderableList(itemExtentBuilder:).

Source

pub fn prototype_item<K>( self, prototype_item: impl IntoWidget<K>, ) -> SliverReorderableList

Dart SliverReorderableList(prototypeItem:).

Source

pub fn proxy_decorator( self, proxy_decorator: impl Fn(&mut App, WidgetRef, i32, AnimationRef<f64>) -> WidgetRef + 'static, ) -> SliverReorderableList

Dart SliverReorderableList(proxyDecorator:).

Source

pub fn drag_boundary_provider( self, drag_boundary_provider: impl Fn(&mut App, BuildContext) -> Option<Box<dyn DragBoundaryDelegate<Rect>>> + 'static, ) -> SliverReorderableList

Dart SliverReorderableList(dragBoundaryProvider:).

Source

pub fn auto_scroller_velocity_scalar(self, value: f64) -> SliverReorderableList

Dart SliverReorderableList(autoScrollerVelocityScalar:).

Source

pub fn of( app: &App, context: BuildContext, ) -> Handle<SliverReorderableListState>

The state from the closest instance of this class that encloses the given context.

This method is typically used by SliverReorderableList item widgets to start or cancel an item drag operation.

If no SliverReorderableList surrounds the context given, this function will panic.

This method can be expensive (it walks the element tree).

See also:

Source

pub fn maybe_of( app: &App, context: BuildContext, ) -> Option<Handle<SliverReorderableListState>>

The state from the closest instance of this class that encloses the given context.

This method is typically used by SliverReorderableList item widgets that insert or remove items in response to user input.

If no SliverReorderableList surrounds the context given, this function will return None.

This method can be expensive (it walks the element tree).

See also:

Trait Implementations§

Source§

impl Debug for SliverReorderableList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for SliverReorderableList

Source§

type State = SliverReorderableListState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn debug_check_constructor(&self)

Source§

fn create_state(&self) -> SliverReorderableListState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for SliverReorderableList

§

impl !Send for SliverReorderableList

§

impl !Sync for SliverReorderableList

§

impl !UnwindSafe for SliverReorderableList

§

impl Forget for SliverReorderableList

§

impl Freeze for SliverReorderableList
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, i32) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, i32) -> Rc<dyn Widget>>>: Freeze, *const RcInner<dyn Fn(&KeyRef) -> Option<i32>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&KeyRef) -> Option<i32>>>: Freeze, *const RcInner<dyn Fn(&mut App, i32, i32)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, i32, i32)>>: Freeze, *const RcInner<dyn Fn(&mut App, i32)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, i32)>>: Freeze, *const RcInner<dyn Fn(&mut App, Rc<dyn Widget>, i32, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, Rc<dyn Widget>, i32, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: Freeze, *const RcInner<dyn Fn(i32, SliverLayoutDimensions) -> Option<f64>> is !null: Freeze, PhantomData<RcInner<dyn Fn(i32, SliverLayoutDimensions) -> Option<f64>>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement) -> Option<Box<dyn DragBoundaryDelegate<Rect>>>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Option<Box<dyn DragBoundaryDelegate<Rect>>>>>: Freeze,

§

impl Move for SliverReorderableList

§

impl Unpin for SliverReorderableList
where Rc<dyn Key>: Unpin, Rc<dyn Fn(&mut App, AnyElement, i32) -> Rc<dyn Widget>>: Unpin, Rc<dyn Fn(&KeyRef) -> Option<i32>>: Unpin, Rc<dyn Fn(&mut App, i32, i32)>: Unpin, Rc<dyn Fn(&mut App, i32)>: Unpin, Rc<dyn Fn(&mut App, Rc<dyn Widget>, i32, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>: Unpin, Rc<dyn Fn(i32, SliverLayoutDimensions) -> Option<f64>>: Unpin, Rc<dyn Widget>: Unpin, Rc<dyn Fn(&mut App, AnyElement) -> Option<Box<dyn DragBoundaryDelegate<Rect>>>>: Unpin,

§

impl UnsafeUnpin for SliverReorderableList
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, i32) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, i32) -> Rc<dyn Widget>>>: UnsafeUnpin, *const RcInner<dyn Fn(&KeyRef) -> Option<i32>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&KeyRef) -> Option<i32>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, i32, i32)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, i32, i32)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, i32)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, i32)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, Rc<dyn Widget>, i32, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, Rc<dyn Widget>, i32, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: UnsafeUnpin, *const RcInner<dyn Fn(i32, SliverLayoutDimensions) -> Option<f64>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(i32, SliverLayoutDimensions) -> Option<f64>>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement) -> Option<Box<dyn DragBoundaryDelegate<Rect>>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Option<Box<dyn DragBoundaryDelegate<Rect>>>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>