Files
pipelines/app/lib/features/chat/workspace/chat_pane_dim.dart
T
alan 793f9b08f5 Dim inactive chat panes
Make inactive split panes visibly recede while preserving readability and pointer activation. Add reduced-motion behavior and widget coverage for pane dimming, activation, and single-pane layouts.
2026-11-12 10:54:12 +00:00

43 lines
1.4 KiB
Dart

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 two thirds emphasis.
const double chatPaneDimOpacity = 0.35;
/// 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),
),
),
),
],
);
}
}