本文介绍了在Flutter中使容器内可滚动文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在视图内创建可滚动文本:
I'm trying to create a scrollable Text inside a view:
// other widgets, SingleChildScrollView( child: Container( height: 200, child: Text( "Long text here which is longer than the container height"))), // other widgets文本长于其父对象的高度容器,但由于某些原因,尽管将文本包装在 SingleChildScrollView 内,但该文本不可滚动。知道我在做什么错吗?
The text is longer than the height of its parent container, but for some reason the text is not scrollable although it is wrapped inside SingleChildScrollView. Any idea what I'm doing wrong?
推荐答案尝试添加 scrollDirection (水平):
SingleChildScrollView( scrollDirection: Axis.horizontal, child: Container( height: 200, child: Text( "Long text here which is longer than the container height")))默认为垂直。
或者,如果您想拥有自己的身高,则必须更改顺序( SingleChildScrollView 内部容器):
Or if you want to have with your height then you have to change the order (SingleChildScrollView inside Container):
Container( height: 200, child: SingleChildScrollView( child: Text( "Long text here which is longer than the container height")))更多推荐
在Flutter中使容器内可滚动文本
发布评论