MhDragState class
class to hold the current State of a drag and drop operation
A drag drop operation has different states
-
dragStart The User wants to drag something this is called on dragSources - e.g. Flutter Draggable You can disallow the drag here
-
dragMove The User is dragging around something this is called on DragTargets - e.g. Flutter DragTarget You can set the allowed dropModes here also according to the current position
-
acceptDrop The Users wants to drop something this is called on DragTargets - e.g. Flutter DragTarget Here you can accept the drop or deny it. And you chould create the items to be inserted from the dropped items. E.g.: If you drop items from a List to a TreeView and the TreeView need different items than the list, than you should create a new item from every dragged item
-
dropAccepted The Drop Target accepted the drop this is called on the DragSource e.g. Flutter Draggeable.onDragEnd Here you can e.g. remove the dragged items from the List if this was a move operation
There are more states, but in most cases you don't need them, so we decided to handle them internally or ignore them
- Inheritance
-
- Object
- ChangeNotifier
- MhDragState
Constructors
Properties
- displayText → String
-
Text to be displayed during a drag and drop operation
holding e.g.: Move
no setter
- draggedItems ↔ List?
-
holds a list of items beeing dragged
getter/setter pair
- dragSource ↔ MdDragSource?
-
points to the widget the where the drag operation started and the draggedItems are taken from
getter/setter pair
- dropMode ↔ MhDropMode
-
the current action the user requestet for the drag and drop Operation
getter/setter pair
- dropModeAllowed ↔ MhDropModeAllowed
-
the modes which are allowed for the current drag drop Operation
you can limit the allowed drop modes to only copy, only move or do both
getter/setter pair
- dropPosition ↔ MhDropPosition?
-
holds the position where the user wants to drop the draggedItems according to the current Pointer position
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- messageToShowDuringDrag ← String?
-
no getter
- messageToShowDuringMove ← String?
-
no getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showDefaultMessages ← bool
-
no getter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onDragLeave(
) → dynamic - function should be called from every DragTarget in the onLeave Event
-
onDragMove(
bool dragAllowed) → dynamic - function should be called from every DragTarget in the move Event
-
onKeyEvent(
KeyEvent event) → void - called from the KeyBoard listener to indicate a key was pressed during the drag drop operation
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setDisplayText(
String value, bool isDefaultMessage) → void - set the text to be displayed close to the cursor during a drag and drop operation
-
setDragMode(
) → void - set the current drag Drop Mode according to current Keys Pressed e.g. if the users presses the SHIFT key, the drop Mode is set to move if allowed
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited