How do we disable swipe on BottomNavigationBar attached to a scaffold?
I could not find a way in the official docs to do so.
How do we disable swipe on BottomNavigationBar attached to a scaffold?
I could not find a way in the official docs to do so.
Got it:
Just use
physics: const NeverScrollableScrollPhysics()
on your scrollable widget!
I use Auto Route package so for me this means adding
physics: const NeverScrollableScrollPhysics()
to AutoTabsRouter.pageView
return AutoTabsRouter.pageView(
physics: const NeverScrollableScrollPhysics(), // <-----
routes: const [
Route1(),
Route2(),
Route3(),
],
builder: (context, child, pageController) {
return Scaffold(
body: child,
bottomNavigationBar: AppBottomNavBar(
currentIndex: context.tabsRouter.activeIndex,
setActiveIndex: context.tabsRouter.setActiveIndex),
);
},
);
© 2022 - 2024 — McMap. All rights reserved.