buildIconShadows function
Builds multi-directional icon shadows that simulate a stroke/outline effect.
Returns null (no shadow) when:
thicknessis null (feature not requested), orselectedis true ANDactiveIconis non-null (distinct active icon is used so outline shadow is not needed in that state).
Otherwise, generates 8 evenly-spaced Shadow offsets around the icon at
the given thickness radius using 45° increments.
Extracted from BottomBarTabItem to enable isolated unit testing.
Implementation
@visibleForTesting
List<Shadow>? buildIconShadows({
required Color iconColor,
required double? thickness,
required bool selected,
required Widget? activeIcon,
}) {
if (thickness == null || (selected && activeIcon != null)) return null;
final shadows = <Shadow>[];
const step = math.pi / 4;
for (double a = 0; a < math.pi * 2; a += step) {
shadows.add(Shadow(
color: iconColor,
offset: Offset.fromDirection(a, thickness),
));
}
return shadows;
}