import 'package:flutter/material.dart'; import '../../../ui/motion/motion.dart'; /// The opacity of the surface scrim over an inactive split pane. The pane's /// transcript and bars keep reading through it at about half emphasis. const double chatPaneDimOpacity = 0.5; /// Covers a pane that is not the active one with the theme's surface colour, /// so the active pane reads as the one in focus. The scrim ignores pointers: /// taps reach the pane's content, and its activation listener still runs. /// Reduced motion switches the scrim at once; otherwise it fades briefly. class ChatPaneDim extends StatelessWidget { const ChatPaneDim({super.key, required this.dimmed, required this.child}); final bool dimmed; final Widget child; @override Widget build(BuildContext context) { final surface = Theme.of(context).colorScheme.surface; return Stack( fit: StackFit.passthrough, children: [ child, Positioned.fill( child: IgnorePointer( child: AnimatedContainer( key: const ValueKey('chat-pane-dim-scrim'), duration: Motion.of(context, Motion.standard), curve: Motion.curve, // The clear end keeps the surface hue, so the fade never greys. color: dimmed ? surface.withValues(alpha: chatPaneDimOpacity) : surface.withValues(alpha: 0), ), ), ), ], ); } }