下面是我的代码,我总是在适当大小的情况下溢出一些像素。我正在使用小部件作为行和列的mainAxisSize。
查看代码:
return Container(
margin: EdgeInsets.only(bottom: 5.0),
child: Card(
elevation: 5.0,
child: PaddingWith(
top: 10.0, left: 10.0, right: 10.0, bottom: 10.0,
widget: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ProfileImage(urlString: user.imageUrl, onPressed: null),
Column(
children: <Widget>[
PaddingWith(top:20.0,right:195.0,bottom:2.0,widget:MyText("${user.username}", color: baseAccent,)),
PaddingWith(right:190.0,widget:MyText(DateHelper().myDate(post.date), color: pointer,))
],
),
],
),
(post.imageUrl != null && post.imageUrl != "")
? PaddingWith(widget: Container(width: MediaQuery.of(context).size.width, height: 1.0, color: baseAccent,))
: Container(height: 0.0,),
(post.imageUrl != null && post.imageUrl != "")
? PaddingWith(widget: Container(
width: MediaQuery.of(context).size.width * 0.85,
height: MediaQuery.of(context).size.width * 0.6,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
image: DecorationImage(image: CachedNetworkImageProvider(post.imageUrl), fit: BoxFit.cover)),
))
: Container(height: 0.0,),
(post.text != null && post.text != "")
? PaddingWith(widget: Container(width: MediaQuery.of(context).size.width, height: 1.0, color: baseAccent,))
: Container(height: 0.0,),
(post.text != null && post.text != "")
? PaddingWith(widget: MyText(post.text, color: baseAccent,))
: Container(height: 0.0,),
PaddingWith(widget: Container(width: MediaQuery.of(context).size.width, height: 1.0, color: baseAccent,)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
IconButton(icon: (post.likes.contains(me.uid) ? likeFull: likeEmpty), onPressed: () => FireHelper().addLike(post),),
MyText(post.likes.length.toString(), color: baseAccent,),
IconButton(icon: msgIcon, onPressed: () {
if (!detail) {
Navigator.push(context, MaterialPageRoute(builder: (BuildContext ctx) {
return DetailPost(post, user);
}));
}
},),
MyText(post.comments.length.toString(), color: baseAccent,)
],
)
],
)
),
),
);
我尝试了许多Que./Ans。在stackOverFlow上,但是没有成功 这是问题的输出图像