Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

flutter的SingleChildScrollView中嵌套了较大高度的SizedBox > WebView后闪退

如题,height在比较小的情况下,例如3000、4000时正常,大了就会报错并闪退。另外使用ListView、CustomListView试了也会闪退。这个问题只在嵌套SizedBox > Webview时会出现。

Webview使用的是官方的flutter_webview。

SingleChildScrollView(
  child: SizedBox(
    height: 30000,
    child: WebView(initialUrl: 'https://baidu.com'),
  ),
)

程序会直接闪退,报错:

Creating a virtual display of size: [1080, 82500] may result in problems(https://github.com/flutter/fl... is larger than the device screen size: [1080, 2030].

那个github链接打开后也没找到解决的办法,我看github上面有人在去年9月也提了这个问题。

我想要实现下拉刷新webview,将滚动放在flutter里。打算在webview加载完毕后postMessage传出内容高度,作为SizedBox的高度,现在的问题就卡在内容高度太大时闪退这里。请问有解决的办法吗,或者是我写法错了?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

为啥要 SizedBox ?
你能获取web的高度,用 Container 不行么?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...