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

InkWell not working bug #61

Open
BerndWessels opened this issue Aug 7, 2018 · 5 comments
Open

InkWell not working bug #61

BerndWessels opened this issue Aug 7, 2018 · 5 comments

Comments

@BerndWessels
Copy link

I tried every possible combination, but it seems to be impossible to get the ripple effect working on top of the cached network image.

It's like the cached network image has a huge magic z index.

Anybody can fix this or has a workaround?

@ZeDzislaw
Copy link

@BerndWessels you could try to use stack view on top of cached network image. Look at this answer: https://stackoverflow.com/a/48066835.

@creativebracket
Copy link

creativebracket commented Aug 16, 2020

Got this working. This is more on how the ripple effect works. From the docs:

The ink splashes aren't visible! If there is an opaque graphic, e.g. painted using a Container, Image, or DecoratedBox, between the Material widget and the InkWell widget, then the splash won't be visible because it will be under the opaque graphic. This is because ink splashes draw on the underlying Material itself, as if the ink was spreading inside the material.

Source

Solution is a tree structure that consists of Material -> Ink -> InkWell widgets where the Ink widget ensures that the image or decoration receives the ripple effect too.

Here's my code:

Card( // Renders a `Material` in its build method
  child: Ink.image(
    image: CachedNetworkImageProvider(imageUrl), // Using CachedNetworkImageProvider
    fit: BoxFit.cover,
    height: 200,
    child: InkWell(
      onTap: () {},
      child: Container()
    )
  )
)

Source

@creativebracket
Copy link

And I got this working with CachedNetworkImage widget:

CachedNetworkImage(
  imageUrl: imageUrl,
  imageBuilder: (context, imageProvider) {
    return Material(
      color: Colors.blueAccent,
      child: Ink.image(
        image: imageProvider,
        fit: BoxFit.cover,
        child: InkWell(onTap: () {}),
      ),
    );
  },
  placeholder: (context, url) => Center(
    child: SizedBox(
      width: 40,
      height: 40,
      child: CircularProgressIndicator(),
    ),
  ),
);

@otopba
Copy link

otopba commented Dec 19, 2020

any updates?

@graphicbeacon
Copy link

@otopba Did you try the above suggestion?

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

5 participants