pub struct ReorderableListView {Show 31 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 build_default_drag_handles: bool,
pub padding: Option<EdgeInsets>,
pub header: Option<WidgetRef>,
pub footer: Option<WidgetRef>,
pub scroll_direction: Axis,
pub reverse: bool,
pub scroll_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>,
pub mouse_cursor: Option<MouseCursorRef>,
}Expand description
A list whose items the user can interactively reorder by dragging.
This sample shows by dragging the user can reorder the items of the list. The
on_reorder_item parameter will be called when a child widget is
dragged to a new position.
By default, on desktop platforms each item will have a drag handle added on top of it that
will allow the user to grab it to move the item. On mobile platforms, no drag handle will be
added, but when the user long presses anywhere on the item it will start moving the item.
Displaying drag handles can be controlled with
build_default_drag_handles.
All list items must have a key.
While a drag is underway, the widget returned by the
proxy_decorator callback serves as a “proxy” (a substitute) for
the item in the list. The proxy is created with the original list item as its child. The
default one wraps the dragged item in a Material widget and animates its elevation.
Fields§
§key: Option<KeyRef>§item_builder: IndexedWidgetBuilderSee ReorderableList::item_builder.
item_count: i32See ReorderableList::item_count.
on_reorder: Option<ReorderCallback>See ReorderableList::on_reorder.
Deprecated: use on_reorder_item.
on_reorder_item: Option<ReorderCallback>See ReorderableList::on_reorder_item.
on_reorder_start: Option<ReorderIndexCallback>See ReorderableList::on_reorder_start.
on_reorder_end: Option<ReorderIndexCallback>See ReorderableList::on_reorder_end.
proxy_decorator: Option<ReorderItemProxyDecorator>See ReorderableList::proxy_decorator.
build_default_drag_handles: boolIf true: on desktop platforms, a drag handle is stacked over the center of each item’s trailing edge; on mobile platforms, a long press anywhere on the item starts a drag.
The default desktop drag handle is just an Icons::drag_handle wrapped by a
ReorderableDragStartListener. On mobile platforms, the entire item is wrapped with a
ReorderableDelayedDragStartListener.
To change the appearance or the layout of the drag handles, make this parameter false and
wrap each list item, or a widget within each list item, with
ReorderableDragStartListener or ReorderableDelayedDragStartListener.
padding: Option<EdgeInsets>See ReorderableList::padding.
header: Option<WidgetRef>A non-reorderable header item to show before the items of the list.
If None, no header will appear before the list.
A non-reorderable footer item to show after the items of the list.
If None, no footer will appear after the list.
scroll_direction: AxisThe Axis along which the scroll view’s offset increases.
reverse: boolWhether the scroll view scrolls in the reading direction.
scroll_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.
Defaults to true when scroll_direction is Axis::Vertical
and scroll_controller is None.
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.
For more information, see ScrollView::anchor.
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>How this scroll view dismisses 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>See ReorderableList::item_extent.
item_extent_builder: Option<ItemExtentBuilder>See ReorderableList::item_extent_builder.
prototype_item: Option<WidgetRef>See ReorderableList::prototype_item.
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>See ReorderableList::drag_boundary_provider.
mouse_cursor: Option<MouseCursorRef>The cursor for a mouse pointer when it enters or is hovering over the drag handle.
If mouse_cursor is a WidgetStateMouseCursor,
WidgetStateProperty::resolve is used for the following WidgetStates:
If this property is None, SystemMouseCursors::GRAB will be used when hovering, and
SystemMouseCursors::GRABBING when dragging.
Implementations§
Source§impl ReorderableListView
impl ReorderableListView
Sourcepub fn new(children: impl IntoIterator<Item = WidgetRef>) -> ReorderableListView
pub fn new(children: impl IntoIterator<Item = WidgetRef>) -> ReorderableListView
Creates a reorderable list from a pre-built list of widgets.
This constructor is appropriate for lists with a small number of children because constructing the list requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.
See also:
builder, which allows you to build a reorderable list where the items are built as needed when scrolling the list.
Sourcepub fn builder(
item_builder: impl Fn(&mut App, BuildContext, i32) -> WidgetRef + 'static,
item_count: i32,
) -> ReorderableListView
pub fn builder( item_builder: impl Fn(&mut App, BuildContext, i32) -> WidgetRef + 'static, item_count: i32, ) -> ReorderableListView
Creates a reorderable list from widget items that are created on demand.
This constructor is appropriate for list views with a large number of children because the builder is called only for those children that are actually visible.
The item_builder callback will be called only with indices greater than or equal to
zero and less than item_count.
The item_builder should always return a widget, and actually create the widget
instances when called. Avoid using a builder that returns a previously-constructed
widget; if the list view’s children are created in advance, or all at once when the
ReorderableListView itself is created, it is more efficient to use
new. Even more efficient, however, is to create the instances on demand
using this constructor’s item_builder callback.
See also:
new, which allows you to build a reorderable list with all the items passed into the constructor.
Sourcepub fn key(self, key: KeyRef) -> ReorderableListView
pub fn key(self, key: KeyRef) -> ReorderableListView
Dart ReorderableListView(key:).
Sourcepub fn on_reorder(
self,
on_reorder: impl Fn(&mut App, i32, i32) + 'static,
) -> ReorderableListView
👎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, ) -> ReorderableListView
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 ReorderableListView(onReorder:).
Sourcepub fn on_reorder_item(
self,
on_reorder_item: impl Fn(&mut App, i32, i32) + 'static,
) -> ReorderableListView
pub fn on_reorder_item( self, on_reorder_item: impl Fn(&mut App, i32, i32) + 'static, ) -> ReorderableListView
Dart ReorderableListView(onReorderItem:).
Sourcepub fn on_reorder_start(
self,
on_reorder_start: impl Fn(&mut App, i32) + 'static,
) -> ReorderableListView
pub fn on_reorder_start( self, on_reorder_start: impl Fn(&mut App, i32) + 'static, ) -> ReorderableListView
Dart ReorderableListView(onReorderStart:).
Sourcepub fn on_reorder_end(
self,
on_reorder_end: impl Fn(&mut App, i32) + 'static,
) -> ReorderableListView
pub fn on_reorder_end( self, on_reorder_end: impl Fn(&mut App, i32) + 'static, ) -> ReorderableListView
Dart ReorderableListView(onReorderEnd:).
Sourcepub fn item_extent(self, item_extent: f64) -> ReorderableListView
pub fn item_extent(self, item_extent: f64) -> ReorderableListView
Dart ReorderableListView(itemExtent:).
Sourcepub fn item_extent_builder(
self,
item_extent_builder: ItemExtentBuilder,
) -> ReorderableListView
pub fn item_extent_builder( self, item_extent_builder: ItemExtentBuilder, ) -> ReorderableListView
Dart ReorderableListView(itemExtentBuilder:).
Sourcepub fn prototype_item<K>(
self,
prototype_item: impl IntoWidget<K>,
) -> ReorderableListView
pub fn prototype_item<K>( self, prototype_item: impl IntoWidget<K>, ) -> ReorderableListView
Dart ReorderableListView(prototypeItem:).
Sourcepub fn proxy_decorator(
self,
proxy_decorator: impl Fn(&mut App, WidgetRef, i32, AnimationRef<f64>) -> WidgetRef + 'static,
) -> ReorderableListView
pub fn proxy_decorator( self, proxy_decorator: impl Fn(&mut App, WidgetRef, i32, AnimationRef<f64>) -> WidgetRef + 'static, ) -> ReorderableListView
Dart ReorderableListView(proxyDecorator:).
Sourcepub fn build_default_drag_handles(
self,
build_default_drag_handles: bool,
) -> ReorderableListView
pub fn build_default_drag_handles( self, build_default_drag_handles: bool, ) -> ReorderableListView
Dart ReorderableListView(buildDefaultDragHandles:).
Sourcepub fn padding(self, padding: EdgeInsets) -> ReorderableListView
pub fn padding(self, padding: EdgeInsets) -> ReorderableListView
Dart ReorderableListView(padding:).
Sourcepub fn header<K>(self, header: impl IntoWidget<K>) -> ReorderableListView
pub fn header<K>(self, header: impl IntoWidget<K>) -> ReorderableListView
Dart ReorderableListView(header:).
Dart ReorderableListView(footer:).
Sourcepub fn scroll_direction(self, scroll_direction: Axis) -> ReorderableListView
pub fn scroll_direction(self, scroll_direction: Axis) -> ReorderableListView
Dart ReorderableListView(scrollDirection:).
Sourcepub fn reverse(self, reverse: bool) -> ReorderableListView
pub fn reverse(self, reverse: bool) -> ReorderableListView
Dart ReorderableListView(reverse:).
Sourcepub fn scroll_controller(
self,
scroll_controller: ScrollControllerRef,
) -> ReorderableListView
pub fn scroll_controller( self, scroll_controller: ScrollControllerRef, ) -> ReorderableListView
Dart ReorderableListView(scrollController:).
Sourcepub fn primary(self, primary: bool) -> ReorderableListView
pub fn primary(self, primary: bool) -> ReorderableListView
Dart ReorderableListView(primary:).
Sourcepub fn physics(self, physics: ScrollPhysicsRef) -> ReorderableListView
pub fn physics(self, physics: ScrollPhysicsRef) -> ReorderableListView
Dart ReorderableListView(physics:).
Sourcepub fn shrink_wrap(self, shrink_wrap: bool) -> ReorderableListView
pub fn shrink_wrap(self, shrink_wrap: bool) -> ReorderableListView
Dart ReorderableListView(shrinkWrap:).
Sourcepub fn anchor(self, anchor: f64) -> ReorderableListView
pub fn anchor(self, anchor: f64) -> ReorderableListView
Dart ReorderableListView(anchor:).
Sourcepub fn cache_extent(self, cache_extent: f64) -> ReorderableListView
👎Deprecated: Use scroll_cache_extent instead.
pub fn cache_extent(self, cache_extent: f64) -> ReorderableListView
Use scroll_cache_extent instead.
Dart ReorderableListView(cacheExtent:).
Sourcepub fn scroll_cache_extent(
self,
scroll_cache_extent: ScrollCacheExtent,
) -> ReorderableListView
pub fn scroll_cache_extent( self, scroll_cache_extent: ScrollCacheExtent, ) -> ReorderableListView
Dart ReorderableListView(scrollCacheExtent:).
Sourcepub fn drag_start_behavior(
self,
drag_start_behavior: DragStartBehavior,
) -> ReorderableListView
pub fn drag_start_behavior( self, drag_start_behavior: DragStartBehavior, ) -> ReorderableListView
Dart ReorderableListView(dragStartBehavior:).
Sourcepub fn keyboard_dismiss_behavior(
self,
keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior,
) -> ReorderableListView
pub fn keyboard_dismiss_behavior( self, keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior, ) -> ReorderableListView
Dart ReorderableListView(keyboardDismissBehavior:).
Sourcepub fn restoration_id(
self,
restoration_id: impl Into<String>,
) -> ReorderableListView
pub fn restoration_id( self, restoration_id: impl Into<String>, ) -> ReorderableListView
Dart ReorderableListView(restorationId:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> ReorderableListView
pub fn clip_behavior(self, clip_behavior: Clip) -> ReorderableListView
Dart ReorderableListView(clipBehavior:).
Sourcepub fn auto_scroller_velocity_scalar(
self,
auto_scroller_velocity_scalar: f64,
) -> ReorderableListView
pub fn auto_scroller_velocity_scalar( self, auto_scroller_velocity_scalar: f64, ) -> ReorderableListView
Dart ReorderableListView(autoScrollerVelocityScalar:).
Sourcepub fn drag_boundary_provider(
self,
drag_boundary_provider: ReorderDragBoundaryProvider,
) -> ReorderableListView
pub fn drag_boundary_provider( self, drag_boundary_provider: ReorderDragBoundaryProvider, ) -> ReorderableListView
Dart ReorderableListView(dragBoundaryProvider:).
Sourcepub fn mouse_cursor(
self,
mouse_cursor: impl Into<MouseCursorRef>,
) -> ReorderableListView
pub fn mouse_cursor( self, mouse_cursor: impl Into<MouseCursorRef>, ) -> ReorderableListView
Dart ReorderableListView(mouseCursor:).
Trait Implementations§
Source§impl Debug for ReorderableListView
impl Debug for ReorderableListView
Source§impl StatefulWidget for ReorderableListView
impl StatefulWidget for ReorderableListView
Source§type State = ReorderableListViewState
type State = ReorderableListViewState
Source§fn create_state(&self) -> ReorderableListViewState
fn create_state(&self) -> ReorderableListViewState
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 + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
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 ReorderableListView
impl !Send for ReorderableListView
impl !Sync for ReorderableListView
impl !UnwindSafe for ReorderableListView
impl Forget for ReorderableListView
impl Freeze for ReorderableListViewwhere
*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,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<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 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,
*const RcInner<dyn MouseCursor> is !null: Freeze,
PhantomData<RcInner<dyn MouseCursor>>: Freeze,
impl Move for ReorderableListView
impl Unpin for ReorderableListViewwhere
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,
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 Fn(&mut App, AnyElement) -> Option<Box<dyn DragBoundaryDelegate<Rect>>>>: Unpin,
Rc<dyn MouseCursor>: Unpin,
impl UnsafeUnpin for ReorderableListViewwhere
*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,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<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 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,
*const RcInner<dyn MouseCursor> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn MouseCursor>>: 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.