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
+20
View File
@@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/status/app_spinner.dart';
void main() {
testWidgets('the spinner owns its controller, so no per-frame lookup', (
tester,
) async {
await tester.pumpWidget(
const MaterialApp(home: Center(child: AppSpinner(strokeWidth: 2))),
);
final indicator = tester.widget<CircularProgressIndicator>(
find.byType(CircularProgressIndicator),
);
expect(indicator.controller, isNotNull);
expect(indicator.controller!.isAnimating, isTrue);
expect(indicator.strokeWidth, 2);
await tester.pumpWidget(const SizedBox());
});
}