casvanluijtelaar / reorderable_grid

A Flutter inplementation of the reorderable grid UI pattern, closely mimics Flutters exisiting ReorderableList

Home Page:https://pub.dev/packages/reorderable_grid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any way to lock an item?

thuanlegit opened this issue · comments

Great package! I need something like this for our app. Is there any way that I can lock an item in the grid? I want to make the + button always at the first place and won't be pushed by other items. Thanks.

image

Need this too.

I think the easiest way to do this would be to intercept the Gesture events on that widget.

One way to do this is to wrap it in a

Listener(
    behavior: HitTestBehavior.opaque,
    ...
)

I think the easiest way to do this would be to intercept the Gesture events on that widget.

One way to do this is to wrap it in a

Listener(
    behavior: HitTestBehavior.opaque,
    ...
)

The issue with this solution is that it doesn't prevent the locked item from moving when other items are moving nearby. Also, those are typically buttons, so we need to have the ability to tap on them, etc. We are currently using fork from open PR + workaround, but if you don't want to break the contract with Flutter SDK widgets - maybe you can just create an inherited "extended" class on top of ReorderableGrid with additional features? Thanks anyway!

I think the easiest way to do this would be to intercept the Gesture events on that widget.
One way to do this is to wrap it in a

Listener(
    behavior: HitTestBehavior.opaque,
    ...
)

The issue with this solution is that it doesn't prevent the locked item from moving when other items are moving nearby. Also, those are typically buttons, so we need to have the ability to tap on them, etc. We are currently using fork from open PR + workaround, but if you don't want to break the contract with Flutter SDK widgets - maybe you can just create an inherited "extended" class on top of ReorderableGrid with additional features? Thanks anyway!

I added this feature to ReorderableGridView with some modifications, available in 1.0.8

Heyy :)
#25 only locks the item from not being dragged, doesn't it? It can still get "pushed" (temporarily repositioned) when dragging another item around