最近使用AI写Flutter代码,写的很顺利,也没有报错,但就是页面白屏,不知道是什么原因,最终排查好久发现时如下代码导致的。
javaWidget _buildDescriptionTab() {
  return Card(
    color: Colors.white,
    margin: const EdgeInsets.all(8),
    elevation: 1,
    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
    child: Container(
      child: SingleChildScrollView(
        physics: NeverScrollableScrollPhysics(), // 禁用内部滚动
        padding: const EdgeInsets.all(8),
        child: HtmlWidget(
          _work.content ?? "",
          textStyle: const TextStyle(fontSize: 16),
        ),
      ),
    ),
  );
}
貌似出现在禁止内部滚动上!但具体原因还不确定,总之,去除禁止滚动看看是否恢复吧~
PS:具体白屏场景:自组件禁止滚动后,父容器又没有设置固定高度,不知道是不是这个原因~
physics: NeverScrollableScrollPhysics(),
本文作者:DingDangDog
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!