Merge commit '2eeca633096f2fc59a2397b6208e3cb518828de5' into pipelines/run-20261112-1043-dim-inactive-chat-panes-a498

This commit is contained in:
2026-11-12 10:59:05 +00:00
22 changed files with 844 additions and 254 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,
);
}
}
+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),
],