There is no direct way to adjust the padding of BottomNavigationBarItem in Flutter. However, you can use the SizedBox widget to set the width and height of the icon and label in each BottomNavigationBarItem.
Here's an example:
BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: SizedBox(
width: 24,
height: 24,
child: Icon(Icons.home),
),
title: SizedBox(
height: 0, // set the height to 0 to remove the label
),
),
BottomNavigationBarItem(
icon: SizedBox(
width: 24,
height: 24,
child: Icon(Icons.search),
),
title: SizedBox(
height: 0,
),
),
BottomNavigationBarItem(
icon: SizedBox(
width: 24,
height: 24,
child: Icon(Icons.settings),
),
title: SizedBox(
height: 0,
),
),
],
),
In this example, the width and height of the icon are set to 24 using the SizedBox widget. The height of the label is set to 0 to remove it.
You can adjust the width and height values as per your requirement to achieve the desired padding.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-03-11 11:00:00 +0000
Seen: 16 times
Last updated: Nov 04 '21
How can I make a Plotly chart in a Dash app that takes up the entire screen?
Do isotopes occupy rows of equal height?
What is the method for displaying a background image at its full height?
How can the type 'string' be made assignable to the Icon type in Material UI?
How can Ionicons be aligned with text?
What is the most effective way to automatically adjust the size of icons in Tkinter?
Is it necessary to incorporate <link rel="icon" href="favicon.ico" type="image/x-icon" />?