行renderflex在右侧溢出了2.0像素

时间:2019-09-25 10:05:12

标签: flutter

下面是我的代码,我总是在适当大小的情况下溢出一些像素。我正在使用小部件作为行和列的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上,但是没有成功 这是问题的输出图像

0 个答案:

没有答案