XDropRegion class

A region that accepts OS file drops.

While a drag hovers inside this region's painted bounds, builder is invoked with isOver: true and onEnter fires; leaving fires onExit; a drop inside fires onPerform with the files.

Set enable to false whenever the region is occluded by a page painted in front of it: native drag events are delivered by geometry regardless of paint order, so an occluded-but-enabled region would still react. Disabling detaches it entirely and clears any hover.

Inheritance
Available extensions

Constructors

XDropRegion({Key? key, required Widget builder(BuildContext context, bool isOver), ValueChanged<List<XDropFile>>? onPerform, VoidCallback? onEnter, VoidCallback? onExit, bool enable = true})
Creates a drop region.
const

Properties

builder → Widget Function(BuildContext context, bool isOver)
Builds the child; isOver is true while a drag hovers inside the bounds.
final
enable → bool
When false the region detaches from the drag stream and reacts to nothing.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onEnter → VoidCallback?
Fired when a drag enters this region's bounds.
final
onExit → VoidCallback?
Fired when a drag leaves the bounds, or the region is disabled mid-drag.
final
onPerform → ValueChanged<List<XDropFile>>?
Fired with the dropped files when a drop lands inside this region.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<XDropRegion>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sliver({Key? key}) → Widget

Available on Widget, provided by the SliverExtension extension

Wraps this widget in a SliverToBoxAdapter.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited