Skip to content

Instantly share code, notes, and snippets.

@edwardinubuntu
Created April 14, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardinubuntu/1abbcef172758c75da9461ab036bc3c9 to your computer and use it in GitHub Desktop.
Save edwardinubuntu/1abbcef172758c75da9461ab036bc3c9 to your computer and use it in GitHub Desktop.
Round radius bottom navigation bar
Widget get bottomNavigationBar {
const double _iconSize = 36;
Widget _emptyText = Container(
width: 0,
height: 0,
);
if (Platform.isAndroid) {
_emptyText = Text('');
}
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(_iconSize)),
child: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Icons.home,
),
title: _emptyText),
BottomNavigationBarItem(
icon: Icon(
Icons.search,
),
title: _emptyText),
BottomNavigationBarItem(
icon: Icon(
Icons.shopping_basket,
),
title: _emptyText),
BottomNavigationBarItem(
icon: Icon(
Icons.message,
),
title: _emptyText),
BottomNavigationBarItem(
icon: UserAvator.bottomBarIcon(url: _pageData['user_avatar_url']),
title: _emptyText)
],
onTap: (value) {
setState(() {
_selectedIndex = value;
});
},
iconSize: _iconSize,
currentIndex: _selectedIndex,
unselectedItemColor: MarcheColor.LightGrey,
selectedItemColor: MarcheColor.Red,
showSelectedLabels: false,
showUnselectedLabels: false,
type: BottomNavigationBarType.fixed,
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment