Give running-turn spinners their own animation controller

Without one, CircularProgressIndicator looks its controller up on every
frame, walking the widget tree for the ambient Theme (89 ms over a
streamed reply at 4K). AppSpinner is the stock indicator with its own
controller and the stock period.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 18:19:22 +00:00
parent 9d37db5939
commit 1be2418892
7 changed files with 72 additions and 11 deletions
@@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'chat_turn_chip.dart';
import '../../../../ui/status/app_spinner.dart';
/// `Reasoning` / `Reasoning · N steps`.
String chatReasoningLabel(int steps) =>
@@ -80,10 +81,8 @@ class _ChatReasoningChipState extends State<ChatReasoningChip> {
}
}
Widget _spinner() => const SizedBox.square(
dimension: 12,
child: CircularProgressIndicator(strokeWidth: 2),
);
Widget _spinner() =>
const SizedBox.square(dimension: 12, child: AppSpinner(strokeWidth: 2));
/// The steps an open sheet listens to. The turn can leave the tree while its
/// sheet is still open (its row scrolled away or replaced), so the notifier is
@@ -5,6 +5,7 @@ import '../../../../ui/text/monospace.dart';
import '../../domain/chat_tool_calls.dart';
import 'chat_turn_chip.dart';
import 'native_disclosure.dart';
import '../../../../ui/status/app_spinner.dart';
/// A turn's one tool summary below its answer, as the web's chip: `N tools`,
/// spinning while a call runs and tinted when one failed. It opens a sheet with
@@ -25,7 +26,7 @@ class ChatToolCallsChip extends StatelessWidget {
final leading = running
? const SizedBox.square(
dimension: 12,
child: CircularProgressIndicator(strokeWidth: 2),
child: AppSpinner(strokeWidth: 2),
)
: Icon(Icons.build_outlined, size: 14, color: color);
return ChatTurnChip(