1be2418892
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>
21 lines
682 B
Dart
21 lines
682 B
Dart
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());
|
|
});
|
|
}
|