tutorial_coach_mark icon indicating copy to clipboard operation
tutorial_coach_mark copied to clipboard

Handle "TutorialCoachMark (ERROR): It was not possible to obtain target position."

Open EskAere opened this issue 4 years ago • 1 comments

Hi !

When this error occurs, a white overlay covers the entire app. The user is forced to restart the application.

Or can I handle this exception ?

The code in Widget _buildContents() should handle a null target, don't you think ?

TargetPosition target = getTargetCurrent(currentTarget);

    var positioned = Offset(
      target.offset.dx + target.size.width / 2,
      target.offset.dy + target.size.height / 2,
    );

In my app, this error often happens because tutorials are added on multiple tabs. If the user taps on a tab, the tutorial is activated. But if he also clicks quickly on another tab, it will result in the following error : TutorialCoachMark (ERROR): It was not possible to obtain target position, because the target is no longer on screen.

Thanks !

EskAere avatar Mar 16 '21 12:03 EskAere

I would suggest wrapping your Screens with an Ignore Pointer / Absorb Pointer to handle unwanted taps and ignore the taps while the tutorial is not finished (I am personally keeping track of each individual tutorial with a bool, its easy to manage with your state-management of choice). I don't think that this error should be the norm.

Wizzel1 avatar Mar 20 '21 14:03 Wizzel1