fd5d4b783c
Peek taps, chords and programmatic activations during a mobile quick switch start the next switch at once from what is on screen. Swap styles continue from each card's current rect, pose, opacity and bar reveal; the tape takes a fresh picture of the frame above the incoming chat and continues its loop. The incoming chat keeps its speed and brakes once. The arriving peek takes pointers while it moves; leaving cards do not. The capture kit's film step gains a taps option for rapid-tap reviews. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.8 KiB
Dart
58 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../ui/motion/quick_switch_effect.dart';
|
|
import 'chat_pane_switch_motion.dart';
|
|
|
|
/// Perspective affects paint only. The retained chat keeps its real viewport
|
|
/// and its scroll controllers, focus scope and draft throughout the exchange.
|
|
class ChatSwitchCard extends StatelessWidget {
|
|
const ChatSwitchCard({
|
|
super.key,
|
|
required this.motion,
|
|
required this.outgoing,
|
|
this.paneId,
|
|
required this.child,
|
|
});
|
|
final ChatPaneSwitchMotion motion;
|
|
final bool outgoing;
|
|
|
|
/// A live pane's id: its pose includes one carried from an interrupted
|
|
/// switch. The tape's picture has none.
|
|
final String? paneId;
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final pose = paneId != null
|
|
? motion.poseFor(paneId!, outgoing: outgoing)
|
|
: quickSwitchPose(
|
|
motion.style,
|
|
motion.isAnimating ? motion.progress : 1,
|
|
outgoing: outgoing,
|
|
);
|
|
final shadow = Theme.of(context).shadowColor;
|
|
final surface = Theme.of(context).colorScheme.surface;
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) => Opacity(
|
|
opacity: pose.opacity,
|
|
child: Transform(
|
|
alignment: Alignment.center,
|
|
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),
|
|
blurRadius: 22 * pose.shadow,
|
|
offset: Offset(0, 8 * pose.shadow),
|
|
),
|
|
],
|
|
),
|
|
child: child,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|