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:
@@ -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 '
|
||||
|
||||
Reference in New Issue
Block a user