【问题标题】:Space bar not working for a TextField in iPhone(Safari as well as Chrome) in Flutter Webapp空格键不适用于 Flutter Webapp 中 iPhone(Safari 和 Chrome)中的 TextField
【发布时间】:2021-10-09 20:51:20
【问题描述】:

我在 Firebase 上部署了一个 Flutter Web 应用。

在 AndroidPhone/Laptop/Macbook 上一切正常,无论是在 Safari 还是 Chrome 上。

但在 iOS 上,在 TextField 中输入文本时,空格按钮不起作用。

问题与Flutter #79082 非常相似,但这次只在 iPhone(iOS) 上!

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 2.3.0-13.0.pre.73, on Microsoft Windows [Version 10.0.19042.985], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.2.0)
[√] VS Code (version 1.56.2)
[√] Connected device (2 available)

• No issues found!

【问题讨论】:

    标签: ios flutter safari flutter-web


    【解决方案1】:

    这个不行,请调整答案

    手动设置空格键的键盘快捷键对我有用!

    在您的 main.dart 中,将以下代码行粘贴到 MaterialApp 中

    shortcuts: {
        LogicalKeySet(LogicalKeyboardKey.space): ActivateIntent(),
     },
    

    您的 main.dart 应如下所示:

    Widget build(BuildContext context) {
     return MaterialApp(
       shortcuts: {
         LogicalKeySet(LogicalKeyboardKey.space): ActivateIntent(),
       },
       title: 'title of your app',
       //....
     );
    }
    

    【讨论】:

      猜你喜欢
      • 2022-07-12
      • 2015-09-02
      • 1970-01-01
      • 2011-02-22
      • 1970-01-01
      • 2014-07-23
      • 2014-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多