A RenderFlex overflowed by 242 pixels on the right.

如果父 flex  row  column 的话,那么抛出此错误的元素使用
Expanded或者Flexible
 包裹就行,如下

@override
Widget build(BuildContext context) {
  return new Card(
      color: Colors.white,
      elevation: 3.0,
      child: new Padding(
        padding: new EdgeInsets.all(15.0),
        child: new Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            new FadeInImage.assetNetwork(
                width: 120.0,
                height: 170.0,
                fit: BoxFit.fitWidth,
                placeholder: "images/normal_book.webp",
                image: this.widget.book.imgUrl),
            new Container(
              width: 10.0,
              height: 1.0,
            ),
            Expanded(
              child: new Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  new Text.rich(
                    foreachGetTextSpan(
                      "书名:",
                      this.widget.searchKey,
                      this.widget.book.title,
                      new TextStyle(fontSize: 14.0, color: Colors.black),
                    ),
                    softWrap: true,
                  ),
                  new Text.rich(
                    foreachGetTextSpan(
                      "电子标签:",
                      this.widget.searchKey,
                      this.widget.book.labelId,
                      new TextStyle(
                        fontSize: 13.0,
                        height: 1.3,
                      ),
                    ),
                    softWrap: true,
                  ),
                  new Text.rich(
                    foreachGetTextSpan(
                      "作者:",
                      this.widget.searchKey,
                      this.widget.book.author,
                      new TextStyle(
                        fontSize: 13.0,
                        height: 1.3,
                      ),
                    ),
                    softWrap: true,
                  ),
                  new Text.rich(
                    foreachGetTextSpan(
                      "类型:",
                      this.widget.searchKey,
                      this.widget.book.category,
                      new TextStyle(
                          fontSize: 12.0,
                          color: new Color(0xff323232),
                          height: 1.4),
                    ),
                    softWrap: true,
                  ),
                  new Text.rich(
                    foreachGetTextSpan(
                      "标签属性:",
                      this.widget.searchKey,
                      this.widget.book.tags,
                      new TextStyle(
                        fontSize: 13.0,
                        height: 1.2,
                        color: new Color(0xff636363),
                      ),
                    ),
                    softWrap: true,
                  ),
                  new Text.rich(
                    foreachGetTextSpan(
                      "位置:",
                      this.widget.searchKey,
                      "${this.widget.book.borrowState == 2 ? "在仓库-" +
                        (this.widget.book
                            .bankCode ?? "未知区域") : this.widget.book
                        .borrowState == 1 ? "借阅中" : this.widget.book
                        .borrowState == 3 ? "调拨中" : (this.widget.book
                        .houseName ?? "未知") +
                        "站点"}",
                      new TextStyle(
                        fontSize: 13.0,
                        color: _borrowColor(this.widget.book.borrowState),
                      ),
                    ),
                    softWrap: true,
                  ),
                ],
              ),
            ),
          ],
        ),
      ));
}

猜你喜欢

转载自blog.csdn.net/qq_32319999/article/details/80420775
242
今日推荐