diff --git a/app/lib/ui/adaptive/floating_tab_button.dart b/app/lib/ui/adaptive/floating_tab_button.dart index 375e215d..02b4ea64 100644 --- a/app/lib/ui/adaptive/floating_tab_button.dart +++ b/app/lib/ui/adaptive/floating_tab_button.dart @@ -156,6 +156,11 @@ class FloatingTabButton extends StatelessWidget { ), child: FloatingTabBounce(motion: motion, index: index, child: icon), ); + // The selected icon is a little larger, growing with the selection. + glyph = Transform.scale( + scale: 1 + (Motion.tabSelectedIconScale - 1) * t, + child: glyph, + ); final reveal = GlassReveal.maybeOf(context); if (reveal != null) { // The icon sits above the glass, so it fades with it here. diff --git a/app/lib/ui/motion/motion.dart b/app/lib/ui/motion/motion.dart index a16c8d87..57ca6b02 100644 --- a/app/lib/ui/motion/motion.dart +++ b/app/lib/ui/motion/motion.dart @@ -43,6 +43,10 @@ abstract final class Motion { /// The icon's scale at the top of its bounce. static const double tabBounceScale = 1.08; + /// How much larger the selected tab's icon is than the others; it grows + /// and shrinks with the selection tint. + static const double tabSelectedIconScale = 1.15; + /// Duration of each top-bar island's entrance pop (Back, title, actions). static const Duration barEntranceDuration = Duration(milliseconds: 240); diff --git a/app/test/ui/adaptive/floating_bar_geometry_test.dart b/app/test/ui/adaptive/floating_bar_geometry_test.dart index bfda65d2..8cac0967 100644 --- a/app/test/ui/adaptive/floating_bar_geometry_test.dart +++ b/app/test/ui/adaptive/floating_bar_geometry_test.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/ui/motion/motion.dart'; import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; import 'package:pipelines_app/ui/adaptive/glass_pill.dart'; @@ -128,7 +129,12 @@ void main() { isA(), ); final icon = tester.getRect(find.byIcon(icons[index])); - expect(icon.size, Size(iconSize, iconSize)); + // Tab 0 is selected: its icon is a little larger than the others. + final side = index == 0 + ? iconSize * Motion.tabSelectedIconScale + : iconSize; + expect(icon.width, moreOrLessEquals(side)); + expect(icon.height, moreOrLessEquals(side)); expect(icon.center, circle.center); } }); diff --git a/app/test/ui/adaptive/floating_tab_motion_test.dart b/app/test/ui/adaptive/floating_tab_motion_test.dart index 46ad3d3b..8af0e701 100644 --- a/app/test/ui/adaptive/floating_tab_motion_test.dart +++ b/app/test/ui/adaptive/floating_tab_motion_test.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/ui/motion/motion.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart'; import 'package:pipelines_app/shell/destination.dart'; import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; @@ -218,7 +219,13 @@ void main() { await tester.pumpAndSettle(); expect(fillAlpha(tester, 2), tint); expect(fillAlpha(tester, 0), 0); - expect(iconWidth(tester, 2), moreOrLessEquals(iconSize)); + // At rest the selected icon is a little larger than the others. + expect( + iconWidth(tester, 2), + moreOrLessEquals(iconSize * Motion.tabSelectedIconScale), + ); + expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); + expect(iconWidth(tester, 1), moreOrLessEquals(iconSize)); final context = tester.element(find.byKey(tabKey(2))); final selectedColour = cupertino ? CupertinoTheme.of(context).primaryColor @@ -263,7 +270,12 @@ void main() { await tester.pump(); expect(fillAlpha(tester, 2), tint); expect(fillAlpha(tester, 0), 0); - expect(iconWidth(tester, 2), moreOrLessEquals(iconSize)); + // No bounce, and the selected icon jumps straight to its larger size. + expect( + iconWidth(tester, 2), + moreOrLessEquals(iconSize * Motion.tabSelectedIconScale), + ); + expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); }); testWidgets('$host: switching the shell tabs never replays the main '