是否有可能在Flutter中开发移动键盘应用程序

是否有可能在Flutter中开发移动键盘应用程序

本文介绍了是否有可能在Flutter中开发移动键盘应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要开发具有某些独特功能(例如在键盘上进行翻译)的移动键盘应用程序-(第三方键盘).

We want to develop mobile keyboard app - (Third party keyboard) that have some unique features (such translate on the keyboard).

我们想知道是否有一种方法可以使用Flutter或其他解决方案同时针对IOS和Android进行开发?

We would like to know if there is a way to developed it once both for IOS and Android, with Flutter, or any other solution?

推荐答案

对此有很长的回答.简短的答案基本上是不,目前不可行.

There's a long and a short answer to this. The short answer is basically no, it's not feasible at this time to do this.

长答案是可能可能,但是您需要做大量工作.您将必须首先在android和ios中创建合适的项目类型,然后导入dart代码&设置构建.您可能可以从普通的flutter应用程序开始,并修改xcode/gradle构建以匹配ios/android的细节,但是我想这不太可能.因此,您可能仍然必须维护两个单独的项目,但是它们可以为UI导入相同的dart库.

The long answer is that it may be somewhat possible but with a fairly large amount of work for you to do. You're going to have to first create and appropriate project type in android and ios, and then import the dart code & set up the build. You may be able to start with a normal flutter application and modify the xcode/gradle builds to match the specifics for ios/android, but I'd guess that's somewhat unlikely. So you'll probably still have to maintain two separate projects, but which could import the same dart library for the UI.

由于Android和iOS的键盘使用不同的API,因此您需要编写平台插件,或者至少是用于iOS和Android的方法通道,这些通道可以在您的应用程序与本机代码之间进行通信.您可能还必须自己嵌入flutter视图-请参见此示例因为我敢打赌普通的FlutterApplication等都不适用.

Because Android and iOS use different APIs for their keyboards, you're going to need to write a Platform Plugin or at least method channels which communicate between your app and the native code, for each of iOS and Android. You'll also probably have to embed the flutter view yourself - see this example as I'd bet the normal FlutterApplication etc won't apply.

我猜想在android上,您最终可能需要做很多工作(取决于您对android的熟悉程度,平台渠道以及将flutter的库等集成到内部版本中);在iOS上,您可能会走运,但是出于性能或安全原因,iOS会阻止某些键盘上无法满足的功能-从我在本机iOS中开发应用程序的经验中猜测,尽管我没有专门做键盘.

I'd guess that on android you could probably get this to work eventually with a lot of work (depending on how familiar you are with android, platform channels, and integrating libraries such as flutter's into the build); on iOS you might have luck but it's somewhat conceivable that iOS blocks certain features that flutter needs in the keyboard for performance or security reasons - just guessing from my experiences developing apps in native iOS although I haven't done a keyboard specifically.

话虽如此,如果您尝试这样做,我很想听听结果,如果您打算以某种可以重复使用的通用方式进行操作,那将对您的工作大有裨益.社区!

That being said, if you do try this I'd be interested to hear the results, and if you were to go about it in a somewhat generic way that could be re-used it would be of great benefit to the flutter community!

这篇关于是否有可能在Flutter中开发移动键盘应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:13