File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -55,16 +55,17 @@ class _MyHomePageState extends State<MyHomePage> {
55
55
56
56
@override
57
57
Widget build (BuildContext context) {
58
- final String softKeyboardVisibility = MediaQuery .of (context).viewInsets.bottom > 100
59
- ? 'keyboard visible'
60
- : 'keyboard not visible' ;
58
+ final bool isSoftKeyboardVisible = MediaQuery .of (context).viewInsets.bottom > 100 ;
61
59
return Scaffold (
62
60
body: Column (
63
61
children: < Widget > [
64
62
Text ('$offset ' ,
65
63
key: const ValueKey <String >(keys.kOffsetText),
66
64
),
67
- Text (softKeyboardVisibility),
65
+ if (isSoftKeyboardVisible) const Text (
66
+ 'keyboard visible' ,
67
+ key: ValueKey <String >(keys.kKeyboardVisibleView),
68
+ ),
68
69
Expanded (
69
70
child: ListView (
70
71
key: const ValueKey <String >(keys.kListView),
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ const String kHeightText = 'height_text';
7
7
const String kUnfocusButton = 'unfocus_button' ;
8
8
const String kOffsetText = 'offset_text' ;
9
9
const String kListView = 'list_view' ;
10
+ const String kKeyboardVisibleView = 'keyboard_visible' ;
Original file line number Diff line number Diff line change @@ -24,7 +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
+ final SerializableFinder keyboardVisibilityIndicatorFinder = find.byValueKey (keys.kKeyboardVisibleView );
28
28
29
29
// Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
30
30
await driver.waitForAbsent (textFieldFinder);
You can’t perform that action at this time.
0 commit comments