tal-tech / flutter_intro

A better way for new feature introduction and step-by-step users guide for your Flutter project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: expose isOpen in the api

lff5 opened this issue · comments

commented

Hi.

I want to have Android's back button to work properly.
Right now thats my code:

          if (Platform.isAndroid) {
            return WillPopScope(
              onWillPop: () async {
                intro.dispose();
                if (Navigator.of(context).canPop()) {
                  return true;
                }
             },);
          }

It does close the intro stepper but if the app navigation is on root level it also exits the app or moves back which is unintended. So i would need to have some feedback on whether intro was closed.
Either should intro.dispose() return if anything was closed or there should be isOpen function in the api. The last being much more universal for other purposes too.
Thank you!

Thank you for your suggestion, I will expose the api as soon as possible

onWillPop: () async {
// sometimes you need get current status
IntroStatus introStatus = intro.getStatus();
if (introStatus.isOpen) {
// destroy guide page when tap back key
intro.dispose();
return false;
}
return true;
},

Version 2.1.0 has just been released, and now you can execute the getStatus method to get the current status. Finally, thank you very much for your suggestions.