akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.38k stars 381 forks source link

Inkwell cannot be tap inside panel builder #152

Open ryanhoo95 opened 4 years ago

ryanhoo95 commented 4 years ago

Describe the bug Difficult to detect inkwell's onTap when using panelBuilder.

To Reproduce Use panelBuilder to add content which consist of inkwell and listview. The inkwell's onTap is hard to trigger.

claytonjacobs commented 4 years ago

I'm having the same exact issue. For some reason it's registering the taps behind the sliding panel, instead of the Inkwell. But it looks like this issue doesn't discriminate because it occurs with pretty much any 'onTap' or 'onClick'.

json469 commented 4 years ago

+1

Only way around this is to wrap Material around the onPress-able widget, however if there are custom colors involved (which is most likely) there are additional work on styling.

For example, all my ButtonIcon and Buttons did not cause the 'ripple effect' so had to wrap it around a ClipRRect (for borderRadius) and Material, then followed by actual child Widget:

ClipRRect(
      borderRadius: BorderRadius.all(Radius.circular(16.0)),
      // TODO: Bug on sliding panel not triggering InkWell #https://github.com/akshathjain/sliding_up_panel/issues/152
      child: Material(
        color: colourLight,
        child: Container(
          child: IconButton(
            icon: icon,
            iconSize: 36.0,
            color: colourBold,
            onPressed: onPressed,
          ),
        ),
      ),
    );
  }
jaween commented 3 years ago

Looks like this is still happening. A slightly more subtle variation of @json469's useful workaround is to use a Material with type set to MaterialType.transparency so that only the ink splashes and highlights occur.

return Material(
  type: MaterialType.transparency,
  child: IconButton(
    icon: Icon(Icons.add),
    onPressed: (){},
  ),
);