talamaska / onboarding_overlay

MIT License
42 stars 23 forks source link

Can a onStart function be added or simply call onChanged for the first step? #62

Open bcaspe opened 1 day ago

bcaspe commented 1 day ago

I'm trying to call a method for each step that is shown and the onChanged method is only called from _nextStep, not startStepper. Is it possible to either call onChanged in startStepper or add another method like onStart which we can pass into the Onboarding widget. I can open a pr if that helps

talamaska commented 1 day ago

I think your request is reasonable. Do you mind me ask why you need that? There are 2 things that you can do if you are going to make a PR. First expose a property to pass an onboarding controller, which is a change notifier which you could listen to and perform your task (e.g tracking analytics), or create a new callback onStart, here you should figure out when exactly to call this, plus I don't think you need to update the current index in the controller, like I do in the onChange callback, because it is updated whenever the show or showWithSteps methods are called, they are responsible to show the overlay.

bcaspe commented 23 hours ago

I was looking for a solution because I wanted to add audio files to each step which verbally told the user information so they wouldn't have to read it all. I made a fork where I added an void callback onshowstep method to the onboarding step, and then I call that in the stepper in the start method and the next step method if the step has it.

In the method, I play the audio file related to each step. It works quite well.

On Sun, Nov 17, 2024, 22:33 Zlati Pehlivanov @.***> wrote:

I think your request is reasonable. Do you mind me ask why you need that? There are 2 things that you can do if you are going to make a PR. First expose a property to pass an onboarding controller, which is a change notifier which you could listen to and perform your task (e.g tracking analytics), or create a new callback onStart, here you should figure out when exactly to call this, plus I don't think you need to update the current index in the controller, like I do in the onChange callback, because it is updated whenever the show or showWithSteps methods are called, they are responsible to show the overlay.

— Reply to this email directly, view it on GitHub https://github.com/talamaska/onboarding_overlay/issues/62#issuecomment-2481604413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAETNITJ4JO43QTJ7QPK5232BEDRVAVCNFSM6AAAAABR5VBH26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBRGYYDINBRGM . You are receiving this because you authored the thread.Message ID: @.***>

bcaspe commented 23 hours ago

I can make a pr if you'd like.

On Sun, Nov 17, 2024, 23:09 Brian Caspe @.***> wrote:

I was looking for a solution because I wanted to add audio files to each step which verbally told the user information so they wouldn't have to read it all. I made a fork where I added an void callback onshowstep method to the onboarding step, and then I call that in the stepper in the start method and the next step method if the step has it.

In the method, I play the audio file related to each step. It works quite well.

On Sun, Nov 17, 2024, 22:33 Zlati Pehlivanov @.***> wrote:

I think your request is reasonable. Do you mind me ask why you need that? There are 2 things that you can do if you are going to make a PR. First expose a property to pass an onboarding controller, which is a change notifier which you could listen to and perform your task (e.g tracking analytics), or create a new callback onStart, here you should figure out when exactly to call this, plus I don't think you need to update the current index in the controller, like I do in the onChange callback, because it is updated whenever the show or showWithSteps methods are called, they are responsible to show the overlay.

— Reply to this email directly, view it on GitHub https://github.com/talamaska/onboarding_overlay/issues/62#issuecomment-2481604413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAETNITJ4JO43QTJ7QPK5232BEDRVAVCNFSM6AAAAABR5VBH26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBRGYYDINBRGM . You are receiving this because you authored the thread.Message ID: @.***>