In Flutter, to hide an AppBar and BottomNavigationBar while scrolling, you can use the ScrollController and listen to the user's scroll events to determine when to show or hide these widgets. The SliverAppBar widget can be used for the AppBar, which comes with the capability to hide on scroll when the floating and snap properties are set to false, and pinned is set to false. For the BottomNavigationBar, you would have to implement the logic manually.
Here's a basic example of how you can achieve this:
In this example, we have a CustomScrollView with a SliverAppBar and a SliverList. The SliverAppBar's pinned property is set to false, so it will hide when scrolling down. We're also using a ScrollController (_hideBottomNavController) to listen to scroll events and toggle the visibility of the BottomNavigationBar based on the scroll direction. When the user scrolls up (ScrollDirection.forward), the BottomNavigationBar appears, and when the user scrolls down (ScrollDirection.reverse), it disappears.
Make sure you dispose of the ScrollController in the dispose method to prevent memory leaks.
This approach gives you a basic example of how to show and hide the AppBar and BottomNavigationBar while scrolling. You might want to add some animations or make other adjustments to fit the specific look and feel of your app.