Feature: `ExpandIcon` should use the `size` parameter (#45712) * ExpandIcon should use the size parameter
diff --git a/packages/flutter/lib/src/material/expand_icon.dart b/packages/flutter/lib/src/material/expand_icon.dart index 5e5729b..cc3fc51 100644 --- a/packages/flutter/lib/src/material/expand_icon.dart +++ b/packages/flutter/lib/src/material/expand_icon.dart
@@ -177,6 +177,7 @@ onTapHint: widget.onPressed == null ? null : onTapHint, child: IconButton( padding: widget.padding, + iconSize: widget.size, color: _iconColor, disabledColor: widget.disabledColor, onPressed: widget.onPressed == null ? null : _handlePressed,
diff --git a/packages/flutter/test/material/expand_icon_test.dart b/packages/flutter/test/material/expand_icon_test.dart index 5ef6c32..30fd8d8 100644 --- a/packages/flutter/test/material/expand_icon_test.dart +++ b/packages/flutter/test/material/expand_icon_test.dart
@@ -134,6 +134,45 @@ expect(rotation.turns.value, 0.5); }); + testWidgets('ExpandIcon default size is 24', (WidgetTester tester) async { + final ExpandIcon expandIcon = ExpandIcon( + onPressed: (bool isExpanded) {}, + ); + + await tester.pumpWidget(wrap( + child: expandIcon + )); + + final ExpandIcon icon = tester.firstWidget(find.byWidget(expandIcon)); + expect(icon.size, 24); + }); + + testWidgets('ExpandIcon has the correct given size', (WidgetTester tester) async { + ExpandIcon expandIcon = ExpandIcon( + size: 36, + onPressed: (bool isExpanded) {}, + ); + + await tester.pumpWidget(wrap( + child: expandIcon + )); + + ExpandIcon icon = tester.firstWidget(find.byWidget(expandIcon)); + expect(icon.size, 36); + + expandIcon = ExpandIcon( + size: 48, + onPressed: (bool isExpanded) {}, + ); + + await tester.pumpWidget(wrap( + child: expandIcon + )); + + icon = tester.firstWidget(find.byWidget(expandIcon)); + expect(icon.size, 48); + }); + testWidgets('ExpandIcon has correct semantic hints', (WidgetTester tester) async { final SemanticsHandle handle = tester.ensureSemantics(); const DefaultMaterialLocalizations localizations = DefaultMaterialLocalizations();