pub struct ReorderableList {Show 27 fields
pub key: Option<KeyRef>,
pub item_builder: IndexedWidgetBuilder,
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 padding: Option<EdgeInsetsGeometry>,
pub scroll_direction: Axis,
pub reverse: bool,
pub controller: Option<ScrollControllerRef>,
pub primary: Option<bool>,
pub physics: Option<ScrollPhysicsRef>,
pub shrink_wrap: bool,
pub anchor: f64,
pub cache_extent: Option<f64>,
pub scroll_cache_extent: Option<ScrollCacheExtent>,
pub drag_start_behavior: DragStartBehavior,
pub keyboard_dismiss_behavior: Option<ScrollViewKeyboardDismissBehavior>,
pub restoration_id: Option<String>,
pub clip_behavior: Clip,
pub item_extent: Option<f64>,
pub item_extent_builder: Option<ItemExtentBuilder>,
pub prototype_item: Option<WidgetRef>,
pub auto_scroller_velocity_scalar: Option<f64>,
pub drag_boundary_provider: Option<ReorderDragBoundaryProvider>,
}Expand description
A scrolling container that allows the user to interactively reorder the list items.
This widget is similar to one created by ListView.builder, and uses an
IndexedWidgetBuilder to create each item.
It is up to the application to wrap each child (or an internal part of the child such as a
drag handle) with a drag listener that will recognize the start of an item drag and then
start the reorder by calling ReorderableListState::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
ReorderableListState::start_item_drag_reorder method.
This widget’s ReorderableListState can be used to manually start an item reorder, or
cancel a current drag. To refer to the ReorderableListState either provide a
GlobalKey or use the static ReorderableList::of method from an item’s build method.
See also:
SliverReorderableList, a sliver 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: IndexedWidgetBuilderCalled, as needed, to build list item widgets.
List items are only built when they’re scrolled into view.
The IndexedWidgetBuilder index parameter indicates the item’s position in the list.
The value of the index parameter will be between zero and one less than
item_count. All items in the list must have a unique Key,
and should have some kind of listener to start the drag (usually a
ReorderableDragStartListener or ReorderableDelayedDragStartListener).
item_count: i32The number of items in the list.
It must be a non-negative integer. When zero, nothing is displayed and the widget occupies no space.
on_reorder: Option<ReorderCallback>A callback used by the list to report that a list item has been dragged to a new location in the list and the application should update the order of the items.
If old_index is before new_index, removing the item at old_index from the list
will reduce the list’s length by one. Implementations will need to account for this
when inserting before new_index.
Deprecated in favor of on_reorder_item, which simplifies
the reordering logic by automatically handling index adjustments. To migrate, remove the
manual adjustment of new_index when items are moved downward in the list.
on_reorder_item: Option<ReorderCallback>A callback used by the list to report that a list item has been dragged to a new location in the list and the application should update the order of the items.
on_reorder_start: Option<ReorderIndexCallback>A callback that is called when an item drag has started.
The index parameter of the callback is the index of the selected item.
See also:
on_reorder_end, which is a called when the dragged item is dropped.on_reorder_item, which reports that a list item has been dragged to a new location.
on_reorder_end: Option<ReorderIndexCallback>A callback that is called when the dragged item is dropped.
The index parameter of the callback is the index where the item is dropped. Unlike
on_reorder_item, this is called even when the list item is
dropped in the same location.
See also:
on_reorder_start, which is a called when an item drag has started.on_reorder_item, which reports that a list item has been dragged to a new location.
proxy_decorator: Option<ReorderItemProxyDecorator>A callback that allows the app to add an animated decoration around an item when it is being dragged.
padding: Option<EdgeInsetsGeometry>The amount of space by which to inset the list contents.
It defaults to EdgeInsets.all(0).
scroll_direction: AxisThe Axis along which the scroll view’s offset increases.
reverse: boolWhether the scroll view scrolls in the reading direction.
controller: Option<ScrollControllerRef>An object that can be used to control the position to which this scroll view is scrolled.
primary: Option<bool>Whether this is the primary scroll view associated with the parent
PrimaryScrollController.
physics: Option<ScrollPhysicsRef>How the scroll view should respond to user input.
shrink_wrap: boolWhether the extent of the scroll view in the scroll direction should be determined by the contents being viewed.
anchor: f64The relative position of the zero scroll offset.
cache_extent: Option<f64>The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.
Deprecated: use scroll_cache_extent instead.
scroll_cache_extent: Option<ScrollCacheExtent>The amount of additional content to display and lay out around the viewport.
drag_start_behavior: DragStartBehaviorDetermines the way that drag start behavior is handled.
keyboard_dismiss_behavior: Option<ScrollViewKeyboardDismissBehavior>The ScrollViewKeyboardDismissBehavior defines how this scroll view will dismiss
the keyboard automatically.
If it is None then it will fallback to the inherited
ScrollBehavior::get_keyboard_dismiss_behavior.
restoration_id: Option<String>Restoration ID to save and restore the scroll offset of the scrollable.
clip_behavior: ClipThe content will be clipped (or not) according to this option.
Defaults to Clip::HardEdge.
item_extent: Option<f64>If non-None, forces the children to have the given extent in the scroll direction.
item_extent_builder: Option<ItemExtentBuilder>Called to get the item extent of the children in the scroll direction.
prototype_item: Option<WidgetRef>If non-None, forces the children to have the same extent as the given widget in the
scroll direction.
auto_scroller_velocity_scalar: Option<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>A callback used to provide drag boundaries during drag-and-drop reordering.
If None, the delegate returned by DragBoundary::for_rect_maybe_of will be used.
Defaults to None.
Implementations§
Source§impl ReorderableList
impl ReorderableList
Sourcepub fn new(
item_builder: impl Fn(&mut App, BuildContext, i32) -> WidgetRef + 'static,
item_count: i32,
) -> ReorderableList
pub fn new( item_builder: impl Fn(&mut App, BuildContext, i32) -> WidgetRef + 'static, item_count: i32, ) -> ReorderableList
Creates a scrolling container that allows the user to interactively reorder the list items.
The item_count must be greater than or equal to zero.
Sourcepub fn key(self, key: KeyRef) -> ReorderableList
pub fn key(self, key: KeyRef) -> ReorderableList
Dart ReorderableList(key:).
Sourcepub fn on_reorder(
self,
on_reorder: impl Fn(&mut App, i32, i32) + 'static,
) -> ReorderableList
👎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.
pub fn on_reorder( self, on_reorder: impl Fn(&mut App, i32, i32) + 'static, ) -> ReorderableList
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 ReorderableList(onReorder:).
Sourcepub fn on_reorder_item(
self,
on_reorder_item: impl Fn(&mut App, i32, i32) + 'static,
) -> ReorderableList
pub fn on_reorder_item( self, on_reorder_item: impl Fn(&mut App, i32, i32) + 'static, ) -> ReorderableList
Dart ReorderableList(onReorderItem:).
Sourcepub fn on_reorder_start(
self,
on_reorder_start: impl Fn(&mut App, i32) + 'static,
) -> ReorderableList
pub fn on_reorder_start( self, on_reorder_start: impl Fn(&mut App, i32) + 'static, ) -> ReorderableList
Dart ReorderableList(onReorderStart:).
Sourcepub fn on_reorder_end(
self,
on_reorder_end: impl Fn(&mut App, i32) + 'static,
) -> ReorderableList
pub fn on_reorder_end( self, on_reorder_end: impl Fn(&mut App, i32) + 'static, ) -> ReorderableList
Dart ReorderableList(onReorderEnd:).
Sourcepub fn item_extent(self, item_extent: f64) -> ReorderableList
pub fn item_extent(self, item_extent: f64) -> ReorderableList
Dart ReorderableList(itemExtent:).
Sourcepub fn item_extent_builder(
self,
item_extent_builder: ItemExtentBuilder,
) -> ReorderableList
pub fn item_extent_builder( self, item_extent_builder: ItemExtentBuilder, ) -> ReorderableList
Dart ReorderableList(itemExtentBuilder:).
Sourcepub fn prototype_item<K>(
self,
prototype_item: impl IntoWidget<K>,
) -> ReorderableList
pub fn prototype_item<K>( self, prototype_item: impl IntoWidget<K>, ) -> ReorderableList
Dart ReorderableList(prototypeItem:).
Sourcepub fn proxy_decorator(
self,
proxy_decorator: impl Fn(&mut App, WidgetRef, i32, AnimationRef<f64>) -> WidgetRef + 'static,
) -> ReorderableList
pub fn proxy_decorator( self, proxy_decorator: impl Fn(&mut App, WidgetRef, i32, AnimationRef<f64>) -> WidgetRef + 'static, ) -> ReorderableList
Dart ReorderableList(proxyDecorator:).
Sourcepub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> ReorderableList
pub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> ReorderableList
Dart ReorderableList(padding:).
Sourcepub fn scroll_direction(self, scroll_direction: Axis) -> ReorderableList
pub fn scroll_direction(self, scroll_direction: Axis) -> ReorderableList
Dart ReorderableList(scrollDirection:).
Sourcepub fn reverse(self, reverse: bool) -> ReorderableList
pub fn reverse(self, reverse: bool) -> ReorderableList
Dart ReorderableList(reverse:).
Sourcepub fn controller(self, controller: ScrollControllerRef) -> ReorderableList
pub fn controller(self, controller: ScrollControllerRef) -> ReorderableList
Dart ReorderableList(controller:).
Sourcepub fn primary(self, primary: bool) -> ReorderableList
pub fn primary(self, primary: bool) -> ReorderableList
Dart ReorderableList(primary:).
Sourcepub fn physics(self, physics: ScrollPhysicsRef) -> ReorderableList
pub fn physics(self, physics: ScrollPhysicsRef) -> ReorderableList
Dart ReorderableList(physics:).
Sourcepub fn shrink_wrap(self, shrink_wrap: bool) -> ReorderableList
pub fn shrink_wrap(self, shrink_wrap: bool) -> ReorderableList
Dart ReorderableList(shrinkWrap:).
Sourcepub fn anchor(self, anchor: f64) -> ReorderableList
pub fn anchor(self, anchor: f64) -> ReorderableList
Dart ReorderableList(anchor:).
Sourcepub fn cache_extent(self, cache_extent: f64) -> ReorderableList
👎Deprecated: Use scroll_cache_extent instead.
pub fn cache_extent(self, cache_extent: f64) -> ReorderableList
Use scroll_cache_extent instead.
Dart ReorderableList(cacheExtent:).
Sourcepub fn scroll_cache_extent(
self,
scroll_cache_extent: ScrollCacheExtent,
) -> ReorderableList
pub fn scroll_cache_extent( self, scroll_cache_extent: ScrollCacheExtent, ) -> ReorderableList
Dart ReorderableList(scrollCacheExtent:).
Sourcepub fn drag_start_behavior(
self,
drag_start_behavior: DragStartBehavior,
) -> ReorderableList
pub fn drag_start_behavior( self, drag_start_behavior: DragStartBehavior, ) -> ReorderableList
Dart ReorderableList(dragStartBehavior:).
Sourcepub fn keyboard_dismiss_behavior(
self,
keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior,
) -> ReorderableList
pub fn keyboard_dismiss_behavior( self, keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior, ) -> ReorderableList
Dart ReorderableList(keyboardDismissBehavior:).
Sourcepub fn restoration_id(
self,
restoration_id: impl Into<String>,
) -> ReorderableList
pub fn restoration_id( self, restoration_id: impl Into<String>, ) -> ReorderableList
Dart ReorderableList(restorationId:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> ReorderableList
pub fn clip_behavior(self, clip_behavior: Clip) -> ReorderableList
Dart ReorderableList(clipBehavior:).
Sourcepub fn auto_scroller_velocity_scalar(self, value: f64) -> ReorderableList
pub fn auto_scroller_velocity_scalar(self, value: f64) -> ReorderableList
Dart ReorderableList(autoScrollerVelocityScalar:).
Sourcepub fn drag_boundary_provider(
self,
drag_boundary_provider: impl Fn(&mut App, BuildContext) -> Option<Box<dyn DragBoundaryDelegate<Rect>>> + 'static,
) -> ReorderableList
pub fn drag_boundary_provider( self, drag_boundary_provider: impl Fn(&mut App, BuildContext) -> Option<Box<dyn DragBoundaryDelegate<Rect>>> + 'static, ) -> ReorderableList
Dart ReorderableList(dragBoundaryProvider:).
Sourcepub fn of(app: &App, context: BuildContext) -> Handle<ReorderableListState>
pub fn of(app: &App, context: BuildContext) -> Handle<ReorderableListState>
The state from the closest instance of this class that encloses the given context.
This method is typically used by ReorderableList item widgets that insert or remove
items in response to user input.
If no ReorderableList surrounds the given context, then this function will panic.
This method can be expensive (it walks the element tree).
See also:
maybe_of, a similar function that will returnNoneif noReorderableListancestor is found.
Sourcepub fn maybe_of(
app: &App,
context: BuildContext,
) -> Option<Handle<ReorderableListState>>
pub fn maybe_of( app: &App, context: BuildContext, ) -> Option<Handle<ReorderableListState>>
The state from the closest instance of this class that encloses the given context.
This method is typically used by ReorderableList item widgets that insert or remove
items in response to user input.
If no ReorderableList surrounds the context given, then this function will return
None.
This method can be expensive (it walks the element tree).
See also:
of, a similar function that will panic if noReorderableListancestor is found.
Trait Implementations§
Source§impl Debug for ReorderableList
impl Debug for ReorderableList
Source§impl StatefulWidget for ReorderableList
impl StatefulWidget for ReorderableList
Source§type State = ReorderableListState
type State = ReorderableListState
Source§fn create_state(&self) -> ReorderableListState
fn create_state(&self) -> ReorderableListState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 ReorderableList
impl !Send for ReorderableList
impl !Sync for ReorderableList
impl !UnwindSafe for ReorderableList
impl Forget for ReorderableList
impl Freeze for ReorderableListwhere
*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(&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,
NonZero<u32>: Freeze,
&'static ScrollControllerVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn ScrollPhysics> is !null: Freeze,
PhantomData<RcInner<dyn ScrollPhysics>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: 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 ReorderableList
impl Unpin for ReorderableListwhere
Rc<dyn Key>: Unpin,
Rc<dyn Fn(&mut App, AnyElement, i32) -> Rc<dyn Widget>>: 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,
NonZero<u32>: Unpin,
&'static ScrollControllerVTable: Unpin,
Rc<Keep>: Unpin,
Rc<dyn ScrollPhysics>: Unpin,
*const u8 is !null: 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 ReorderableListwhere
*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(&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,
NonZeroU32Inner: UnsafeUnpin,
&'static ScrollControllerVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<dyn ScrollPhysics> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ScrollPhysics>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.