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

Minimized the space between the icon and the title #112

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class _MyHomePageState extends State<MyHomePage> {
BottomNavyBarItem(
icon: Icon(Icons.message),
title: Text(
'Messages test for mes teset test test ',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That example is on purpose!

'Messages',
),
activeColor: Colors.pink,
textAlign: TextAlign.center,
Expand Down
34 changes: 16 additions & 18 deletions lib/bottom_navy_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,22 @@ class _ItemWidget extends StatelessWidget {
container: true,
selected: isSelected,
child: AnimatedContainer(
width: isSelected ? 130 : 50,
width: isSelected ? 130 : 50, // Limit the width here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to add this comment?

height: double.maxFinite,
duration: animationDuration,
curve: curve,
decoration: BoxDecoration(
color:
isSelected ? item.activeColor.withOpacity(0.2) : backgroundColor,
color: isSelected ? item.activeColor.withOpacity(0.2) : backgroundColor,
borderRadius: BorderRadius.circular(itemCornerRadius),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
child: Container(
width: isSelected ? 130 : 50,
width: isSelected ? 130 : 50, // Limit the width here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my previous comment

padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.min, // Change to MainAxisSize.min to reduce space
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expand All @@ -188,24 +187,22 @@ class _ItemWidget extends StatelessWidget {
color: isSelected
? item.activeColor.withOpacity(1)
: item.inactiveColor == null
? item.activeColor
: item.inactiveColor,
? item.activeColor
: item.inactiveColor,
),
child: item.icon,
),
if (isSelected)
Expanded(
child: Container(
padding: itemPadding,
child: DefaultTextStyle.merge(
style: TextStyle(
color: item.activeColor,
fontWeight: FontWeight.bold,
),
maxLines: 1,
textAlign: item.textAlign,
child: item.title,
Container(
padding: itemPadding,
child: DefaultTextStyle.merge(
style: TextStyle(
color: item.activeColor,
fontWeight: FontWeight.bold,
),
maxLines: 1,
textAlign: item.textAlign,
child: item.title,
),
),
],
Expand All @@ -217,6 +214,7 @@ class _ItemWidget extends StatelessWidget {
}
}


/// The [BottomNavyBar.items] definition.
class BottomNavyBarItem {
BottomNavyBarItem({
Expand Down
Loading