karvulf / flutter-reorderable-grid-view

BSD 3-Clause "New" or "Revised" License
158 stars 23 forks source link

Click on an item in the list #66

Closed NathanFlorins closed 1 year ago

NathanFlorins commented 1 year ago

Hello, can we click on an item in the list to be able to display it or execute something else, because I don't see any onTap method or others

NathanFlorins commented 1 year ago

If I use a Gridview.builder, I can't drag and drop

karvulf commented 1 year ago

Hello @NathanFlorins I am not sure what you exactly mean with your first question. Did you try to start a drag and drop which didn't start or was it something else? If you want to use GridView.builder I recommend to use the version 5.0.0-dev.2 but it's still in progress, so there might be some bugs. The previous version doesn't really support GridView.builder. So if you want to use it for a good performance, you will need the version 5.0.0-dev.2

NathanFlorins commented 1 year ago

Hello @karvul, I would like to click on an item in the list to display this one

karvulf commented 1 year ago

What do you mean by "display"? What is exactly your usecase? @NathanFlorins

NathanFlorins commented 1 year ago

When i click on item, i want to print the index of this item

NathanFlorins commented 1 year ago

Its ok, I had to re-launch my editor. I do this


      return InkWell(
        onTap: () => {
          print("Item $index")
        },
        key: Key(fruits.elementAt(index)),
        child: Container(
          decoration: const BoxDecoration(
              image: DecorationImage(
                  image: NetworkImage("https://source.unsplash.com/radom"),
                  fit: BoxFit.cover
              )
          ),
          child: Text(
            fruits.elementAt(index),
            style: const TextStyle(color: Colors.white),
          ),
        ),
      );
    });
karvulf commented 1 year ago

Ah ok, so it works now? :D @NathanFlorins

karvulf commented 1 year ago

Closing this issue, if something is still wrong, you can open a new issue @NathanFlorins