Flutter代码中的文本溢出不起作用

问题描述 投票:0回答:1

我正在尝试在Flutter应用中将文本省略掉,但无法设置。

我设计如下视图

Positioned(
            bottom: 20,
            left: 10,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  snapshot.data.results[index].title,
                  overflow: TextOverflow.ellipsis,
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    fontSize: 20.0,
                    fontWeight: FontWeight.w600,
                    color: Colors.white,
                  ),
                ),
                Text(
                  snapshot.data.results[index].release_date,
                  style: TextStyle(
                      fontSize: 18.0,
                      fontWeight: FontWeight.w400,
                      color: Colors.white,
                      letterSpacing: 1.2),
                ),
              ],
            ))

Screen Shot Ellipsis

flutter dart flutter-layout
1个回答
0
投票

您应该使用FlexibleExpanded小部件包裹文本,如下所示:

    Flexible(child:Text("Text goes here"),

有关更多信息,请尝试this链接

© www.soinside.com 2019 - 2024. All rights reserved.