Deuque / overlay_tooltip

An overlay tooltip handler for onboarding
BSD 3-Clause "New" or "Revised" License
16 stars 26 forks source link

Issue in counting tooltips between pages #18

Open PrimeTheFirst opened 1 month ago

PrimeTheFirst commented 1 month ago

Issue: Using a bottom nav bar, every page has tooltips numbered 1 to n. However say page 1 has 7 tooltips. It says "x of 7". Page 2 has 3 tooltips. It still says "x of 7".

PrimeTheFirst commented 1 month ago

@Deuque I wrote this function, so that if the page is changed, it resets the controller

@override
  void didChangeDependencies() {
    super.didChangeDependencies();
    var tripProvider = Provider.of<TripProvider>(context);

    // Get the current page name (You can customize this)
    int currentPage = tripProvider.selectedIndex;

    // Check if the current page is different from the last known page
    if (currentPage != _lastPage) {
      print("erer");
      // Dismiss the tooltips
      tooltip_controller.dismiss(); 

      // Update the last known page variable
      setState(() {
        _lastPage = tripProvider.selectedIndex;
      });
    }
  }

Only the first page is working, not the pages after I change them The function runs every time a different page is selected. The controller does not seem to be resetting?