Tabs: the selected tab's icon is a little larger

The selected icon grows to 1.15x with the selection tint (220 ms, same curve)
and shrinks back when another tab is selected, on every floating tab bar;
reduced motion jumps straight to the size.
This commit is contained in:
2026-11-02 21:57:26 +00:00
parent badf858124
commit 6fcdbcaec2
4 changed files with 30 additions and 3 deletions
@@ -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<CircleBorder>(),
);
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);
}
});
@@ -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 '