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:
@@ -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());
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user