lukepighetti / salomon_bottom_bar

Yet another bottom navigation bar, but with a few key promises.
https://pub.dev/packages/salomon_bottom_bar
MIT License
258 stars 55 forks source link

Added support for custom item shapes #7

Closed EriKWDev closed 3 years ago

EriKWDev commented 3 years ago

This PR adds support for custom item shapes other than just StadiumBorder. It can be specified per item or for all items. Mimicking the behaviour of the other parameters, the shape specified on each item takes priority over the shape defined for that BottomBar.

Example shape could be

RoundedRectangleBorder(
  borderRadius: BorderRadius.circular(10)
)
EriKWDev commented 3 years ago

Preview of custom shape

Screenshot 2021-06-16 at 15 28 14

...
SalomonBottomBarItem(
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(10)
  ),
  icon: const Icon(Icons.home_outlined),
  title: const Text("Home"),
),
...

or

...
SalomonBottomBar(
  itemShape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(10)
   ),
  currentIndex: _currentIndex,
  onTap: (i) => setState(() => _currentIndex = i),
  items: [
...
EriKWDev commented 3 years ago

Sure thing! I was a bit unsure wether to create a PR or not since I read that we should only do so if it doesn't conform to the spec, but I thought this could be a small and useful customisation for anyone wanting to use it :)

I agree it might be weird to have different shapes per item, but added it just in case. The global shape for every item is all I needed for my purposes. I'll fix it!