Merge commit '6569908f9139eef75c52e73db3402bebc2e2f5b6' into pipelines/run-20261112-1022-obvious-ways-to-start-a-run-f077

This commit is contained in:
2026-11-12 11:04:22 +00:00
31 changed files with 1396 additions and 276 deletions
@@ -147,13 +147,11 @@ class _ChatBackgroundTasksState extends State<ChatBackgroundTasks> {
visualDensity: VisualDensity.compact,
),
onPressed: _open,
// The layers turn only while a task runs; automations stay still.
// A ring around the running count while tasks run; automations stay
// on their static schedule icon.
icon: automationOnly
? const Icon(Icons.schedule, size: 16)
: ChatTaskSpinner(
spinning: count > 0,
child: const Icon(Icons.layers_outlined, size: 16),
),
: ChatTaskSpinner(running: count),
label: caption(),
);
return Padding(
@@ -170,7 +168,7 @@ class _ChatBackgroundTasksState extends State<ChatBackgroundTasks> {
: 'Background work, $label; task list unavailable')
: 'Background work, $label',
child: Tooltip(
message: label,
message: count > 0 ? 'Background tasks ($count running)' : label,
excludeFromSemantics: true,
child: button,
),
@@ -1,71 +1,50 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
/// Turns [child] once every [period] while [spinning]; static otherwise. With
/// reduced motion it never turns. Hidden UI is silenced by TickerMode.
class ChatTaskSpinner extends StatefulWidget {
const ChatTaskSpinner({
super.key,
required this.spinning,
required this.child,
});
/// Background-task glyph for the composer. While [running] is above zero it
/// shows a thin Material progress ring around the count; with reduced motion
/// the ring holds one static quarter segment instead of spinning. With no
/// running task it is the plain layers icon, with no ring. Always [size] square
/// so the button keeps the same dimensions in every state.
class ChatTaskSpinner extends StatelessWidget {
const ChatTaskSpinner({super.key, required this.running, this.size = 16});
final bool spinning;
final Widget child;
final int running;
final double size;
/// One full turn while tasks run.
static const Duration period = Duration(milliseconds: 2500);
/// Fraction of the ring drawn while reduced motion holds it still.
static const double reducedSegment = 0.25;
@override
State<ChatTaskSpinner> createState() => _ChatTaskSpinnerState();
}
class _ChatTaskSpinnerState extends State<ChatTaskSpinner>
with SingleTickerProviderStateMixin {
late final AnimationController _turns = AnimationController(
vsync: this,
duration: ChatTaskSpinner.period,
);
bool _reduced = false;
@override
void initState() {
super.initState();
_sync();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_reduced = MediaQuery.maybeDisableAnimationsOf(context) ?? false;
_sync();
}
@override
void didUpdateWidget(covariant ChatTaskSpinner oldWidget) {
super.didUpdateWidget(oldWidget);
_sync();
}
void _sync() {
if (widget.spinning && !_reduced) {
if (!_turns.isAnimating) _turns.repeat();
} else {
_turns
..stop()
..value = 0;
}
}
@override
void dispose() {
_turns.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => RotationTransition(
key: const Key('chat-background-tasks-spinner'),
turns: _turns,
child: widget.child,
);
Widget build(BuildContext context) {
final theme = Theme.of(context);
final reduced = MediaQuery.maybeDisableAnimationsOf(context) ?? false;
final content = running > 0
? Stack(
alignment: Alignment.center,
children: [
SizedBox.square(
dimension: size,
child: CircularProgressIndicator(
strokeWidth: 2,
color: theme.colorScheme.primary,
value: reduced ? reducedSegment : null,
),
),
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
'$running',
key: const Key('chat-background-tasks-count'),
style: theme.textTheme.labelSmall,
),
),
],
)
: Icon(Icons.layers_outlined, size: size);
return SizedBox.square(
key: const Key('chat-background-tasks-spinner'),
dimension: size,
child: content,
);
}
}
@@ -11,6 +11,7 @@ import '../../../../ui/layout/content_width.dart';
import '../../../../core/api_gateway.dart';
import '../../../../shell/shell_bar.dart';
import '../../../../shell/shell_list_shortcuts.dart';
import '../../../terminal/terminal_open_action.dart';
import '../../data/chat_repository.dart';
import '../../domain/chat_colors.dart';
import '../../domain/chat_cycle.dart';
@@ -381,7 +382,7 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
if (ShellBar.available(context)) {
return ShellBar(
active: widget.publishShellBar ?? widget.activeSessionId == null,
actions: _actions(),
actions: _actions(context),
// The Chat tab counts chats with messages not yet seen.
child: ShellBadge(
kind: ShellBadgeKind.unread,
@@ -396,7 +397,7 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
alignment: AlignmentDirectional.centerEnd,
child: Row(
mainAxisSize: MainAxisSize.min,
children: _actions(),
children: _actions(context),
),
),
Expanded(child: body),
@@ -406,7 +407,7 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(title: 'Chats', actions: _actions()),
appBar: SegmentedBar(title: 'Chats', actions: _actions(context)),
// The list scrolls behind the floating bar; New chat is the bar's
// own action, so there is no second create button.
body: body,
@@ -415,18 +416,24 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
);
}
List<Widget> _actions() => [
ChatBarAction(
key: const Key('chat-new-chat'),
label: 'New chat',
onPressed: _newChat,
materialIcon: Icons.add,
),
ChatBarAction(
key: const Key('chat-refresh'),
label: 'Refresh',
onPressed: _controller.refresh,
materialIcon: Icons.refresh,
),
];
/// New chat, Refresh and, on a narrow layout, the terminal toggle (wide
/// layouts keep it on the shell bar, so it is null here).
List<Widget> _actions(BuildContext context) {
final terminal = terminalChatBarAction(context);
return [
ChatBarAction(
key: const Key('chat-new-chat'),
label: 'New chat',
onPressed: _newChat,
materialIcon: Icons.add,
),
ChatBarAction(
key: const Key('chat-refresh'),
label: 'Refresh',
onPressed: _controller.refresh,
materialIcon: Icons.refresh,
),
?terminal,
];
}
}
@@ -0,0 +1,42 @@
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),
),
),
),
],
);
}
}
@@ -15,6 +15,7 @@ import 'chat_pane_move_motion.dart';
import 'chat_pane_move_shortcuts.dart';
import 'chat_pane_switch_motion.dart';
import 'chat_pane_backdrop.dart';
import 'chat_pane_dim.dart';
import 'chat_workspace_pane_scope.dart';
import 'chat_workspace_surface.dart';
import '../../../ui/input/keyboard_owner.dart';
@@ -509,8 +510,11 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
onPreferredWidthChanged: (width) =>
_reportPaneExtraWidth(pane.id, width),
child: Builder(
builder: (paneContext) =>
widget.paneBuilder(paneContext, pane, active),
builder: (paneContext) => ChatPaneDim(
// A single pane is always the active one, so it never dims.
dimmed: widget.controller.paneCount > 1 && !active,
child: widget.paneBuilder(paneContext, pane, active),
),
),
),
),
+4 -3
View File
@@ -2,7 +2,7 @@ import '../../ui/adaptive/segmented_bar.dart';
import '../../shell/destination.dart';
import '../../shell/detail_page.dart';
import '../../shell/list_detail.dart';
import '../../shell/shell_rail_scope.dart';
import '../../shell/navigation_rail.dart';
import 'package:flutter/material.dart';
import '../../core/api_gateway.dart';
@@ -289,9 +289,10 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
if (listShown && widget.onOpenSchedules != null)
_schedulesButton(context),
_refreshButton(context),
// A wide window's rail offers Settings; the gear stays on a phone.
// The phone's bar and the rail both offer Settings; the gear is only
// left where the floating tab bar (tabs only) is the shell's nav.
if (listShown &&
!ShellRailScope.isShown(context) &&
showsFloatingTabBarOnly(context) &&
widget.onOpenSettings != null)
_settingsButton(context),
],