App: run tabs under the header on wide layouts, stable Artifacts tab, spelled-out pipeline status, shared list selection, code block header and edge fades
- Run detail: on a wide window (>= 840, pane >= 600) the tabs are Material segments under the run header; phones keep the floating bottom bar. Artifacts is always a tab, badged with its count and disabled with 0 (its tooltip says why), so Changes never moves. - Pipelines list: 'Failed · last run 19 Oct' beside the status dot; facts on the next line; compact rows keep 'Failed · 19 Oct'. - Settings: Disconnect is outlined beside a tonal Reconnect. - Lists: one selection style (tonal fill plus one leading accent bar) for runs, pipelines and chats; chat's border, fill and pointer removed. - Transcript: overflowing blocks fade at the edge with a chevron instead of a 'Scroll horizontally' line (semantics hint kept); code blocks get a header strip with language and Copy; lighter light-mode code fill. - Runs list: rows under a day heading show only the time of day. - Artifact search reveal re-centres once the lazy list's extent settles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -116,9 +116,14 @@ class _CopyPosition extends SingleChildLayoutDelegate {
|
||||
anchor != oldDelegate.anchor;
|
||||
}
|
||||
|
||||
/// The copy slot always occupies the same space, so hover never shifts code.
|
||||
/// Keyboard focus also reveals it; a touch on the code still selects normally.
|
||||
class ChatCodeCopyRegion extends StatefulWidget {
|
||||
/// A fenced code block as one framed piece: a header strip with the
|
||||
/// language label and Copy, then the code on its own fill.
|
||||
///
|
||||
/// Copy is always in the header (a touch screen has no hover to reveal it),
|
||||
/// outside the selectable document, so selecting the code never takes the
|
||||
/// button's label with it. Light mode keeps the code fill light, framed by a
|
||||
/// hairline, so code text keeps its full contrast; dark mode lifts it a step.
|
||||
class ChatCodeCopyRegion extends StatelessWidget {
|
||||
const ChatCodeCopyRegion({
|
||||
super.key,
|
||||
required this.code,
|
||||
@@ -127,49 +132,57 @@ class ChatCodeCopyRegion extends StatefulWidget {
|
||||
});
|
||||
final String code;
|
||||
final Widget label, child;
|
||||
@override
|
||||
State<ChatCodeCopyRegion> createState() => _ChatCodeCopyRegionState();
|
||||
}
|
||||
|
||||
class _ChatCodeCopyRegionState extends State<ChatCodeCopyRegion> {
|
||||
bool _hover = false, _focus = false;
|
||||
/// The block's corner radius.
|
||||
static const double radius = 8;
|
||||
|
||||
/// The code body's fill.
|
||||
static Color fill(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return scheme.brightness == Brightness.light
|
||||
? scheme.surfaceContainerLow
|
||||
: scheme.surfaceContainerHighest;
|
||||
}
|
||||
|
||||
/// The header strip's fill, one step from the body's.
|
||||
static Color headerFill(BuildContext context) =>
|
||||
Theme.of(context).colorScheme.surfaceContainerHigh;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final visible = _hover || _focus;
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _hover = true),
|
||||
onExit: (_) => setState(() => _hover = false),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: widget.label),
|
||||
Focus(
|
||||
skipTraversal: true,
|
||||
onFocusChange: (value) => setState(() => _focus = value),
|
||||
child: ExcludeSemantics(
|
||||
excluding: !visible,
|
||||
child: IgnorePointer(
|
||||
ignoring: !visible,
|
||||
child: Opacity(
|
||||
opacity: visible ? 1 : 0,
|
||||
child: SelectionContainer.disabled(
|
||||
child: ChatCopyButton(
|
||||
text: widget.code,
|
||||
showLabel: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final header = ColoredBox(
|
||||
key: const Key('chat-code-header'),
|
||||
color: headerFill(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 12, end: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: label),
|
||||
SelectionContainer.disabled(
|
||||
child: ChatCopyButton(text: code, showLabel: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
return DecoratedBox(
|
||||
position: DecorationPosition.foreground,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: scheme.outlineVariant),
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
child: ColoredBox(
|
||||
key: const Key('chat-code-body'),
|
||||
color: fill(context),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [header, child],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
widget.child,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../../../../ui/layout/wheel_scroll_forwarding.dart';
|
||||
|
||||
/// Native, persistent overflow affordances for a code block or table. The
|
||||
/// footer is outside the selectable document and never overlays its content.
|
||||
/// Native, persistent overflow affordances for a code block or table: the
|
||||
/// side with more content fades out under a small chevron, and the scrollbar
|
||||
/// thumb stays visible. The chevrons are outside the selectable document and
|
||||
/// take no taps; the semantics hint names the gestures and keys.
|
||||
class ChatHorizontalViewport extends StatefulWidget {
|
||||
const ChatHorizontalViewport({
|
||||
super.key,
|
||||
@@ -89,20 +91,67 @@ class _ChatHorizontalViewportState extends State<ChatHorizontalViewport> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// The width over which content fades out at a side with more to scroll.
|
||||
static const double _fadeWidth = 32;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final focusColor = Theme.of(context).colorScheme.primary;
|
||||
final view = Padding(
|
||||
padding: EdgeInsets.only(bottom: _overflow ? 12 : 0),
|
||||
Widget view = Padding(
|
||||
padding: EdgeInsets.only(bottom: _overflow ? 10 : 0),
|
||||
child: HorizontalScrollView(controller: _controller, child: widget.child),
|
||||
);
|
||||
if (_left || _right) {
|
||||
// The side with more content fades out, the usual sign that a row
|
||||
// continues past the edge; content at rest is never covered.
|
||||
view = ShaderMask(
|
||||
key: const Key('chat-horizontal-fade'),
|
||||
blendMode: BlendMode.dstIn,
|
||||
shaderCallback: (bounds) {
|
||||
final fade = bounds.width <= 0
|
||||
? 0.0
|
||||
: (_fadeWidth / bounds.width).clamp(0.0, 0.5);
|
||||
const shown = Colors.white;
|
||||
const hidden = Color(0x00FFFFFF);
|
||||
return LinearGradient(
|
||||
colors: [
|
||||
_left ? hidden : shown,
|
||||
shown,
|
||||
shown,
|
||||
_right ? hidden : shown,
|
||||
],
|
||||
stops: [0, fade, 1 - fade, 1],
|
||||
).createShader(bounds);
|
||||
},
|
||||
child: view,
|
||||
);
|
||||
}
|
||||
final scrollbar = Scrollbar(
|
||||
controller: _controller,
|
||||
thumbVisibility: _overflow,
|
||||
trackVisibility: _overflow,
|
||||
child: view,
|
||||
);
|
||||
Widget chevron(bool left) => Positioned(
|
||||
left: left ? 0 : null,
|
||||
right: left ? null : 0,
|
||||
top: 0,
|
||||
bottom: 10,
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Icon(
|
||||
left ? Icons.chevron_left : Icons.chevron_right,
|
||||
key: Key(
|
||||
left ? 'chat-horizontal-more-left' : 'chat-horizontal-more-right',
|
||||
),
|
||||
size: 18,
|
||||
// Physical sides: the arrow points where the content continues.
|
||||
textDirection: TextDirection.ltr,
|
||||
color: color.withValues(alpha: .7),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return NotificationListener<ScrollMetricsNotification>(
|
||||
onNotification: (notification) {
|
||||
if (notification.metrics.axis == Axis.horizontal) _scheduleMetrics();
|
||||
@@ -127,35 +176,17 @@ class _ChatHorizontalViewportState extends State<ChatHorizontalViewport> {
|
||||
color: _focused ? focusColor : Colors.transparent,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
child: Stack(
|
||||
children: [
|
||||
scrollbar,
|
||||
if (_overflow)
|
||||
SelectionContainer.disabled(
|
||||
child: ExcludeSemantics(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Row(
|
||||
if (_left || _right)
|
||||
Positioned.fill(
|
||||
child: SelectionContainer.disabled(
|
||||
child: ExcludeSemantics(
|
||||
child: Stack(
|
||||
children: [
|
||||
Icon(
|
||||
_left && _right
|
||||
? Icons.swap_horiz
|
||||
: _left
|
||||
? Icons.arrow_back
|
||||
: Icons.arrow_forward,
|
||||
size: 16,
|
||||
textDirection: TextDirection.ltr,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Scroll horizontally',
|
||||
style: TextStyle(color: color),
|
||||
),
|
||||
),
|
||||
if (_left) chevron(true),
|
||||
if (_right) chevron(false),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -260,22 +260,19 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
return ChatCodeCopyRegion(
|
||||
code: code,
|
||||
label: Text(markdownCodeLabel(language), style: labelStyle),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(color: _codeFill(context)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: ChatTranscriptHorizontalScrollView(
|
||||
label: 'code block',
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: _linked(
|
||||
context,
|
||||
code,
|
||||
(part) => TextSpan(text: part),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: ChatTranscriptHorizontalScrollView(
|
||||
label: 'code block',
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: _linked(
|
||||
context,
|
||||
code,
|
||||
(part) => TextSpan(text: part),
|
||||
),
|
||||
style: const TextStyle(fontFamily: appMonospaceFamily),
|
||||
),
|
||||
style: const TextStyle(fontFamily: appMonospaceFamily),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user