fix(tv): host automatic multiline input in the Android IME

Android TV's docked keyboard handles multiline editors natively, so
`automatic` no longer diverts them to the Flutter overlay there. Only
Apple TV keeps the overlay for multiline input — its modal fullscreen
system keyboard cannot edit multiline text. Surfaces that want the
overlay for editing ergonomics (mpv config, connection editor, dialog
text areas) already pin flutterOverlay explicitly.
This commit is contained in:
edde746
2026-08-09 10:06:29 +02:00
parent ce9556db22
commit 0b4fd9e8f3
3 changed files with 40 additions and 7 deletions
@@ -849,6 +849,37 @@ void main() {
expect(find.byKey(const Key('tv_virtual_keyboard_panel')), findsNothing);
});
testWidgets('Android TV automatic multiline input uses the platform field', (tester) async {
TvDetectionService.debugSetAppleTVOverride(null);
await TvDetectionService.getInstance(forceTv: true);
TvDetectionService.setForceTVSync(true);
final controller = TextEditingController();
final fieldFocusNode = FocusNode(debugLabel: 'notes_field');
addTearDown(controller.dispose);
addTearDown(fieldFocusNode.dispose);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: FocusableTextField(
controller: controller,
focusNode: fieldFocusNode,
keyboardType: TextInputType.multiline,
maxLines: 4,
),
),
),
);
fieldFocusNode.requestFocus();
await tester.pumpAndSettle();
// Unlike Apple TV's modal fullscreen keyboard, the docked Android IME
// hosts multiline input natively — no Flutter overlay.
expect(tester.widget<TextField>(find.byType(TextField)).readOnly, isFalse);
expect(find.byKey(const Key('tv_virtual_keyboard_panel')), findsNothing);
});
testWidgets('Android TV after-first-focus skips initial auto-open and opens on refocus', (tester) async {
TvDetectionService.debugSetAppleTVOverride(null);
await TvDetectionService.getInstance(forceTv: true);