Unverified Commit e00d87ff authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

[keyboard_textfield_test] wait until the keyboard becomes visible (#92032)

parent 63c43a5e
......@@ -47,14 +47,24 @@ class _MyHomePageState extends State<MyHomePage> {
});
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final String softKeyboardVisibility = MediaQuery.of(context).viewInsets.bottom > 100
? 'keyboard visible'
: 'keyboard not visible';
return Scaffold(
body: Column(
children: <Widget>[
Text('$offset',
key: const ValueKey<String>(keys.kOffsetText),
),
Text(softKeyboardVisibility),
Expanded(
child: ListView(
key: const ValueKey<String>(keys.kListView),
......
......@@ -24,6 +24,7 @@ void main() {
final SerializableFinder listViewFinder = find.byValueKey(keys.kListView);
final SerializableFinder textFieldFinder = find.byValueKey(keys.kDefaultTextField);
final SerializableFinder offsetFinder = find.byValueKey(keys.kOffsetText);
final SerializableFinder keyboardVisibilityIndicatorFinder = find.text('keyboard visible');
// Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
await driver.waitForAbsent(textFieldFinder);
......@@ -38,7 +39,7 @@ void main() {
// Bring up keyboard
await driver.tap(textFieldFinder);
await Future<void>.delayed(const Duration(seconds: 1));
await driver.waitFor(keyboardVisibilityIndicatorFinder);
// Ensure that TextField is visible again
await driver.waitFor(textFieldFinder);
......
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