How to let flutter apps support TV device?

6,129

There are SystemChannels for this. I haven't tried it myself, but it looks like this should do what you need:

DartDocs - SystemChannels.keyEvent

A JSON BasicMessageChannel for keyboard events.

[DartDocs - SystemChannels.textInput[(https://www.dartdocs.org/documentation/flutter/0.0.41-dev/services/SystemChannels/textInput-constant.html)

A JSON MethodChannel for handling text input.

This channel exposes a system text input control for interacting with IMEs (input method editors, for example on-screen keyboards). There is one control, and at any time it can have one active transaction. Transactions are represented by an integer. New Transactions are started by TextInput.setClient. Messages that are sent are assumed to be for the current transaction (the last "client" set by TextInput.setClient). Messages received from the shell side specify the transaction to which they apply, so that stale messages referencing past transactions can be ignored.

The later is used in https://github.com/flutter/flutter/blob/4389f07024a4c69f7223401abd4d0ab3ecc45698/packages/flutter/lib/src/services/text_input.dart

There are known issues with physical keyboards thought that might cause this use case not to work

Share:
6,129
coder.john
Author by

coder.john

Updated on December 03, 2022

Comments

  • coder.john
    coder.john 12 months

    TV device does not support touch operation, users have to use Remote Control. We need to move focus by press left, top, right, bottom direction key, and when the target widget get focus, we will press OK button to response kinds of key event. But I cannot find any flutter interface to solve this interaction, anyone who can help me?

  • SacWebDeveloper
    SacWebDeveloper almost 5 years
    How is this the accepted answer? The fact is that Flutter does not support spacial navigation on TV devices yet. Please if you need this feature, tell the Flutter team, it's a gaping wound on the SDK.
  • Günter Zöchbauer
    Günter Zöchbauer over 4 years
    How is that my answers fault that there is/was no better TV support? I was just explained what I found out back then?