Merge main
# Conflicts: # app/lib/ui/motion/motion.dart
This commit is contained in:
@@ -336,7 +336,8 @@ class _TabEntranceState extends State<_TabEntrance>
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration:
|
||||
Motion.standard + Motion.tabEntranceStagger * (widget.count - 1),
|
||||
Motion.tabEntranceDuration +
|
||||
Motion.tabEntranceStagger * (widget.count - 1),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -345,7 +346,7 @@ class _TabEntranceState extends State<_TabEntrance>
|
||||
super.didChangeDependencies();
|
||||
if (_started) return;
|
||||
_started = true;
|
||||
final duration = Motion.of(context, Motion.standard);
|
||||
final duration = Motion.of(context, Motion.tabEntranceDuration);
|
||||
_controller.duration =
|
||||
duration + Motion.tabEntranceStagger * (widget.count - 1);
|
||||
if (duration == Duration.zero) {
|
||||
@@ -365,16 +366,47 @@ class _TabEntranceState extends State<_TabEntrance>
|
||||
Widget build(BuildContext context) {
|
||||
final total = _controller.duration!.inMicroseconds;
|
||||
final start = Motion.tabEntranceStagger.inMicroseconds * widget.index;
|
||||
final window = Motion.tabEntranceDuration.inMicroseconds;
|
||||
final begin = total == 0 ? 0.0 : start / total;
|
||||
final animation = CurvedAnimation(
|
||||
final end = total == 0 ? 1.0 : (start + window) / total;
|
||||
final pop = CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Interval(begin, 1, curve: Motion.curve),
|
||||
curve: Interval(
|
||||
begin,
|
||||
end.clamp(begin, 1.0).toDouble(),
|
||||
curve: Curves.easeOutBack,
|
||||
),
|
||||
);
|
||||
final opacity = CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Interval(
|
||||
begin,
|
||||
total == 0
|
||||
? 1.0
|
||||
: (start + window * Motion.tabEntranceOpacityPortion)
|
||||
.clamp(start, total)
|
||||
.toDouble() /
|
||||
total,
|
||||
curve: Curves.easeOut,
|
||||
),
|
||||
);
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: ScaleTransition(
|
||||
scale: Tween<double>(begin: 0.88, end: 1).animate(animation),
|
||||
opacity: opacity,
|
||||
// Tabs (and their badge counts) stay announced while they fade in.
|
||||
alwaysIncludeSemantics: true,
|
||||
child: AnimatedBuilder(
|
||||
animation: pop,
|
||||
child: widget.child,
|
||||
builder: (context, child) => Transform.translate(
|
||||
offset: Offset(0, (1 - pop.value) * Motion.tabEntranceSlideDistance),
|
||||
child: Transform.scale(
|
||||
scale: Tween<double>(
|
||||
begin: Motion.tabEntranceScaleBegin,
|
||||
end: 1,
|
||||
).evaluate(pop),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,20 @@ abstract final class Motion {
|
||||
/// The point at which the incoming tab begins to appear.
|
||||
static const double tabFadeThroughIncomingAt = 0.35;
|
||||
|
||||
/// Delay between neighbouring controls entering as one group.
|
||||
static const Duration tabEntranceStagger = Duration(milliseconds: 40);
|
||||
/// Duration of each tab's entrance pop.
|
||||
static const Duration tabEntranceDuration = Duration(milliseconds: 260);
|
||||
|
||||
/// Delay between neighbouring tabs entering as one group.
|
||||
static const Duration tabEntranceStagger = Duration(milliseconds: 70);
|
||||
|
||||
/// The scale at which a tab starts its entrance pop.
|
||||
static const double tabEntranceScaleBegin = 0.6;
|
||||
|
||||
/// The upward travel distance of a tab's entrance pop, in logical pixels.
|
||||
static const double tabEntranceSlideDistance = 6;
|
||||
|
||||
/// The fraction of a tab's entrance spent fading in.
|
||||
static const double tabEntranceOpacityPortion = 0.6;
|
||||
|
||||
static const Curve curve = Curves.easeOutCubic;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user