【问题标题】:Clicking of InkWell or GestureDector in Flutter and in iOS not working在 Flutter 和 iOS 中单击 InkWell 或 GestureDector 不起作用
【发布时间】:2021-10-01 16:31:59
【问题描述】:

我在 iOS 模拟器中遇到了一个奇怪的问题,特别是在 iPhone 12 pro max 模拟器中。 You can get the video from this link

请观看此视频,因为它在 iPhone 8 中运行良好,但在 iPhone 12 max pro 中不适用,但我想说它在 iPhone 11 中也不起作用。它在 Android 设备上运行良好。

以下是我正在使用的代码:

// SizedBox(
   //   height: sizedHeight,
   // ),
 Hero(
    tag: 'mannafy_logo',
    child: Material(
             child: GestureDetector(
                     child: Image.asset(
                               "assets/images/mannafy_logo.png",
                               width: 125,
                               fit: BoxFit.fitWidth),
                      onTap: () async {
                                    const url = 'https://www.mannafy.com';
                                    if (await canLaunch(url)) {
                                      await launch(url);
                                    } else {
                                      throw 'Could not launch $url';
                                    }
                                  },
                                ),
                              ),
                            ),

现在最奇怪的部分出现了,如果您取消注释 SizedBox 代码,它会开始正常工作,但我不想在该图像上方添加空间。

请帮忙解决这个问题。

谢谢

【问题讨论】:

  • 试着把它包装成SafeArea,也许会有帮助。
  • 我已经在 SafeArea 中进行了包装,但我的图像上方仍有空间。

标签: android ios flutter dart hybrid-mobile-app


【解决方案1】:

我找到了在 MaterialApp 之前和 Scaffold 之前使用 SafeArea 的解决方案,所以我所做的就是删除了所有 SafeArea,并且只在 Scaffold 中使用了一次。

成功了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-02
    • 1970-01-01
    • 2018-11-10
    • 2020-09-05
    相关资源
    最近更新 更多