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

make width of items configurable #93

Open
wants to merge 1 commit 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
12 changes: 10 additions & 2 deletions lib/bottom_navy_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class _ItemWidget extends StatelessWidget {
container: true,
selected: isSelected,
child: AnimatedContainer(
width: isSelected ? 130 : 50,
width: isSelected ? item.selectedWidth : item.width,
height: double.maxFinite,
duration: animationDuration,
curve: curve,
Expand All @@ -145,7 +145,7 @@ class _ItemWidget extends StatelessWidget {
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
child: Container(
width: isSelected ? 130 : 50,
width: isSelected ? item.selectedWidth : item.width,
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisSize: MainAxisSize.max,
Expand Down Expand Up @@ -193,6 +193,8 @@ class BottomNavyBarItem {
required this.icon,
required this.title,
this.activeColor = Colors.blue,
this.selectedWidth = 130,
this.width = 50,
this.textAlign,
this.inactiveColor,
});
Expand All @@ -206,6 +208,12 @@ class BottomNavyBarItem {
/// The [icon] and [title] color defined when this item is selected. Defaults
/// to [Colors.blue].
final Color activeColor;

/// Defines the selected item width. Defaults to 130.
final double selectedWidth;

/// Defines the item width. Defaults to 50.
final double width;

/// The [icon] and [title] color defined when this item is not selected.
final Color? inactiveColor;
Expand Down