jb3rndt / PersistentBottomNavBarV2

A highly customizable persistent bottom navigation bar for Flutter
https://pub.dev/packages/persistent_bottom_nav_bar_v2
BSD 3-Clause "New" or "Revised" License
49 stars 56 forks source link

[Bug]: Auto dispose when I am using Getx as stateManagement #166

Closed felix0324324 closed 6 months ago

felix0324324 commented 6 months ago

Version

5.2.0

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.19.2, on macOS 14.4.1 23E224 darwin-arm64, locale
    zh-HK)
    • Flutter version 3.19.2 on channel stable at /Users/alvis/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7482962148 (3 months ago), 2024-02-27 16:51:22 -0500
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/alvis/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/alvis/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.9+0-17.0.9b1087.7-11185874)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 63.2.4
    • Dart plugin version 213.5744.122

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.88.0

What platforms are you seeing the problem on?

No response

What happened?

I am using "Getx" Library

but the autoRemove is no problem with PersistentBottomNavBar (but PersistentBottomNavBar got a switch tab black. screen problem).

so I use "PersistentBottomNavBarV2" but it auto dispose my widget when I just push page.

Steps to reproduce

  1. call - Get.toNamed(Routes.BOTTOM_NAV_BAR);
  2. Push to BottomNavBar page
  3. Auto dispose with BottomNavBar controller

Code to reproduce the problem

PersistentTabView(
      stateManagement: false,
      controller: controller.myTabController,
      gestureNavigationEnabled: true,
      tabs: aList,
      navBarBuilder: (navBarConfig) => Style10BottomNavBar(
        navBarConfig: navBarConfig,
      ),
    );

Relevant log output

[GETX] Instance "BottomNavBarController" has been created
[GETX] Instance "BottomNavBarController" has been initialized
[GETX] Instance "HomeController" has been created
[GETX] Instance "HomeController" has been initialized
[GETX] GOING TO ROUTE /bottom-nav-bar
[GETX] "HomeController" onDelete() called
[GETX] "HomeController" deleted from memory
[GETX] "BottomNavBarController" onDelete() called
[GETX] "BottomNavBarController" deleted from memory
[GETX] Instance "HomeController" already removed.
[GETX] Instance "BottomNavBarController" already removed.

Screenshots

No response

felix0324324 commented 6 months ago
image

I got the solution... Thanks!! It's a useful lib "PersistentBottomNavBarV2" !!

spn107 commented 5 months ago

Hello, I added "permanent: true" this but still now getting same issue. Can you guys help me to solve this?

jb3rndt commented 4 months ago

I'm not familiar with the GetX package. Maybe first check that you are running the latest version (run dart pub upgrade)