Imagine a scenario where I have a large draggable and two small drag targets. I want to register a drop on both smaller drag targets when the draggable widget is dropped on top of both; similarly a drop on one drag target if the draggable only covers one etc...
Can this be acheived with draggables, or any other method?
Context of flutter draggables like this demo.
The described behaviour is that event happens when you drag and drop the draggable into the drag target. But actually it's only registered if your cursor/finger is within the drag target's widget bounds when you drop. A drop isn't registered if the draggable widget is dropped on top of the drag target unless your pointer is within the bounds of the drag target.
Related
By default in the picture above, the green box(drag target) is empty. When the red box(A) is dragged is stays in the green box and then this red box (now inside the green, also acts as a drag target). So that now the black box(B) can be dropped into it. How do I do this in flutter With Draggable and Drag target. Thanks in advance.
I think you need to use gesturedetector(tabdowndetails) to detect "x,y" while moving users finger across the screen. You can paint target rectangle(const dimensions) dynamically following users finger.
btw. where do you plan to drag the boxes(objects, picts)?
I’m trying to develop a game that allows a player to drag playing cards from their hand to a location on an open table
Cards can only be dragged and dropped to certain positions adjacent to a card that was played prior. The valid locations are either vertical or horizontal from the last played card, unless it’s the first card and it can be dropped anywhere. I’d like the adjacent locations that are valid for dropping a card to be highlighted in green when it’s the user’s turn as illustrated below:
Would I need to use the CustomPainter class to handle this situation? If so, should I make the entire Custom Painter area a drop target and have it update appropriately when dragging?
Looking for ideas/input. Thanks.
I want my Drag target to follow the draggable widget when it moves, really appreciate if you could help!
Before Drag
After Drag
"hold and drag" - would be holding down with one finger and dragging horizontally (or vertically) with another.
GestureDetector would recognize it as Scale gesture. I want to differentiate between these 2:
Two fingers moving closer or further apart (normal scale)
One finger holding and another finger moving closer or further (I want to detect this)
There's a built-in Widget for that called LongPressDraggable you can use it similar to the Draggable widget.
The one main common difference being the ability to directly drag using the Draggable widget or hold and drag using the LongPressDraggable Widget.
I have a draggable image in Drag Target, I can move it around but it is not accepted in another Drag Target, I am sure Drag Target returns true every time for willAccept(). How to handle this?
Issue: How to drag object from one DragTarget to other?
Resolved!
The drag target now returns Draggable