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

* ExpandIcon should use the size parameter
This commit is contained in:
Taufiq Rahman
2019-12-11 02:18:56 +06:00
committed by Shi-Hao Hong
parent 4938ea0385
commit c5f61ac3e8
2 changed files with 40 additions and 0 deletions

View File

@@ -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,

View File

@@ -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();