File tree 2 files changed +12
-1
lines changed 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,24 @@ class _MyHomePageState extends State<MyHomePage> {
47
47
});
48
48
}
49
49
50
+ @override
51
+ void dispose () {
52
+ _controller.dispose ();
53
+ super .dispose ();
54
+ }
55
+
50
56
@override
51
57
Widget build (BuildContext context) {
58
+ final String softKeyboardVisibility = MediaQuery .of (context).viewInsets.bottom > 100
59
+ ? 'keyboard visible'
60
+ : 'keyboard not visible' ;
52
61
return Scaffold (
53
62
body: Column (
54
63
children: < Widget > [
55
64
Text ('$offset ' ,
56
65
key: const ValueKey <String >(keys.kOffsetText),
57
66
),
67
+ Text (softKeyboardVisibility),
58
68
Expanded (
59
69
child: ListView (
60
70
key: const ValueKey <String >(keys.kListView),
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ void main() {
24
24
final SerializableFinder listViewFinder = find.byValueKey (keys.kListView);
25
25
final SerializableFinder textFieldFinder = find.byValueKey (keys.kDefaultTextField);
26
26
final SerializableFinder offsetFinder = find.byValueKey (keys.kOffsetText);
27
+ final SerializableFinder keyboardVisibilityIndicatorFinder = find.text ('keyboard visible' );
27
28
28
29
// Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
29
30
await driver.waitForAbsent (textFieldFinder);
@@ -38,7 +39,7 @@ void main() {
38
39
39
40
// Bring up keyboard
40
41
await driver.tap (textFieldFinder);
41
- await Future < void >. delayed ( const Duration (seconds : 1 ) );
42
+ await driver. waitFor (keyboardVisibilityIndicatorFinder );
42
43
43
44
// Ensure that TextField is visible again
44
45
await driver.waitFor (textFieldFinder);
You can’t perform that action at this time.
0 commit comments