Fixed the size issue (#112601)
This commit is contained in:
parent
0c6f250071
commit
a1e9411c82
@ -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,7 +590,9 @@ 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(
|
return widget._buildSemanticsWrapper(
|
||||||
|
context: context,
|
||||||
|
child: Container(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minWidth: _kMinCircularProgressIndicatorSize,
|
minWidth: _kMinCircularProgressIndicatorSize,
|
||||||
minHeight: _kMinCircularProgressIndicatorSize,
|
minHeight: _kMinCircularProgressIndicatorSize,
|
||||||
@ -607,24 +609,10 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
|
|||||||
strokeWidth: widget.strokeWidth,
|
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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildAnimation() {
|
Widget _buildAnimation() {
|
||||||
return AnimatedBuilder(
|
return AnimatedBuilder(
|
||||||
animation: _controller,
|
animation: _controller,
|
||||||
@ -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() {
|
|||||||
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() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(tester.getSize(find.byType(CircularProgressIndicator)), const Size(48, 48));
|
expect(tester.getSize(find.byType(CircularProgressIndicator)), const Size(36, 36));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user