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

IconButton ripple effect #61811

Closed
dsavke opened this issue Jul 19, 2020 · 6 comments
Closed

IconButton ripple effect #61811

dsavke opened this issue Jul 19, 2020 · 6 comments
Labels
in triage Presently being triaged by the triage team

Comments

@dsavke
Copy link

dsavke commented Jul 19, 2020

Bug with IconButton ripple effect.

When i set background color of Container and inside that Container as a child I put IconButton widget.
Then suddenly ripple effect goes behind that backgroun color.

I know for fix when I swap Container widget with Material but in this situation I really need my Container widget.

Is there any solution to have a ripple effect on IconButton widget and the parent of that widget stays to be a Container?

@yvesjordan06
Copy link

Take a look at this issue it has a workaround

@Hixie said

What's going on is that the Material spec says that the splashes are actually ink on the Material. So when we splash, what we do is we literally have the Material widget do the splash. If you have something on top of the Material, we splash under it, and you can't see it.

Try wrapping your IconButton in a Material Widget

Container(
    child:Material(
        color: Colors.transparent //To let the Container background be displayed
        child: IconButton(
            icon: Icon(Icons.heart),
            onPressed: (){}
        ),
    ),
)

Hope it helps you out

@VladyslavBondarenko
Copy link

Thanks @yvesjordan06 ,
@savke30 does it help or your use case is different?

@VladyslavBondarenko VladyslavBondarenko added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Jul 20, 2020
@dsavke
Copy link
Author

dsavke commented Jul 20, 2020

@yvesjordan06 that was helpful.

I think this issues is solved.

@dsavke dsavke closed this as completed Jul 20, 2020
@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 20, 2020
@BananaMasterz
Copy link

I tried this and it gives a rectangular ripple which is not pretty.

@gtu-myowin
Copy link

I tried this and it gives a rectangular ripple which is not pretty.

Then, you can use ClipOval. Like this

ClipOval(
  child: Material(
    color: Colors
        .transparent, //To let the Container background be displayed
    child: IconButton(
        icon: Icon(
          Icons.play_arrow,
          color: Colors.white,
        ),
        onPressed: () {}),
  ),
),

@github-actions
Copy link

github-actions bot commented Aug 6, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in triage Presently being triaged by the triage team
Projects
None yet
Development

No branches or pull requests

5 participants