-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Feature, solid background #83 #84
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ import 'package:flutter/widgets.dart'; | |
/// Update [selectedIndex] to change the selected item. | ||
/// [selectedIndex] is required and must not be null. | ||
class BottomNavyBar extends StatelessWidget { | ||
|
||
BottomNavyBar({ | ||
Key? key, | ||
this.selectedIndex = 0, | ||
|
@@ -23,8 +22,8 @@ class BottomNavyBar extends StatelessWidget { | |
required this.items, | ||
required this.onItemSelected, | ||
this.curve = Curves.linear, | ||
}) : assert(items.length >= 2 && items.length <= 5), | ||
super(key: key); | ||
}) : assert(items.length >= 2 && items.length <= 5), | ||
super(key: key); | ||
|
||
/// The selected item is index. Changing this property will change and animate | ||
/// the item being selected. Defaults to zero. | ||
|
@@ -125,7 +124,7 @@ class _ItemWidget extends StatelessWidget { | |
required this.itemCornerRadius, | ||
required this.iconSize, | ||
this.curve = Curves.linear, | ||
}) : super(key: key); | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
|
@@ -138,8 +137,11 @@ class _ItemWidget extends StatelessWidget { | |
duration: animationDuration, | ||
curve: curve, | ||
decoration: BoxDecoration( | ||
color: | ||
isSelected ? item.activeColor.withOpacity(0.2) : backgroundColor, | ||
color: isSelected | ||
? item.solidBackground | ||
? item.activeColor | ||
: item.activeColor.withOpacity(0.2) | ||
: backgroundColor, | ||
borderRadius: BorderRadius.circular(itemCornerRadius), | ||
), | ||
child: SingleChildScrollView( | ||
|
@@ -157,7 +159,9 @@ class _ItemWidget extends StatelessWidget { | |
data: IconThemeData( | ||
size: iconSize, | ||
color: isSelected | ||
? item.activeColor.withOpacity(1) | ||
? item.solidBackground | ||
? Colors.white | ||
: item.activeColor.withOpacity(1) | ||
Comment on lines
+162
to
+164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused, the property is called |
||
: item.inactiveColor == null | ||
? item.activeColor | ||
: item.inactiveColor, | ||
|
@@ -170,7 +174,9 @@ class _ItemWidget extends StatelessWidget { | |
padding: EdgeInsets.symmetric(horizontal: 4), | ||
child: DefaultTextStyle.merge( | ||
style: TextStyle( | ||
color: item.activeColor, | ||
color: item.solidBackground | ||
? Colors.white | ||
: item.activeColor, | ||
Comment on lines
+177
to
+179
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
fontWeight: FontWeight.bold, | ||
), | ||
maxLines: 1, | ||
|
@@ -190,13 +196,13 @@ class _ItemWidget extends StatelessWidget { | |
|
||
/// The [BottomNavyBar.items] definition. | ||
class BottomNavyBarItem { | ||
|
||
BottomNavyBarItem({ | ||
required this.icon, | ||
required this.title, | ||
this.activeColor = Colors.blue, | ||
this.textAlign, | ||
this.inactiveColor, | ||
this.solidBackground = false, | ||
}); | ||
|
||
/// Defines this item's icon which is placed in the right side of the [title]. | ||
|
@@ -217,4 +223,7 @@ class BottomNavyBarItem { | |
/// This will take effect only if [title] it a [Text] widget. | ||
final TextAlign? textAlign; | ||
|
||
/// The [background] solid color defined when this item is selected. Defaults | ||
/// to [false]. | ||
final bool solidBackground; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe change it to: If [true], use the solid color for the background of this item. Defaults to [false]. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary changes