parent
d390f4d9c6
commit
13052b10e4
@ -52,21 +52,27 @@ public class SimplePlatformView implements PlatformView, MethodChannel.MethodCal
|
||||
touchPipe.disable();
|
||||
result.success(null);
|
||||
return;
|
||||
case "showAlertDialog":
|
||||
showAlertDialog(result);
|
||||
case "showAndHideAlertDialog":
|
||||
showAndHideAlertDialog(result);
|
||||
return;
|
||||
}
|
||||
result.notImplemented();
|
||||
}
|
||||
|
||||
private void showAlertDialog(MethodChannel.Result result) {
|
||||
private void showAndHideAlertDialog(MethodChannel.Result result) {
|
||||
Context context = view.getContext();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
TextView textView = new TextView(context);
|
||||
textView.setText("Alert!");
|
||||
textView.setText("This alert dialog will close in 1 second");
|
||||
builder.setView(textView);
|
||||
final AlertDialog alertDialog = builder.show();
|
||||
result.success(null);
|
||||
view.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
alertDialog.hide();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -105,6 +105,13 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
|
||||
child: const Text('PLAY FILE'),
|
||||
onPressed: () { playEventsFile(); },
|
||||
),
|
||||
Expanded(
|
||||
child: RaisedButton(
|
||||
key: const ValueKey<String>('back'),
|
||||
child: const Text('BACK'),
|
||||
onPressed: () { Navigator.pop(context); },
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
@ -84,7 +84,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
|
||||
});
|
||||
}
|
||||
try {
|
||||
await viewChannel.invokeMethod<void>('showAlertDialog');
|
||||
await viewChannel.invokeMethod<void>('showAndHideAlertDialog');
|
||||
setState(() {
|
||||
lastTestStatus = _LastTestStatus.success;
|
||||
});
|
||||
|
@ -17,6 +17,8 @@ Future<void> main() async {
|
||||
driver.close();
|
||||
});
|
||||
|
||||
// Each test below must return back to the home page after finishing.
|
||||
|
||||
test('MotionEvent recomposition', () async {
|
||||
final SerializableFinder motionEventsListTile =
|
||||
find.byValueKey('MotionEventsListTile');
|
||||
@ -24,9 +26,8 @@ Future<void> main() async {
|
||||
await driver.waitFor(find.byValueKey('PlatformView'));
|
||||
final String errorMessage = await driver.requestData('run test');
|
||||
expect(errorMessage, '');
|
||||
},
|
||||
// TODO(amirh): enable this test https://github.com/flutter/flutter/issues/54022
|
||||
skip: true);
|
||||
await driver.tap(find.byValueKey('back'));
|
||||
});
|
||||
|
||||
test('AlertDialog from platform view context', () async {
|
||||
final SerializableFinder wmListTile =
|
||||
@ -38,5 +39,7 @@ Future<void> main() async {
|
||||
await driver.tap(showAlertDialog);
|
||||
final String status = await driver.getText(find.byValueKey('Status'));
|
||||
expect(status, 'Success');
|
||||
await driver.waitFor(find.pageBack());
|
||||
await driver.tap(find.pageBack());
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user