英文:
i need to remove this text over flow in flutter. how can i do that?
问题
以下是您要翻译的代码部分:
我在`Column`中的`Text`小部件中遇到了错误。
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.songModel.displayNameWOExt, <------- 这里是我的文本
),
Text(
widget.songModel.artist.toString(),
overflow: TextOverflow.fade,
),
],
),
],
),
],
),
);
英文:
I am facing error in the Text
widget which is in Column
.
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.songModel.displayNameWOExt, <------- here is my text
),
Text(
widget.songModel.artist.toString(),
overflow: TextOverflow.fade,
),
],
),
],
), ), );
答案1
得分: 1
用Expanded
小部件包裹Row
小部件内的Text
:
Expanded(child: Text(/* 这里是文本*/),
英文:
Wrap the Text
that is inside a Row
widget with an Expanded
widget:
Expanded(child: Text(/* Here the text*/),
答案2
得分: 0
尝试将Text()小部件嵌套在Expanded()小部件内 扩展文档
Expanded是一个小部件,用于扩展Row、Column或Flex的子元素,以使子元素填充可用空间。
英文:
try embedding the Text() widget inside a Expanded() widget expanded documentation
Expanded is a widget that expands a child of a Row, Column, or Flex so that the child fills the available space.
答案3
得分: 0
将文本包裹在容器中,并在此之后为容器指定特定大小,然后使用 overflow: TextOverflow.fade 或 "overflow" 的任何其他属性,因为这些属性只在你为文本字段指定大小时才有效,但你无法为文本字段指定大小,所以请将其包裹在容器中。
英文:
wrap the text with the container and give a specific size to the container after that use overflow: TextOverflow.fade or any other property of "overflow", because these properties only work when you give a size to textfield but you cant give size to textfield so wrap it with container.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论