Files
pipelines/app/lib/features/chat/conversation/composer_underline.dart
T
alan 7d2c3412a1 Paper design: warm paper, serif reading text and a typeset transcript
Adds the Paper design and generalises design tokens (transcript, composer,
selected-row styles, reading type, panel fill, chat colour saturation).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 18:00:07 +00:00

77 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import '../../../ui/adaptive/glass_bar.dart';
import '../../../ui/theme/app_design_tokens.dart';
import 'composer_focus_ring.dart';
/// The composer's writing area under a design whose composer is an
/// underline ([ComposerStyle.underline], Paper): the field and its controls
/// on the page's own colour (it floats over the transcript, so it is
/// opaque) above a hairline rule. While the field has focus the rule
/// thickens in [accent]; while a turn runs a thin moving line runs along it
/// instead, in place of the pill's travelling highlight.
class ComposerUnderline extends StatelessWidget {
const ComposerUnderline({
super.key,
required this.focus,
required this.accent,
required this.running,
required this.child,
});
final FocusNode focus;
/// The chat's focus colour (the host's primary for a chat with none).
final Color accent;
/// Whether a turn is running.
final bool running;
final Widget child;
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final tokens = AppDesignTokens.of(context);
return Material(
key: const Key('chat-composer-underline'),
color: tokens.panelFill(scheme, scheme.surface),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.all(GlassBarMetrics.fieldEdgeGap),
child: child,
),
SizedBox(
height: ComposerFocusRing.ringWidth,
child: running
? LinearProgressIndicator(
key: const Key('chat-composer-running-rule'),
minHeight: ComposerFocusRing.ringWidth,
color: accent,
backgroundColor: scheme.outlineVariant,
)
: ListenableBuilder(
listenable: focus,
builder: (context, _) {
final focused = focus.hasFocus;
return Align(
alignment: Alignment.bottomCenter,
child: AnimatedContainer(
key: const Key('chat-composer-rule'),
duration: ComposerFocusRing.duration,
curve: Curves.easeOutCubic,
height: focused ? ComposerFocusRing.ringWidth : 1,
color: focused ? accent : scheme.outline,
),
);
},
),
),
],
),
);
}
}