Change PopupMenuButton.icon type to Widget (#43526)
This commit is contained in:
parent
c461ff9d4a
commit
e903485de2
@ -978,11 +978,13 @@ class PopupMenuButton<T> extends StatefulWidget {
|
|||||||
/// to set the padding to zero.
|
/// to set the padding to zero.
|
||||||
final EdgeInsetsGeometry padding;
|
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;
|
final Widget child;
|
||||||
|
|
||||||
/// If provided, the icon used for this button.
|
/// If provided, the [icon] is used for this button
|
||||||
final Icon icon;
|
/// and the button will behave like an [IconButton].
|
||||||
|
final Widget icon;
|
||||||
|
|
||||||
/// The offset applied to the Popup Menu Button.
|
/// The offset applied to the Popup Menu Button.
|
||||||
///
|
///
|
||||||
|
@ -974,6 +974,29 @@ void main() {
|
|||||||
expect(find.byType(Tooltip), findsNWidgets(3));
|
expect(find.byType(Tooltip), findsNWidgets(3));
|
||||||
expect(find.byTooltip('Test 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<int>(
|
||||||
|
itemBuilder: (BuildContext context) {
|
||||||
|
return <PopupMenuEntry<int>>[
|
||||||
|
const PopupMenuItem<int>(
|
||||||
|
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 {
|
class TestApp extends StatefulWidget {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user