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

Fix issue where Icon doesn't change color when selectedColor state change #31

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 5 additions & 2 deletions lib/src/anim_nav/animated_nav_tiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class AnimatedNavigationTiles extends StatelessWidget {
padding: items.badgePadding,
child: IconWidget(
item: items,
color: items.selectedColor,
Copy link
Owner

Choose a reason for hiding this comment

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

Unnecessary color parameter: The color parameter seems redundant. The existing item property already provides the necessary color information.

selected: selected,
iconSize: iconSize,
barAnimation: barAnimation,
Expand Down Expand Up @@ -360,11 +361,13 @@ class IconWidget extends StatefulWidget {
required this.selected,
required this.iconSize,
required this.barAnimation,
required this.color
});

final BottomBarItem item;
final bool selected;
final double iconSize;
final Color color;
final BarAnimation barAnimation;

@override
Expand Down Expand Up @@ -412,7 +415,7 @@ class _IconWidgetState extends State<IconWidget>

animationColor = ColorTween(
begin: widget.item.backgroundColor ?? widget.item.unSelectedColor,
end: widget.item.selectedColor,
end: widget.color,
Copy link
Owner

Choose a reason for hiding this comment

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

Replacing item.selectedColor with color might lead to unexpected behavior if the color parameter is not used correctly or consistently. It's unclear why this change was made without a clear explanation.

).animate(animation)
..addListener(() {
setState(() {});
Expand Down Expand Up @@ -442,7 +445,7 @@ class _IconWidgetState extends State<IconWidget>
(widget.selected
? widget.barAnimation == BarAnimation.transform3D
? widget.item.selectedColor
: animationColor.value
: widget.color
: widget.item.unSelectedColor),
size: widget.selected ? widget.iconSize + 4 : widget.iconSize,
),
Expand Down