Flutter 基于颤振的WebView溢出容器
如何修复WebView溢出到容器()中的底部?_getDescription方法被放入一个列小部件和扩展小部件中,但它溢出了容器() _getDescription方法正在从HtmlWidget插件返回WebView实例。我的代码:Flutter 基于颤振的WebView溢出容器,flutter,flutter-layout,Flutter,Flutter Layout,如何修复WebView溢出到容器()中的底部?_getDescription方法被放入一个列小部件和扩展小部件中,但它溢出了容器() _getDescription方法正在从HtmlWidget插件返回WebView实例。我的代码: Widget _getBody(tittle, date, description, origin, context) { return new Container( margin: new EdgeInsets.all(15.0), child: Expa
Widget _getBody(tittle, date, description, origin, context) {
return new Container(
margin: new EdgeInsets.all(15.0),
child: Expanded(
child: new Column(
children: <Widget>[
_getTittle(tittle),
_getDate(date, origin),
_getDescription(description),
_getImageGallery(),
],
),
),
);
}
_getDescription(description) {
return new Container(
margin: new EdgeInsets.only(top: 20.0, bottom: 4.0),
child: HtmlWidget(
description,
textStyle: TextStyle(fontSize: 15.5),
webView: true,
),
);
}
Widget\u getBody(标题、日期、描述、来源、上下文){
退回新货柜(
边距:新边集。全部(15.0),
儿童:扩大(
子:新列(
儿童:[
_格蒂特尔,
_getDate(日期、来源),
_getDescription(描述),
_getImageGallery(),
],
),
),
);
}
_getDescription(描述){
退回新货柜(
边距:仅限新边集(顶部:20.0,底部:4.0),
孩子:HtmlWidget(
描述
textStyle:textStyle(字体大小:15.5),
webView:没错,
),
);
}
结果:
尝试使用
SingleChildScrollView(child:Column(…)
而不是Expanded()
解决此问题的方法有多种。您可以使用将扩展的小部件替换为SingleChildScrollView
。另一种方法是使用ListView
或者,如果您不想滚动溢出的文本,请在\u getDescription
方法上的文本小部件内使用溢出:TextOverflow。当我替换展开为SingleChildScrollView时,省略号将使WebView为空:(.将列替换为ListView也没有效果使用容器作为ListView
的父级为ListView
提供有效的高度和宽度它没有效果。请记住getBody小部件位于支架小部件中