PersistentBottomNavBar icon indicating copy to clipboard operation
PersistentBottomNavBar copied to clipboard

Black screen when switching instantly

Open Cagefighter0012 opened this issue 4 years ago • 11 comments
trafficstars

When switching between two bottom bar item instantly (before that animation ends) cause a black screen. Any idea how to fix?

Cagefighter0012 avatar Apr 07 '21 19:04 Cagefighter0012

Any possible solution found? Im stuck on this as well. Not suited for production.

OSonntag avatar May 27 '21 09:05 OSonntag

J'ai le même problème.

mykamla avatar May 29 '21 04:05 mykamla

When switching between two bottom bar item instantly (before that animation ends) cause a black screen. Any idea how to fix?

Hi! @Cagefighter0012 @OSonntag

The problem is on Offset(_animations[index]!.value, 0) on _animations[index]!.value, in the _buildScreen() method in lib/models/lib/models/persistent-nav-bar-scaffold.widget.dart

Do that: 1 - Change _animations [index] !. value to a static value, example: Offset (0, 0) ou 2 - Change Transform.translate() above, for another example: Transform.rotate() ou 3 - Remove all:

                  return shouldBuildTab[index]
                      ? widget.tabBuilder(context, index)
                      : Container();
                  /* 
                  return shouldBuildTab[index]
                      ? (widget.screenTransitionAnimation!.animateTabTransition
                          ? AnimatedBuilder(
                              animation: _animations[index]!,
                              builder: (context, child) => Transform.translate(
                                offset: Offset(_animations[index]!.value, 0),
                                child: widget.tabBuilder(context, index),
                              ),
                            )
                          : widget.tabBuilder(context, index))
                      : Container();
                  */

4 - etc

mykamla avatar Jun 01 '21 04:06 mykamla

Quickest fix I've found for this is to just change the container colour from black to whatever suits you (persistent-nav-bar-scaffold.widget.dart, ln: 418).

Not that I'm endorsing changing code in imported packages or anything. That should not be done, ever. This really needs to be fixed in the package itself by the dev and published. With the best solution (IMHO) being to expose this as a setting for the devs.

Since this does have a simple solution, can we expect it to be fixed soon?

ookamisensei avatar Jun 14 '21 09:06 ookamisensei

Same issue here, but the big problem is that sometimes it remains black, until a next tab change

EmanuelDavid avatar Jul 16 '21 13:07 EmanuelDavid

Yeah this haven't been fixed since last year, @BilalShahid13 do you have time to take a look a it?

francoguilherme avatar Jul 28 '21 16:07 francoguilherme

If the animation is disabled all is good, the black screen is gone, but it looks nice with the transition animation: In PersistentTabView's constructor, remove screenTransitionAnimation.

EmanuelDavid avatar Aug 30 '21 09:08 EmanuelDavid

Any update?

kjawadDeveloper1 avatar Feb 15 '22 06:02 kjawadDeveloper1

Looking into it

jb3rndt avatar Mar 02 '22 20:03 jb3rndt

Its fixed since version 4.1.6 over at https://github.com/jb3rndt/PersistentBottomNavBarV2

jb3rndt avatar Mar 18 '22 23:03 jb3rndt