diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index 2c992fc25c..b1deb595c0 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -978,11 +978,13 @@ class PopupMenuButton extends StatefulWidget { /// to set the padding to zero. final EdgeInsetsGeometry padding; - /// If provided, the widget used for this button. + /// If provided, [child] is the widget used for this button + /// and the button will utilize an [InkWell] for taps. final Widget child; - /// If provided, the icon used for this button. - final Icon icon; + /// If provided, the [icon] is used for this button + /// and the button will behave like an [IconButton]. + final Widget icon; /// The offset applied to the Popup Menu Button. /// diff --git a/packages/flutter/test/material/popup_menu_test.dart b/packages/flutter/test/material/popup_menu_test.dart index 6b958aeb43..d05abe72bd 100644 --- a/packages/flutter/test/material/popup_menu_test.dart +++ b/packages/flutter/test/material/popup_menu_test.dart @@ -974,6 +974,29 @@ void main() { expect(find.byType(Tooltip), findsNWidgets(3)); expect(find.byTooltip('Test tooltip',), findsNWidgets(3)); }); + + testWidgets('Allow Widget for PopupMenuButton.icon', (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + home: Material( + child: PopupMenuButton( + itemBuilder: (BuildContext context) { + return >[ + const PopupMenuItem( + value: 1, + child: Text('Tap me please!'), + ), + ]; + }, + tooltip: 'Test tooltip', + icon: const Text('PopupMenuButton icon'), + ), + ), + ), + ); + + expect(find.text('PopupMenuButton icon'), findsOneWidget); + }); } class TestApp extends StatefulWidget {