Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text and background color #90

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lib/bottom_navy_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ class _ItemWidget extends StatelessWidget {
duration: animationDuration,
curve: curve,
decoration: BoxDecoration(
color:
isSelected ? item.activeColor.withOpacity(0.2) : backgroundColor,
color: isSelected
? (item.activeBackgroundColor ??
item.activeColor.withOpacity(0.2))
: backgroundColor,
borderRadius: BorderRadius.circular(itemCornerRadius),
),
child: SingleChildScrollView(
Expand Down Expand Up @@ -169,7 +171,7 @@ class _ItemWidget extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 4),
child: DefaultTextStyle.merge(
style: TextStyle(
color: item.activeColor,
color: item.activeTextColor ?? item.activeColor,
fontWeight: FontWeight.bold,
),
maxLines: 1,
Expand All @@ -195,6 +197,8 @@ class BottomNavyBarItem {
this.activeColor = Colors.blue,
this.textAlign,
this.inactiveColor,
this.activeTextColor,
this.activeBackgroundColor,
});

/// Defines this item's icon which is placed in the right side of the [title].
Expand All @@ -214,4 +218,14 @@ class BottomNavyBarItem {
///
/// This will take effect only if [title] it a [Text] widget.
final TextAlign? textAlign;

/// The [title] color with higher priority than [activeColor]
///
/// Will fallback to [activeColor] when null
final Color? activeTextColor;

/// The [BottomNavyBarItem] background color when active.
///
/// Will fallback to [activeColor] with opacity 0.2 when null
final Color? activeBackgroundColor;
}