Unverified Commit a1e9411c authored by Qun Cheng's avatar Qun Cheng Committed by GitHub

Fixed the size issue (#112601)

parent 0c6f2500
...@@ -17,8 +17,6 @@ class _Circular${blockName}DefaultsM3 extends ProgressIndicatorThemeData { ...@@ -17,8 +17,6 @@ class _Circular${blockName}DefaultsM3 extends ProgressIndicatorThemeData {
final BuildContext context; final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme; late final ColorScheme _colors = Theme.of(context).colorScheme;
static const double circularProgressIndicatorSize = ${tokens['md.comp.circular-progress-indicator.size']};
@override @override
Color get color => ${componentColor('md.comp.circular-progress-indicator.active-indicator')}; Color get color => ${componentColor('md.comp.circular-progress-indicator.active-indicator')};
} }
......
...@@ -590,38 +590,26 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w ...@@ -590,38 +590,26 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
: _CircularProgressIndicatorDefaultsM2(context); : _CircularProgressIndicatorDefaultsM2(context);
final Color? trackColor = widget.backgroundColor ?? ProgressIndicatorTheme.of(context).circularTrackColor; 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( return widget._buildSemanticsWrapper(
context: context, 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 @@ class _CircularProgressIndicatorDefaultsM3 extends ProgressIndicatorThemeData { ...@@ -929,8 +917,6 @@ class _CircularProgressIndicatorDefaultsM3 extends ProgressIndicatorThemeData {
final BuildContext context; final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme; late final ColorScheme _colors = Theme.of(context).colorScheme;
static const double circularProgressIndicatorSize = 48.0;
@override @override
Color get color => _colors.primary; Color get color => _colors.primary;
} }
......
...@@ -1000,7 +1000,7 @@ void main() { ...@@ -1000,7 +1000,7 @@ void main() {
expect((wrappedTheme as ProgressIndicatorTheme).data, themeData); 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( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: theme.copyWith(useMaterial3: true), theme: theme.copyWith(useMaterial3: true),
...@@ -1012,7 +1012,7 @@ void main() { ...@@ -1012,7 +1012,7 @@ void main() {
), ),
); );
expect(tester.getSize(find.byType(CircularProgressIndicator)), const Size(48, 48)); expect(tester.getSize(find.byType(CircularProgressIndicator)), const Size(36, 36));
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment