Issue 1:
To make sure that Flutter can always bring up the keyboard I made the window of virtual display's presentation non focusable.

As a result the embedded Android views cannot bring up the keyboard.

We should figure out if there's some window trickery we can do to let the unfocused window bring up the keyboard. Alternatively see if it's possible to dynamically select the focused window when delivering input events.

Issue 2:
I am trying to write an integration test for my flutter application. I have a custom widget which I am using to create a TextField with rounded borders. I have created a gist for the widget if you want to have a look. But I am having some problem running integration test with this widget.

Steps to Reproduce

As part of my integration test, I need to tap on this RoundTextField and enter some text into it. When adding the widget to my application, I also add a key to it

RoundTextField(
key: Key('loginKeyString'),
icon: Icon(Icons.add),
hint: 'Some data',
)

Now, in my integration test this is what I am trying to do

void main() {
group('Test', (){
FlutterDriver driver;

setUpAll(() async {
driver = await FlutterDriver.connect();
});

tearDownAll(() async {
if (driver != null) {
await driver.close();
}
});

test('Click test', () async {
await driver.tap(find.byValueKey('loginKeyString'));
});

});
}

And when I run it, this is the error that comes up.

DriverError: Error in Flutter application: Uncaught extension error while executing tap: Bad state: Too many elements

Note

This error only comes up when I use my custom widget. If I use a TextField this integration test passes.

Logs

[+4306 ms] 00:00 +0: Test (setUpAll)
[ +46 ms] [info ] FlutterDriver: Connecting to Flutter application at http://127.0.0.1:49681/
[ +306 ms] [trace] FlutterDriver: Isolate found with number: 287964734
[ +91 ms] [trace] FlutterDriver: Isolate is paused at start.
[ +13 ms] [trace] FlutterDriver: Attempting to resume isolate
[ +5 ms] [trace] FlutterDriver: Waiting for service extension
[ +700 ms] [info ] FlutterDriver: Connected to Flutter application.
[ +8 ms] 00:01 +0: Test Click test
[ +554 ms] 00:01 +0 -1: Test Click test [E]
[ +4 ms] DriverError: Error in Flutter application: Uncaught extension error while executing tap: Bad state: Too many elements
[ ] #0 Iterable.single (dart:core/iterable.dart:554:24)
[ ] #1 WidgetController._getElementPoint (package:flutter_test/src/controller.dart:511:47)
[ ] #2 WidgetController.getCenter (package:flutter_test/src/controller.dart:483:12)
[ ] #3 WidgetController.tap (package:flutter_test/src/controller.dart:260:18)
[ ] #4 FlutterDriverExtension._tap (package:flutter_driver/src/extension/extension.dart:304:19)
[ ] <asynchronous suspension>
[ ] #5 FlutterDriverExtension.call (package:flutter_driver/src/extension/extension.dart:180:51)
[ ] <asynchronous suspension>
[ ] #6 BindingBase.registerServiceExtension.<anonymous closure> (package:flutter/src/foundation/binding.dart:392:32)
[ ] <asynchronous suspension>
[ ] #7 _runExtension (dart:developer/runtime/libdeveloper.dart:86:23)
[ ] #8 RenderView.performLayout (package:flutter/src/rendering/view.dart:140:3)
[ ] #9 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1506:7)
[ +2 ms] #10 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
[ ] #11 __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:270:19)
[ ] #12 __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:671:13)
[ ] #13 __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
[ ] #14 __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
[ ] #15 __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
[ ] #16 __DriverBinding&BindingBase&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:751:7)
[ ] #17 Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
[ ] #18 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
[ ] #19 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
[ ] #20 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
[ ] Original error: null
[ ] Original stack trace:
[ ] null
[ +35 ms] package:flutter_driver/src/driver/driver.dart 405:7 FlutterDriver._sendCommand
[ ] ===== asynchronous gap ===========================
[ ] dart:async/future_impl.dart 22:43 _Completer.completeError
[ ] dart:async/runtime/libasync_patch.dart 40:18 _AsyncAwaitCompleter.completeError
[ ] package:flutter_driver/src/driver/driver.dart FlutterDriver._sendCommand
[ ] ===== asynchronous gap ===========================
[ ] dart:async/zone.dart 1053:19 _CustomZone.registerUnaryCallback
[ ] dart:async/runtime/libasync_patch.dart 77:23 _asyncThenWrapperHelper
[ ] package:flutter_driver/src/driver/driver.dart FlutterDriver._sendCommand
[ ] package:flutter_driver/src/driver/driver.dart 431:11 FlutterDriver.tap
[ ] ===== asynchronous gap ===========================
[ ] dart:async/zone.dart 1053:19 _CustomZone.registerUnaryCallback
[ ] dart:async/runtime/libasync_patch.dart 77:23 _asyncThenWrapperHelper
[ ] package:test/src/backend/declarer.dart Declarer.test.<fn>.<fn>.<fn>
[ +14 ms] package:test/src/backend/invoker.dart 250:15 Invoker.waitForOutstandingCallbacks.<fn>
[ ] ===== asynchronous gap ===========================
[ ] dart:async/zone.dart 1045:19 _CustomZone.registerCallback
[ ] dart:async/zone.dart 962:22 _CustomZone.bindCallbackGuarded
[ ] dart:async/timer.dart 52:45 new Timer
[ +3 ms] dart:async/timer.dart 87:9 Timer.run
[ +1 ms] dart:async/future.dart 174:11 new Future
[ ] package:test/src/backend/invoker.dart 402:11 Invoker._onRun.<fn>.<fn>.<fn>
[ ] 00:01 +0 -1: Test (tearDownAll)
[ +68 ms] 00:01 +0 -1: Some tests failed.
[ +2 ms] Unhandled exception:
[ ] Dummy exception to set exit code.
[ ] #0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1112:29)
[ ] #1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
[ ] #2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
[ ] #3 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:391:30)
[ ] #4 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
[ ] #5 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
[ +67 ms] Stopping application instance.
[ ] Stopping application.
[ +7 ms] "flutter drive" took 38,787ms.
Driver tests failed: 255

#0 throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1 _runTests (package:flutter_tools/src/commands/drive.dart:300:5)
<asynchronous suspension>
#2 DriveCommand.runCommand (package:flutter_tools/src/commands/drive.dart:124:23)
<asynchronous suspension>
#3 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:375:18)
#4 _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#5 _rootRunUnary (dart:async/zone.dart:1132:38)
#6 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#7 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#8 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
#9 Future._propagateToListeners (dart:async/future_impl.dart:671:32)
#10 Future._complete (dart:async/future_impl.dart:476:7)
#11 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#12 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
#13 _rootRun (dart:async/zone.dart:1124:13)
#14 _CustomZone.run (dart:async/zone.dart:1021:19)
#15 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#16 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#17 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#18 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#19 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)

flutter analyze

Analyzing flutter_integrations...
No issues found! (ran in 6.1s)

flutter doctor -v

[✓] Flutter (Channel master, v0.9.7-pre.79, on Mac OS X 10.13.6 17G65, locale en-IN)
• Flutter version 0.9.7-pre.79 at /Users/Ajil/Development/flutter
• Framework revision e4111b804b (13 hours ago), 2018-10-08 23:27:20 -0400
• Engine revision bfcdad8557
• Dart version 2.1.0-dev.6.0.flutter-c6254163dc

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /Users/Ajil/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 2.0.0
• CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 29.0.2
• Dart plugin version 181.5616
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.27.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.19.0

[✓] Connected device (1 available)
• iPhone 8 • 8444C14E-ADCA-4634-BC25-3816F4EA3041 • ios • iOS 12.0 (simulator)

• No issues found!