pub struct DragTarget<T: 'static> {
pub key: Option<KeyRef>,
pub builder: DragTargetBuilder<T>,
pub on_will_accept: Option<DragTargetWillAccept<T>>,
pub on_will_accept_with_details: Option<DragTargetWillAcceptWithDetails<T>>,
pub on_accept: Option<DragTargetAccept<T>>,
pub on_accept_with_details: Option<DragTargetAcceptWithDetails<T>>,
pub on_leave: Option<DragTargetLeave<T>>,
pub on_move: Option<DragTargetMove<T>>,
pub hit_test_behavior: HitTestBehavior,
}Expand description
A widget that receives data when a Draggable is dropped over it.
Fields§
§key: Option<KeyRef>Identity of this target in its parent’s child list.
builder: DragTargetBuilder<T>Builds the target using all current accepted and rejected drag data.
on_will_accept: Option<DragTargetWillAccept<T>>Legacy data-only acceptance predicate; mutually exclusive with the detailed predicate.
on_will_accept_with_details: Option<DragTargetWillAcceptWithDetails<T>>Determines whether to accept an entering drag, including its position.
on_accept: Option<DragTargetAccept<T>>Called when non-null data is dropped on this target.
on_accept_with_details: Option<DragTargetAcceptWithDetails<T>>Called when non-null data is dropped, including its position.
on_leave: Option<DragTargetLeave<T>>Called when a drag leaves this target.
on_move: Option<DragTargetMove<T>>Called when non-null drag data moves within this target.
hit_test_behavior: HitTestBehaviorDefaults to translucent so targets behind rejected targets can receive a drag.
Implementations§
Source§impl<T: 'static> DragTarget<T>
impl<T: 'static> DragTarget<T>
Sourcepub fn new(
builder: impl Fn(&mut App, BuildContext, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> WidgetRef + 'static,
) -> Self
pub fn new( builder: impl Fn(&mut App, BuildContext, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> WidgetRef + 'static, ) -> Self
Creates a target whose presentation reflects the current candidate and rejected data.
Sourcepub fn on_will_accept(self, value: DragTargetWillAccept<T>) -> Self
pub fn on_will_accept(self, value: DragTargetWillAccept<T>) -> Self
Sets the legacy data-only acceptance predicate.
Sourcepub fn on_will_accept_with_details(
self,
value: DragTargetWillAcceptWithDetails<T>,
) -> Self
pub fn on_will_accept_with_details( self, value: DragTargetWillAcceptWithDetails<T>, ) -> Self
Sets the predicate for accepting an entering drag.
Sourcepub fn on_accept(self, value: DragTargetAccept<T>) -> Self
pub fn on_accept(self, value: DragTargetAccept<T>) -> Self
Sets the callback for dropped non-null data.
Sourcepub fn on_accept_with_details(
self,
value: DragTargetAcceptWithDetails<T>,
) -> Self
pub fn on_accept_with_details( self, value: DragTargetAcceptWithDetails<T>, ) -> Self
Sets the callback for a drop’s data and global position.
Sourcepub fn on_leave(self, value: DragTargetLeave<T>) -> Self
pub fn on_leave(self, value: DragTargetLeave<T>) -> Self
Sets the callback for a drag leaving the target.
Sourcepub fn on_move(self, value: DragTargetMove<T>) -> Self
pub fn on_move(self, value: DragTargetMove<T>) -> Self
Sets the callback for movement within the target.
Sourcepub fn hit_test_behavior(self, value: HitTestBehavior) -> Self
pub fn hit_test_behavior(self, value: HitTestBehavior) -> Self
Sets how the target participates in hit testing.
Trait Implementations§
Source§impl<T: 'static> Debug for DragTarget<T>
impl<T: 'static> Debug for DragTarget<T>
Source§impl<T: 'static> StatefulWidget for DragTarget<T>
impl<T: 'static> StatefulWidget for DragTarget<T>
Source§type State = DragTargetState<T>
type State = DragTargetState<T>
Source§fn create_state(&self) -> Self::State
fn create_state(&self) -> Self::State
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<T> !RefUnwindSafe for DragTarget<T>
impl<T> !Send for DragTarget<T>
impl<T> !Sync for DragTarget<T>
impl<T> !UnwindSafe for DragTarget<T>
impl<T> Forget for DragTarget<T>
impl<T> Freeze for DragTarget<T>where
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn Fn(&mut App, Option<Rc<T>>) -> bool> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, Option<Rc<T>>) -> bool>>: Freeze,
*const RcInner<dyn Fn(&mut App, DragTargetDetails<T>) -> bool> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, DragTargetDetails<T>) -> bool>>: Freeze,
*const RcInner<dyn Fn(&mut App, Rc<T>)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, Rc<T>)>>: Freeze,
*const RcInner<dyn Fn(&mut App, DragTargetDetails<T>)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, DragTargetDetails<T>)>>: Freeze,
*const RcInner<dyn Fn(&mut App, Option<Rc<T>>)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, Option<Rc<T>>)>>: Freeze,
impl<T> Move for DragTarget<T>
impl<T> Unpin for DragTarget<T>where
Rc<dyn Key>: Unpin,
Rc<dyn Fn(&mut App, AnyElement, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> Rc<dyn Widget>>: Unpin,
Rc<dyn Fn(&mut App, Option<Rc<T>>) -> bool>: Unpin,
Rc<dyn Fn(&mut App, DragTargetDetails<T>) -> bool>: Unpin,
Rc<dyn Fn(&mut App, Rc<T>)>: Unpin,
Rc<dyn Fn(&mut App, DragTargetDetails<T>)>: Unpin,
Rc<dyn Fn(&mut App, Option<Rc<T>>)>: Unpin,
impl<T> UnsafeUnpin for DragTarget<T>where
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Vec<Option<Rc<T>>>, Vec<Option<Rc<dyn Any>>>) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, Option<Rc<T>>) -> bool> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, Option<Rc<T>>) -> bool>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, DragTargetDetails<T>) -> bool> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, DragTargetDetails<T>) -> bool>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, Rc<T>)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, Rc<T>)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, DragTargetDetails<T>)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, DragTargetDetails<T>)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, Option<Rc<T>>)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, Option<Rc<T>>)>>: 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.