mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
CupertinoDialogAction is missing super call (#42924)
This commit is contained in:
parent
42d319720b
commit
4c2c17986a
|
@ -1039,6 +1039,7 @@ class _ActionButtonParentData extends MultiChildLayoutParentData {
|
|||
class CupertinoDialogAction extends StatelessWidget {
|
||||
/// Creates an action for an iOS-style dialog.
|
||||
const CupertinoDialogAction({
|
||||
Key key,
|
||||
this.onPressed,
|
||||
this.isDefaultAction = false,
|
||||
this.isDestructiveAction = false,
|
||||
|
@ -1046,7 +1047,8 @@ class CupertinoDialogAction extends StatelessWidget {
|
|||
@required this.child,
|
||||
}) : assert(child != null),
|
||||
assert(isDefaultAction != null),
|
||||
assert(isDestructiveAction != null);
|
||||
assert(isDestructiveAction != null),
|
||||
super(key: key);
|
||||
|
||||
/// The callback that is called when the button is tapped or otherwise
|
||||
/// activated.
|
||||
|
|
|
@ -1023,6 +1023,36 @@ void main() {
|
|||
transition = tester.widgetList(find.byType(FadeTransition)).elementAt(1);
|
||||
expect(transition.opacity.value, closeTo(0.0, 0.001));
|
||||
});
|
||||
|
||||
testWidgets('Actions are accessible by key', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
createAppWithButtonThatLaunchesDialog(
|
||||
dialogBuilder: (BuildContext context) {
|
||||
return const CupertinoAlertDialog(
|
||||
title: Text('The Title'),
|
||||
content: Text('The message'),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
key: Key('option_1'),
|
||||
child: Text('Option 1'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
key: Key('option_2'),
|
||||
child: Text('Option 2'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Go'));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byKey(const Key('option_1')), findsOneWidget);
|
||||
expect(find.byKey(const Key('option_2')), findsOneWidget);
|
||||
expect(find.byKey(const Key('option_3')), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
RenderBox findActionButtonRenderBoxByTitle(WidgetTester tester, String title) {
|
||||
|
|
Loading…
Reference in a new issue