Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaffold bottomNavigationBar overlapping body content. How to prevent it

Tags:

flutter

I want to a dashboard with app bar and bottom navigation bar. But when i add listview or pageview in body(Scaffold) the content is overlapped with bottom navigation bar.

I have set the padding widget and aspect ratio widget but the content height vary in different screen size.

BottomNavigationBar(
        backgroundColor: Colors.white,
        currentIndex: _currentIndex,

        onTap: (index) {
          setState(() {
            _currentIndex = index;
          });
        },
        items: [
          BottomNavigationBarItem(
            icon: new Icon(Icons.chat_bubble),
            title: new TextView(
              'Conversations',
              size: 16.0,
              color: Colors.black,
              fontWeight: FontWeight.normal,
            ),
          ),
          BottomNavigationBarItem(
            icon: new Icon(Icons.dashboard),
            title: new TextView(
              'Matchboard',
              size: 16.0,
              color: Colors.black,
              fontWeight: FontWeight.normal,
            ),
          ),
          BottomNavigationBarItem(
              icon: Icon(Icons.person),
              title: TextView(
                'Match-o-Meter',
                size: 20.0,
                color: Colors.black,
                fontWeight: FontWeight.normal,
              ))
        ],
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: IndexedStack(index: _currentIndex, children: <Widget>[
              CouplingMatches(),
              MatchBoard(),
              MoMPage(),
            ]),
          ),
        ],
      ),

I want the body content in between appbar and bottom navigation bar but i getting the result as: Dashboard

i have scroll to down but content is overlapping with bottom navigation bar

like image 822
SoloWolf93 Avatar asked Sep 07 '19 06:09

SoloWolf93


People also ask

How can we avoid Android system navigation bar overlapping views at the bottom?

Some suggested putting BottomNavigationView and RecylerView in content layout (which implement app:layout_behavior="@string/appbar_scrolling_view_behavior" ) to avoid overlapping.

What is a Bottom navigation bar?

Bottom navigation bars make it easy for users to explore and switch between top-level views in a single tap. They should be used when an application has three to five top-level destinations.


2 Answers

Wrap the body of your Scaffold in a SafeArea widget.

like image 101
Lee Probert Avatar answered Oct 17 '22 11:10

Lee Probert


Please try to use these

  resizeToAvoidBottomInset: false,
  resizeToAvoidBottomPadding: false,

Change the parameter until you don't get output and remembar it's a property of Scafflod.

like image 1
Hardik Kumbhani Avatar answered Oct 17 '22 12:10

Hardik Kumbhani