【问题标题】:Flutter show toast above keyboard on IOSFlutter 在 IOS 上的键盘上方显示吐司
【发布时间】:2020-12-25 17:13:08
【问题描述】:

我正在使用 fluttertoast 7.0.4 包在我的应用程序中显示敬酒,但在 IOS 上,当键盘打开时没有显示敬酒“它实际上出现在键盘后面”这是我的代码

  Fluttertoast.showToast(
        msg: message,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: AppColors.strongOrange,
        textColor: Colors.white,
        fontSize: 16.0
);

有什么方法可以改变 z-index 并使其在颤动中大于键盘的 z-index

【问题讨论】:

    标签: android ios flutter toast


    【解决方案1】:

    你不能在 ios 的键盘上方显示 Fluttertoast。

    有两种选择:

    1.改变吐司的重心

       Fluttertoast.showToast(
              msg: message,
              toastLength: Toast.LENGTH_SHORT,
              gravity: ToastGravity.CENTER,
              backgroundColor: Colors.red,
              textColor: Colors.white,
              fontSize: 16.0
          );
    
    1. 在底部显示 toast 时隐藏键盘。

             FocusManager.instance.primaryFocus.unfocus();
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-14
      • 2021-11-22
      • 2021-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-08
      • 1970-01-01
      相关资源
      最近更新 更多