我正在尝试在视图中创建一个可滚动的文本:
// other widgets,
SingleChildScrollView(
child: Container(
height: 200,
child: Text(
"Long text here which is longer than the container height"))),
// other widgets
文本长度超过其父容器的高度,但由于某种原因,文本虽然包含在SingleChildScrollView
中,但不可滚动。知道我做错了什么吗?
尝试添加scrollDirection(水平)
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
height: 200,
child: Text(
"Long text here which is longer than the container height"))),
}
默认为垂直
或者如果你想拥有你的身高那么你必须改变顺序(Container内的SingleChildScrollView)
Container(
height: 200,
child: SingleChildScrollView(
child: Text(
"Long text here which is longer than the container height"))),