c75023eb40
Keep the app's Material-only chat workspace path while retaining public cupertino parameters for callers. Narrow the affected widget tests to the supported Material host.
51 lines
1.5 KiB
Dart
51 lines
1.5 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,
|
|
required this.child,
|
|
});
|
|
final ChatPaneSwitchMotion motion;
|
|
final bool outgoing;
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final pose = 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,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|