Commit c5f61ac3 authored by Taufiq Rahman's avatar Taufiq Rahman Committed by Shi-Hao Hong

Feature: `ExpandIcon` should use the `size` parameter (#45712)

* ExpandIcon should use the size parameter
parent 4938ea03
......@@ -177,6 +177,7 @@ class _ExpandIconState extends State<ExpandIcon> 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,
......
......@@ -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();
......
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