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

BottomNavyBar - Active Color opacity level manual configuration added #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ class _MyHomePageState extends State<MyHomePage> {
title: Text('Home'),
activeColor: Colors.red,
textAlign: TextAlign.center,
activeBorderColor: Colors.black
),
BottomNavyBarItem(
icon: Icon(Icons.people),
title: Text('Users'),
activeColor: Colors.purpleAccent,
textAlign: TextAlign.center,
inactiveBorderColor: Colors.brown
),
BottomNavyBarItem(
icon: Icon(Icons.message),
Expand Down
17 changes: 16 additions & 1 deletion lib/bottom_navy_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ class _ItemWidget extends StatelessWidget {
curve: curve,
decoration: BoxDecoration(
color:
isSelected ? item.activeColor.withOpacity(0.2) : backgroundColor,
isSelected ? item.activeColor.withOpacity(item.activeColorOpacityLevel) : backgroundColor,
borderRadius: BorderRadius.circular(itemCornerRadius),
border: Border.all(color: isSelected ? item.activeBorderColor : item.inactiveBorderColor, width: 2)
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
Expand Down Expand Up @@ -210,6 +211,9 @@ class BottomNavyBarItem {
this.activeColor = Colors.blue,
this.textAlign,
this.inactiveColor,
this.activeBorderColor = Colors.transparent,
this.inactiveBorderColor = Colors.transparent,
this.activeColorOpacityLevel = 0.2
}) : assert(icon != null),
assert(title != null);

Expand All @@ -226,6 +230,17 @@ class BottomNavyBarItem {
/// The [icon] and [title] color defined when this item is not selected.
final Color inactiveColor;

/// The [icon] and [title] border color defined when this item is selected. Defaults
/// to [Colors.transparent].
final Color activeBorderColor;

/// The [icon] and [title] border color defined when this item is not selected. Defaults
// to [Colors.transparent].
final Color inactiveBorderColor;

/// Used to configure active background opacity, if not set, it defaults to 0.2.
final double activeColorOpacityLevel;

/// The alignment for the [title].
///
/// This will take effect only if [title] it a [Text] widget.
Expand Down