Unverified Commit 213f766e authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

Use ValueKey finder instead of text finder in keyboard_textfield_test (#97996)

parent 3f7d997c
......@@ -55,16 +55,17 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
final String softKeyboardVisibility = MediaQuery.of(context).viewInsets.bottom > 100
? 'keyboard visible'
: 'keyboard not visible';
final bool isSoftKeyboardVisible = MediaQuery.of(context).viewInsets.bottom > 100;
return Scaffold(
body: Column(
children: <Widget>[
Text('$offset',
key: const ValueKey<String>(keys.kOffsetText),
),
Text(softKeyboardVisibility),
if (isSoftKeyboardVisible) const Text(
'keyboard visible',
key: ValueKey<String>(keys.kKeyboardVisibleView),
),
Expanded(
child: ListView(
key: const ValueKey<String>(keys.kListView),
......
......@@ -7,3 +7,4 @@ const String kHeightText = 'height_text';
const String kUnfocusButton = 'unfocus_button';
const String kOffsetText = 'offset_text';
const String kListView = 'list_view';
const String kKeyboardVisibleView = 'keyboard_visible';
......@@ -24,7 +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');
final SerializableFinder keyboardVisibilityIndicatorFinder = find.byValueKey(keys.kKeyboardVisibleView);
// Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
await driver.waitForAbsent(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