Glide one tab highlight and stop tab entrances replaying on selection
The per-tab entrance pop lived in each icon, but the hosts swap a tab's icon subtree when it is selected or deselected (Material wrapped the selected icon in its own circle; Cupertino did the same in activeIcon), so every tab switch remounted those icons and replayed their pop. The bar now owns the entrance, highlight slide and bounce animations and restarts the entrance only when its set of tabs changes. One highlight behind the icons glides to the new tab (250 ms, stretching to 1.25x wide mid-move) and the new icon bounces (1.08x, 180 ms); reduced motion jumps. Cupertino paints it from tab 0 above the host's backdrop blur.
This commit is contained in:
@@ -34,6 +34,19 @@ abstract final class Motion {
|
||||
/// The fraction of a tab's entrance spent fading in.
|
||||
static const double tabEntranceOpacityPortion = 0.6;
|
||||
|
||||
/// How long a tab bar's selection highlight takes to glide to a new tab.
|
||||
static const Duration tabHighlightDuration = Duration(milliseconds: 250);
|
||||
|
||||
/// The highlight's width, relative to its height, halfway through a move;
|
||||
/// it is a circle again at rest.
|
||||
static const double tabHighlightStretch = 1.25;
|
||||
|
||||
/// The newly selected tab icon's brief bounce.
|
||||
static const Duration tabBounceDuration = Duration(milliseconds: 180);
|
||||
|
||||
/// The icon's scale at the top of its bounce.
|
||||
static const double tabBounceScale = 1.08;
|
||||
|
||||
static const Curve curve = Curves.easeOutCubic;
|
||||
|
||||
/// [duration], or zero under the system's reduce-motion setting.
|
||||
|
||||
Reference in New Issue
Block a user