Search code examples
flutterflutter-appbar

Flutter Inherited Custom AppBar disappear on TextField tap


I'm using a custom appBar and a bottomNavigationBar in a Scaffold, per below code:

return Scaffold(
      appBar: LogoAppBar(),
      drawer: topDrawer(),
      body: _pageOptions[_selectedTab],
      bottomNavigationBar: BottomNavigationBar(...)

When I navigate via the BottomNavigationBar the custom AppBar sticks at the top of the new screen, just like I want it to.

However, when I navigate and thereafter tap on a TextField on the new screen to enter some text, the inherited AppBar automatically disappear (when the keyboard shows up).

The full code for this screen is rather long and therefore rather impractical to post here, but it basically boils down to the following:

return Scaffold(
     backgroundColor: Colors.white,
     body: Column(
       children: [
       Container(
         Column(
          children: [
            DropDownButton(...),
            TextField(...), // with a textSearchController
          ],
       Expanded(
          child: ListViewBuilder(...) // showing a list based on the search

Is there any way to make the AppBar from the inherited class stick without putting a new appBar in the Scaffold in the class I navigated to?


Solution

  • Ujjwal's suggestion was incredibly helpful. I removed the Scaffold and unfortunately the problem persisted, but it made me realize that I had also wrapped the LogoAppBar() code in a Scaffold. Once I removed the Scaffold from the LogoAppBar() it all worked!