Fixed the size issue (#112601)
diff --git a/dev/tools/gen_defaults/lib/progress_indicator_template.dart b/dev/tools/gen_defaults/lib/progress_indicator_template.dart
index 896be2e..5f51ea4 100644
--- a/dev/tools/gen_defaults/lib/progress_indicator_template.dart
+++ b/dev/tools/gen_defaults/lib/progress_indicator_template.dart
@@ -17,8 +17,6 @@
final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme;
- static const double circularProgressIndicatorSize = ${tokens['md.comp.circular-progress-indicator.size']};
-
@override
Color get color => ${componentColor('md.comp.circular-progress-indicator.active-indicator')};
}
diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart
index 9673a09..dd86f96 100644
--- a/packages/flutter/lib/src/material/progress_indicator.dart
+++ b/packages/flutter/lib/src/material/progress_indicator.dart
@@ -590,38 +590,26 @@
: _CircularProgressIndicatorDefaultsM2(context);
final Color? trackColor = widget.backgroundColor ?? ProgressIndicatorTheme.of(context).circularTrackColor;
- Widget progressIndicator = Container(
- constraints: const BoxConstraints(
- minWidth: _kMinCircularProgressIndicatorSize,
- minHeight: _kMinCircularProgressIndicatorSize,
- ),
- child: CustomPaint(
- painter: _CircularProgressIndicatorPainter(
- backgroundColor: trackColor,
- valueColor: widget._getValueColor(context, defaultColor: defaults.color),
- value: widget.value, // may be null
- headValue: headValue, // remaining arguments are ignored if widget.value is not null
- tailValue: tailValue,
- offsetValue: offsetValue,
- rotationValue: rotationValue,
- strokeWidth: widget.strokeWidth,
- ),
- ),
- );
-
- if (Theme.of(context).useMaterial3) {
- progressIndicator = SizedBox(
- height: _CircularProgressIndicatorDefaultsM3.circularProgressIndicatorSize,
- width: _CircularProgressIndicatorDefaultsM3.circularProgressIndicatorSize,
- child: Center(
- child: progressIndicator
- ),
- );
- }
-
return widget._buildSemanticsWrapper(
context: context,
- child: progressIndicator,
+ child: Container(
+ constraints: const BoxConstraints(
+ minWidth: _kMinCircularProgressIndicatorSize,
+ minHeight: _kMinCircularProgressIndicatorSize,
+ ),
+ child: CustomPaint(
+ painter: _CircularProgressIndicatorPainter(
+ backgroundColor: trackColor,
+ valueColor: widget._getValueColor(context, defaultColor: defaults.color),
+ value: widget.value, // may be null
+ headValue: headValue, // remaining arguments are ignored if widget.value is not null
+ tailValue: tailValue,
+ offsetValue: offsetValue,
+ rotationValue: rotationValue,
+ strokeWidth: widget.strokeWidth,
+ ),
+ ),
+ ),
);
}
@@ -929,8 +917,6 @@
final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme;
- static const double circularProgressIndicatorSize = 48.0;
-
@override
Color get color => _colors.primary;
}
diff --git a/packages/flutter/test/material/progress_indicator_test.dart b/packages/flutter/test/material/progress_indicator_test.dart
index 96bc89d..baf76a9 100644
--- a/packages/flutter/test/material/progress_indicator_test.dart
+++ b/packages/flutter/test/material/progress_indicator_test.dart
@@ -1000,7 +1000,7 @@
expect((wrappedTheme as ProgressIndicatorTheme).data, themeData);
});
- testWidgets('default size of CircularProgressIndicator is 48x48 - M3', (WidgetTester tester) async {
+ testWidgets('default size of CircularProgressIndicator is 36x36 - M3', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: theme.copyWith(useMaterial3: true),
@@ -1012,7 +1012,7 @@
),
);
- expect(tester.getSize(find.byType(CircularProgressIndicator)), const Size(48, 48));
+ expect(tester.getSize(find.byType(CircularProgressIndicator)), const Size(36, 36));
});
}