File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,16 +55,17 @@ class _MyHomePageState extends State<MyHomePage> {
5555
5656 @override
5757 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 ;
6159 return Scaffold (
6260 body: Column (
6361 children: < Widget > [
6462 Text ('$offset ' ,
6563 key: const ValueKey <String >(keys.kOffsetText),
6664 ),
67- Text (softKeyboardVisibility),
65+ if (isSoftKeyboardVisible) const Text (
66+ 'keyboard visible' ,
67+ key: ValueKey <String >(keys.kKeyboardVisibleView),
68+ ),
6869 Expanded (
6970 child: ListView (
7071 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';
77const String kUnfocusButton = 'unfocus_button' ;
88const String kOffsetText = 'offset_text' ;
99const 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() {
2424 final SerializableFinder listViewFinder = find.byValueKey (keys.kListView);
2525 final SerializableFinder textFieldFinder = find.byValueKey (keys.kDefaultTextField);
2626 final SerializableFinder offsetFinder = find.byValueKey (keys.kOffsetText);
27- final SerializableFinder keyboardVisibilityIndicatorFinder = find.text ( 'keyboard visible' );
27+ final SerializableFinder keyboardVisibilityIndicatorFinder = find.byValueKey (keys.kKeyboardVisibleView );
2828
2929 // Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
3030 await driver.waitForAbsent (textFieldFinder);
You can’t perform that action at this time.
0 commit comments