Reveal full next card behind opaque deck front
This commit is contained in:
@@ -27,6 +27,9 @@ class ChatSwitchCard extends StatelessWidget {
|
||||
final shadow = usesCupertinoHost(context)
|
||||
? CupertinoColors.black
|
||||
: Theme.of(context).shadowColor;
|
||||
final surface = usesCupertinoHost(context)
|
||||
? CupertinoTheme.of(context).scaffoldBackgroundColor
|
||||
: Theme.of(context).colorScheme.surface;
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => Opacity(
|
||||
opacity: pose.opacity,
|
||||
@@ -35,6 +38,7 @@ class ChatSwitchCard extends StatelessWidget {
|
||||
transform: pose.transform(constraints.biggest),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: motion.isAnimating && !motion.isTape ? surface : null,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: shadow.withValues(alpha: .24 * pose.shadow),
|
||||
|
||||
@@ -65,11 +65,11 @@ Rect quickSwitchRect(
|
||||
final deck =
|
||||
style == QuickSwitchAnimation.cardStack ||
|
||||
style == QuickSwitchAnimation.deckSlide;
|
||||
final travel = deck
|
||||
? outgoing
|
||||
? ((t - .45) / .55).clamp(0.0, 1.0)
|
||||
: (t / .8).clamp(0.0, 1.0)
|
||||
: t;
|
||||
// The next card is already full-sized behind the opaque front card.
|
||||
// Sliding the front card aside reveals it instead of exposing empty space
|
||||
// above a view still travelling up from the small preview.
|
||||
if (deck && !outgoing) return to;
|
||||
final travel = deck ? ((t - .45) / .55).clamp(0.0, 1.0) : t;
|
||||
return Rect.lerp(from, to, travel)!;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user