PersistentBottomNavBarV2
PersistentBottomNavBarV2 copied to clipboard
rebuilld
at keyboard height changed will be rebuild
Yes because e.g. the layout of the screen has to be recalculated. Does that break something for you?
@jb3rndt I have an issue with rebuilding on other screens when the keyboard pops up on one screen.
Here is how my widgets are arranged;
class CustomNavBar extends StatefulWidget {
const CustomNavBar({Key? key, required this.initialPage}) : super(key: key);
final int initialPage;
@override
State<CustomNavBar> createState() => _CustomNavBarState();
}
class _CustomNavBarState extends State<CustomNavBar> {
late PersistentTabController _controller;
@override
void initState() {
_controller = PersistentTabController(initialIndex: widget.initialPage);
super.initState();
}
List<Widget> _buildScreens() {
return [
const Screen1(),
const Screen2(),
const Screen3(),
];
}
...
@override
Widget build(BuildContext context) {
return PersistentTabView(
context,
controller: _controller,
screens: _buildScreens(),
...
handleAndroidBackButtonPress: true, // Default is true.
resizeToAvoidBottomInset: false,
stateManagement: true, // Default is true.
hideNavigationBarWhenKeyboardShows: true,
popAllScreensOnTapOfSelectedTab: false,
// popActionScreens: PopActionScreensType.once,
);
}
}
When I open the keyboard on screen 2, other screens would rebuild, and I lose the state of the screen. For example, on screen 3, I have pageview which will reset after calling the keyboard on screen 2.
I tried reproducing your issue, but didnt observe what you described. Can you send a full minimal example that doesnt work?
@jb3rndt I have managed to keep the state of the page that I wanted to. Still, the build method of the screens would be called whenever the keyboard moves. I will try to make a minimal example and share it here.