Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onClick #7

Closed
ysnsyhn opened this issue Oct 12, 2018 · 2 comments
Closed

onClick #7

ysnsyhn opened this issue Oct 12, 2018 · 2 comments

Comments

@ysnsyhn
Copy link

ysnsyhn commented Oct 12, 2018

how to make the grids clickable?
I try to change to another layout when one of the items is clicked.

@nisrulz
Copy link
Owner

nisrulz commented Nov 14, 2019

Wrap your grid item with GestureDetector.

i.e

GestureDetector(
  onTap: () {
    print("onTap called.");
  },
  child: Text("Hello World"),
),

Commit with change: 034178d

@nisrulz nisrulz closed this as completed Nov 14, 2019
@nisrulz
Copy link
Owner

nisrulz commented Nov 15, 2019

Forgot to mention, you can also use InkWell class which will enable ripple effect.

InkWell (
  onTap: () {
    print("onTap called.");
  },
  child: Text("Hello World"),
),

Depending on your use case, use either InkWell or GestureDetector

Read more : https://api.flutter.dev/flutter/material/InkWell-class.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants