glossPanelArrival function
A panel's way in and out: it fades, and settles 6 px toward its anchor as it opens.
Implementation
Widget glossPanelArrival(DesignOverlayInfo info, Widget child) {
final shown = info.animation.drive(
Animatable<double>.fromCallback((v) => v.clamp(0.0, 1.0)),
);
final toward = switch (info.side) {
DesignOverlaySide.below => const Offset(0, -6),
DesignOverlaySide.above => const Offset(0, 6),
DesignOverlaySide.start => const Offset(6, 0),
DesignOverlaySide.end => const Offset(-6, 0),
};
return FadeTransition(
opacity: shown,
child: AnimatedBuilder(
animation: info.animation,
builder: (context, child) => Transform.translate(
offset: toward * (1 - info.animation.value),
child: child,
),
child: child,
),
);
}