Commit 4c2c1798 authored by Daniel's avatar Daniel Committed by LongCatIsLooong

CupertinoDialogAction is missing super call (#42924)

parent 42d31972
......@@ -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) {
......
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