diff --git a/example/lib/main.dart b/example/lib/main.dart index dfdffb1..48d3343 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -60,12 +60,14 @@ class _MyHomePageState extends State { icon: Icon(Icons.apps), title: Text('Home'), activeColor: Colors.red, + expandedBackgroundColor: Colors.black, textAlign: TextAlign.center, ), BottomNavyBarItem( icon: Icon(Icons.people), title: Text('Users'), activeColor: Colors.purpleAccent, + expandedBackgroundColor: Colors.yellowAccent, textAlign: TextAlign.center, ), BottomNavyBarItem( diff --git a/lib/bottom_navy_bar.dart b/lib/bottom_navy_bar.dart index 97ab25b..882585b 100644 --- a/lib/bottom_navy_bar.dart +++ b/lib/bottom_navy_bar.dart @@ -137,8 +137,11 @@ class _ItemWidget extends StatelessWidget { duration: animationDuration, curve: curve, decoration: BoxDecoration( - color: - isSelected ? item.activeColor.withOpacity(0.2) : backgroundColor, + color: isSelected + ? item.expandedBackgroundColor != null + ? item.expandedBackgroundColor + : item.activeColor.withOpacity(0.2) + : backgroundColor, borderRadius: BorderRadius.circular(itemCornerRadius), ), child: SingleChildScrollView( @@ -195,6 +198,7 @@ class BottomNavyBarItem { this.activeColor = Colors.blue, this.textAlign, this.inactiveColor, + this.expandedBackgroundColor }); /// Defines this item's icon which is placed in the right side of the [title]. @@ -210,6 +214,9 @@ class BottomNavyBarItem { /// The [icon] and [title] color defined when this item is not selected. final Color? inactiveColor; + /// The background color defined when this item is selected. + final Color? expandedBackgroundColor; + /// The alignment for the [title]. /// /// This will take effect only if [title] it a [Text] widget.