我一直在尝试在我的颤振应用程序的卡的最左边放置一个线条指示器。我已经尝试了很多东西,但是没有用。
有一个确切的问题here,实际上是我一直试图解决的同一问题。
接受的解决方案的问题在于,它限制了硬编码值的高度,这是我所不希望的。而是颜色应该自动填充卡片的高度。
问题
我已经尝试了所有三种解决方案,但都不适合我的用例。
[C0的输出在这里,我必须将值硬编码为更大的值,以便所有显示的文本都位于其中。我觉得这不是解决方案。
first solution
Card(
key: ObjectKey(noteList[index]),
elevation: 2.0,
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
width: 4,
color: Color(noteList[index].intcolor),
),
Flexible(
flex: 100,
child: ListTile(
~~~~~~~~~~~~~~~~~ SNIP ~~~~~~~~~~~~~~~~~~~~~~~~
[C0的输出这根本不显示任何内容。
chip goes outside
[C0的输出容器没有颜色。Card(
key: ObjectKey(noteList[index]),
elevation: 2.0,
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
constraints: BoxConstraints.expand(),
color: Color(noteList[index].intcolor),
),
),
Flexible(
flex: 100,
child: ListTile(
~~~~~~~~~~~~~~~~~ SNIP ~~~~~~~~~~~~~~~~~~~~~~~~
非常感谢。
添加了代码和存储库以便于复制。
There's no color from the container