简体   繁体   English

哪个 Flutter 插件或功能可以利用外部 iOS/Android 显示器显示与主显示器不同的内容

[英]Which Flutter plugin or feature can utilize an external iOS/Android display showing separate content from the main display

I am building a cross-platform app which needs to show a different view on an external display (usually connected via an HDMI adapter cable connected to a LCD projector.) Does Flutter have the ability to display a different screen on an external display either built-in or with an existing Flutter plugin?我正在构建一个跨平台应用程序,它需要在外部显示器上显示不同的视图(通常通过连接到 LCD 投影仪的 HDMI 适配器电缆连接。) Flutter 是否能够在外部显示器上显示不同的屏幕- 在或使用现有的 Flutter 插件? I would not want to write a bridge or plugin myself, as it would require native Swift ( UIScreen ) and Kotlin ( Presentation class ) code.我不想自己编写桥接器或插件,因为它需要本机 Swift ( UIScreen ) 和 Kotlin ( Presentation class ) 代码。

As I am exploring different cross-platform frameworks for iOS and Android I only found React Native with a usable package: React Native External Display - A React Native view renderer in External Display .当我正在探索 iOS 和 Android 的不同跨平台框架时,我只发现 React Native 带有可用的 packageer: React Native Display External Display - A React Native 视图渲染

Is there anything similar available for Flutter or what would be the best way to approach this in Flutter? Flutter 是否有类似的东西,或者在 Flutter 中解决这个问题的最佳方法是什么?

You can try the presentation_displays .你可以试试presentation_displays It supports running the app in 2 displays with independent images, not mirroring.它支持在具有独立图像的 2 个显示器中运行应用程序,而不是镜像。

Flutter plugin supports to run on two screens. Flutter 插件支持在两个屏幕上运行。 It's basically a tablet connected to another screen via an HDMI or Wireless它基本上是通过 HDMI 或无线连接到另一个屏幕的平板电脑

Plugin: link插件:链接

Idea : We create a Widget by using Flutter code and pass it to Native code side then convert it to FlutterEngine and save it to FlutterEngineCache for later use.思路:我们使用 Flutter 代码创建一个 Widget 并将其传递给 Native 代码端,然后将其转换为 FlutterEngine 并保存到 FlutterEngineCache 以备后用。

Next, we define the Display by using displayId and we will define the UI flutter that needs to display by grabbing FlutterEngine in FlutterEngineCache and transferring it to Dialog Presentation as a View.接下来,我们使用 displayId 定义 Display,我们将通过抓取 FlutterEngineCache 中的 FlutterEngine 并将其作为 View 传输到 Dialog Presentation 来定义需要显示的 UI flutter。

We provide methods to get a list of connected devices and the information of each device then transfer data from the main display to the secondary display.我们提供了获取连接设备列表和每个设备信息的方法,然后将数据从主显示器传输到辅助显示器。

Simple steps:简单的步骤:

Create Widgets that need to display and define them as a permanent router when you configure the router in the Flutter code.在 Flutter 代码中配置路由器时,创建需要显示的 Widgets 并将其定义为永久路由器。

Get the Displays list by calling displayManager.getDisplays ()通过调用displayManager.getDisplays ()获取Displays列表

Define which Display needs to display For instance: displays 1 .displayId Display the index 2.定义需要显示哪个Display 例如:displays 1 .displayId显示索引2。

Display it on Display with your routerName as presentation displayManager.showSecondaryDisplay (displayId: displays [1].displayId, routerName: "presentation")将它显示在 Display 上,您的 routerName 作为演示文稿displayManager.showSecondaryDisplay (displayId: displays [1].displayId, routerName: "presentation")

Transmit the data from the main display to the secondary display by displayManager.transferDataToPresentation (" test transfer data ")通过displayManager.transferDataToPresentation (" test transfer data ")将数据从主显传输到副显

The secondary screen receives data副屏接收数据

@override
Widget build (BuildContext context) {
    return SecondaryDisplay (
        callback: (argument) {
        setState (() {
        value = argument;
        });
    }
    );
}

在此处输入图像描述

Note: Extracted from Github page.注:摘自 Github 页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android的显示和主要活动中为应用指定单独的名称 - How to give separate name to app at display and main activity in android 如何在颤振插件中显示新的 android 进度对话框? - How to display new android progress dialog in flutter plugin? 仿真器JBMR1中的外部显示器功能测试 - External Display feature testing in Emulator JBMR1 如何获得Cordova InAppBrowser在iOS和Android之间类似地显示内容? - How can I get the cordova InAppBrowser to display content similarly between iOS and Android? Android语言环境显示插件 - Android Locale display plugin 如何在颤振中显示来自外部存储路径的图像? - How to display images from a external storage path in flutter? android模拟器未显示display。 。 - android emulator is not showing display . . 生成要在Android应用程序的ePaper显示屏上显示的内容 - Generate content to display on an ePaper display from Android App Android:我必须在列表视图中显示数据库中的内容,其中最新数据位于顶部 - Android: I have to display content from the database in the listview, in which latest data comes on top Cordova插件可在iOS和Android Lockscreen上显示音频信息和控件 - Cordova Plugin to display audio information and controls on iOS and Android Lockscreen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM