diff --git a/packages/flutter/lib/src/material/expand_icon.dart b/packages/flutter/lib/src/material/expand_icon.dart index 5e5729bb58..cc3fc51c7f 100644 --- a/packages/flutter/lib/src/material/expand_icon.dart +++ b/packages/flutter/lib/src/material/expand_icon.dart @@ -177,6 +177,7 @@ class _ExpandIconState extends State with SingleTickerProviderStateM 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 5ef6c32be3..30fd8d8c6a 100644 --- a/packages/flutter/test/material/expand_icon_test.dart +++ b/packages/flutter/test/material/expand_icon_test.dart @@ -134,6 +134,45 @@ void main() { 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();