Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in counting tooltips between pages #18

Open
PrimeTheFirst opened this issue Oct 8, 2024 · 1 comment
Open

Issue in counting tooltips between pages #18

PrimeTheFirst opened this issue Oct 8, 2024 · 1 comment

Comments

@PrimeTheFirst
Copy link

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
Copy link
Author

PrimeTheFirst commented Oct 8, 2024

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant