首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AnimatedContainer中的文本溢出

AnimatedContainer中的文本溢出
EN

Stack Overflow用户
提问于 2021-02-04 03:06:59
回答 1查看 48关注 0票数 0

我目前在AnimatedContainer中使用AnimatedContainer和LinearProgressIndicator。这是我当前的代码:

代码语言:javascript
复制
LayoutBuilder(
                  builder: (context, constraints) => AnimatedContainer(
                    width: expanded ? constraints.maxWidth : 0,
                    duration: Duration(milliseconds: 250),
                    child: Container(
                      color: Colors.red,
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text(trackName, maxLines: 1, overflow: TextOverflow.ellipsis),
                          Text(artists.join(", "), maxLines: 1, overflow: TextOverflow.ellipsis),
                          if (currentProgressValue != null)
                            Row(
                              children: [
                                Text(currentProgress.minutes.toString() + ":" + currentProgress.seconds.toString(),
                                    maxLines: 1, overflow: TextOverflow.ellipsis),
                                Expanded(
                                  child: LinearProgressIndicator(
                                    valueColor: new AlwaysStoppedAnimation<Color>(MyTheme.primaryColor),
                                    value: currentProgressValue / songDuration,
                                  ),
                                ),
                              ],
                            ),
                        ],
                      ),
                    ),
                  ),
                ),

问题是在AnimatedContainer压缩时,"if (currentProgressValue != null)“之后的行中的第一个文本溢出。有效的解决方案是将文本和LinearProgressIndicator都放入扩展中,但这样做会将空间一分为二,这不是我想要的。我不会用LinearProgressIndicator来填充剩余的文本空间。你知道怎么解决这个问题吗?

EN

回答 1

Stack Overflow用户

发布于 2021-02-04 03:15:35

İ而不是扩展使用灵活。当容器变得更大时,包装可能会溢出的小部件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66034118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档