我目前在AnimatedContainer中使用AnimatedContainer和LinearProgressIndicator。这是我当前的代码:
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来填充剩余的文本空间。你知道怎么解决这个问题吗?
发布于 2021-02-04 03:15:35
İ而不是扩展使用灵活。当容器变得更大时,包装可能会溢出的小部件。
https://stackoverflow.com/questions/66034118
复制相似问题