SimformSolutionsPvtLtd / flutter_showcaseview

Flutter plugin that allows you to showcase your features on flutter application. 👌🔝🎉
https://pub.dev/packages/showcaseview
MIT License
1.52k stars 438 forks source link

Trigger widget click #438

Closed erperejildo closed 3 months ago

erperejildo commented 5 months ago

It sounds pretty simple, but I don't know how I could do such a thing. Considering I have this widget:

return Showcase(
              key: widget.incomeCardKey,
              disableBarrierInteraction: true,
              description: 'Something',
              onTargetClick: () => debugPrint('target clicked'),
              disposeOnTap: true,
              child: WhatEver()
            );

WhatEver is not a simple element like:

ElevatedButton(
  onPressed: () {
    print('Button clicked!');
  },
  child: Text('Click Me'),
)

it is a bunch of different elements with more than one option to click, so I don't know exactly which button is going to be clicked.

So, can I have something like triggerElementClick: true or similar?

rashi-simform commented 3 months ago

Hello @erperejildo , The onTargetClick parameter is only triggered during the showcase event. If you want to perform any action when clicking the widget without a showcase, you can use the onPressed method for that.

The default onClick behaviour for showcase is provided and can be disabled by setting the disableDefaultTargetGestures parameter to false. Therefore, the triggerElementClick parameter you mentioned already has an parameter, disableDefaultTargetGestures with opposite behaviour.

rashi-simform commented 3 months ago

Closing the issue, please feel free to let me know if you need any help with this.

erperejildo commented 2 months ago

@rashi-simform could you provide the implementation, I can't figure it out. I want to click on the element (not anywhere else) and trigger that element onTap() without calling it manually. After being triggered, I display the next showcase element