Search code examples
flutterflutter-layoutflutter-dependenciesflutter-webflutter-animation

Is it possible to use MaterialStatesController in different InkWell's statesController?


The problem is that when one of the inkwell is pressed, the other does not change its state.

Interactive example: https://dartpad.dev/?id=cd60f05128d673eb8625b4dc1885cd91

I need 2 inkwell to work as one. When you pressed circle, bar will pressed too, when you left circle, bar will change state to empty too. And vice versa.


Solution

  • My solution is to replace Inkwells with AnimatedContainer and check with GestureDetector whenever onTapDown and onTapUp, and change color of AnimatedContainer. Simple example: https://dartpad.dev/?id=551b0ffbd3d15352d89748329d3bd135