I have bottom navigation bar with center item that looks like on this picture:
How to implement such a thing in Flutter?
I found that every icon that I put into BottomNavigatonBarItem is fitted inside navigation bar's bounds. But I need it to be hanged out above.
In addition to the inputs by @Raunak, you can also use the "border" attribute of the FloatingActionButton to get a seamless border to generate the desired effect - code snippet is below:
More better if you wrap the FAB inside a Material and add shadow effects to it - as below:
When tried, I got the below for effect 1- please note that the Border width can be adjusted to your wish!
Google recently added something called
BottomAppBar
and it provides a better way of doing this. Simply addBottomAppBar
in the scaffold create a navigation FAB and add a label to the FAB it you want it to have text. Creates a result similar to this: https://cdn-images-1.medium.com/max/1600/1*SEYUo6sNrW0RoKxyrYCqbg.png.You can a
Stack
to display widgets on the top of each others. Combined with the propertyoverflow
:Overflow.visible
, and an alignment that fits your need.The following example will achieve thing as in your picture : A floating button horizontally centered, top aligned with the bottom bar.
You can also do this using FloatingActionButtonLocation and Expanded widget like this:
Preview: