Skip to content

Commit

Permalink
Solved the Render Overflow Problem
Browse files Browse the repository at this point in the history
'Messages test for mes teset test test ''
Miniimized the gap
  • Loading branch information
Sanskar2807 committed Sep 18, 2023
1 parent f7dfdc9 commit 723fc8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
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',
'Messages test for mes teset test test ',
),
activeColor: Colors.pink,
textAlign: TextAlign.center,
Expand Down
23 changes: 13 additions & 10 deletions lib/bottom_navy_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class _ItemWidget extends StatelessWidget {
container: true,
selected: isSelected,
child: AnimatedContainer(
width: isSelected ? 130 : 50, // Limit the width here
width: isSelected ? 130 : 50,
height: double.maxFinite,
duration: animationDuration,
curve: curve,
Expand All @@ -174,7 +174,8 @@ class _ItemWidget extends StatelessWidget {
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
child: Container(
width: isSelected ? 130 : 50, // Limit the width here
// Remove fixed width, let it adjust based on content
// width: isSelected ? 130 : 50, // Limit the width here
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisSize: MainAxisSize.min, // Change to MainAxisSize.min to reduce space
Expand All @@ -194,15 +195,17 @@ class _ItemWidget extends StatelessWidget {
),
if (isSelected)
Container(
padding: itemPadding,
child: DefaultTextStyle.merge(
style: TextStyle(
color: item.activeColor,
fontWeight: FontWeight.bold,
padding: EdgeInsets.only(left: 4), // Adjust left padding here
child: Flexible( // Use Flexible instead of Expanded
child: DefaultTextStyle.merge(
style: TextStyle(
color: item.activeColor,
fontWeight: FontWeight.bold,
),
maxLines: 1,
textAlign: item.textAlign,
child: item.title,
),
maxLines: 1,
textAlign: item.textAlign,
child: item.title,
),
),
],
Expand Down

0 comments on commit 723fc8f

Please sign in to comment.