Skip to content

Commit c232c70

Browse files
authored
fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter#165370)
fix: flutter#165294 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
1 parent 6b6f49e commit c232c70

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

packages/flutter/lib/src/material/progress_indicator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ class CircularProgressIndicator extends ProgressIndicator {
744744
super.value,
745745
super.backgroundColor,
746746
super.valueColor,
747-
this.strokeWidth = 4.0,
747+
this.strokeWidth,
748748
super.semanticsLabel,
749749
super.semanticsValue,
750750
this.strokeCap,

packages/flutter/test/material/progress_indicator_test.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,30 @@ void main() {
433433
expect(find.byType(CircularProgressIndicator), paints..arc(strokeWidth: 16.0));
434434
});
435435

436+
testWidgets('CircularProgressIndicator.adaptive stroke width', (WidgetTester tester) async {
437+
await tester.pumpWidget(const CircularProgressIndicator.adaptive());
438+
439+
// The default strokeWidth is 4.0
440+
expect(find.byType(CircularProgressIndicator), paints..arc(strokeWidth: 4.0));
441+
442+
final ThemeData themeData = theme.copyWith(
443+
progressIndicatorTheme: const ProgressIndicatorThemeData(strokeWidth: 10.0),
444+
);
445+
await tester.pumpWidget(
446+
Theme(data: themeData, child: const CircularProgressIndicator.adaptive()),
447+
);
448+
449+
// Get the theme’s strokeWidth.
450+
expect(find.byType(CircularProgressIndicator), paints..arc(strokeWidth: 10.0));
451+
452+
await tester.pumpWidget(
453+
Theme(data: themeData, child: const CircularProgressIndicator.adaptive(strokeWidth: 16.0)),
454+
);
455+
456+
// The strokeWidth parameter should override the theme’s strokeWidth.
457+
expect(find.byType(CircularProgressIndicator), paints..arc(strokeWidth: 16.0));
458+
});
459+
436460
testWidgets('CircularProgressIndicator strokeAlign', (WidgetTester tester) async {
437461
await tester.pumpWidget(Theme(data: theme, child: const CircularProgressIndicator()));
438462
expect(

0 commit comments

Comments
 (0)