-1

I want to remove the ripple effect from a transparent clickable container but no matter what I do the effect just doesn't go away, please help!

Code:

InkWell(
 onTap: (){print('Tapped');},
   child: Container(
     height: 200, width: 200,),)
Siddharth Mehra
  • 1,691
  • 1
  • 9
  • 32
  • 1
    The main purpose of choosing `InkWell` is to enjoy its "ripple effect". If you don't want it, use `GestureDetector` instead. – WSBT Oct 15 '21 at 06:22

4 Answers4

2

use GestureDetector instead:

GestureDetector(
 onTap: () {print('Tapped');},
   child: Container(
     height: 200, width: 200,
   ),
 )
WSBT
  • 33,033
  • 18
  • 128
  • 133
Jim
  • 6,928
  • 1
  • 7
  • 18
2

Put Following Line in Your Material App Widget ThemeData

highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
splashColor: Colors.transparent,
splashFactory: NoSplash.splashFactory,

Like

theme: ThemeData(
      highlightColor: Colors.transparent,
      hoverColor: Colors.transparent,
      splashColor: Colors.transparent,
      splashFactory: NoSplash.splashFactory,
)
MORE AKASH
  • 283
  • 1
  • 8
1

I use it like this:

InkWell(
  excludeFromSemantics: true,
  canRequestFocus: false,
  enableFeedback: false,
  splashFactory: NoSplash.splashFactory,
  splashColor: Colors.transparent,
  highlightColor: Colors.transparent,
  focusColor: Colors.transparent,
  hoverColor: Colors.transparent,
  overlayColor: MaterialStateProperty.all(Colors.transparent),
  onTap: widget.onPressed,
  child: child,
);
Kyo Huu
  • 520
  • 7
  • 13
1

Use GestureDetector instead of InkWell because Inkwell provide by default ripple effect, So you can use GestureDetector.