我有一个问题,我的文本溢出右侧的卡片,但我尝试应用Expanded
\ Flexible
,我尝试使用FittedBox
但fit: BoxFit.scaleDown
没有用,所以要么我将它们放在错误的祖先顺序中,要么是其他问题。Container
最初,应该是高度,98
但由于文本很长,我想保留设计,但高度可以动态更改而不是固定,因为我想将文本放入Card
小部件中。
这是代码:
Card(
color: Color(0xFF29ABE2),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(4),
),
child: Wrap(
children: [
Container(
height: 98, // height can changed in order to fit the text, but I would like to make it more dynamically then instead of giving it a fixed height
width: MediaQuery.of(context)
.size
.width,
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.only(
bottomRight: Radius
.circular(4),
topRight:
Radius.circular(
4))),
margin:
EdgeInsets.only(left: 3),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Padding(
padding:
const EdgeInsets.only(
left: 16.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
Text('7/22/2021 14:59'),
Text('New York, NY, USA - 1 World Way, Los Angeles, CA 90045, USA'),
Text('7/22/2021 14:59'),
],
),
),
Padding(
padding:
const EdgeInsets.only(
right: 22.0),
child: TextButton(
onPressed: () {
//some logic
},
child: Text('VIEW'),
),
),
],
),
),
],
),
),
我已经从小部件中删除了样式属性,因此可以更轻松地查看代码。在此先感谢您的帮助!