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 {
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')};
}
......
......@@ -590,38 +590,26 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
: _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 @@ class _CircularProgressIndicatorDefaultsM3 extends ProgressIndicatorThemeData {
final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme;
static const double circularProgressIndicatorSize = 48.0;
@override
Color get color => _colors.primary;
}
......
......@@ -1000,7 +1000,7 @@ void main() {
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 @@ 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