flutter - 如何在 Flutter 中制作圆角图像

我正在使用 Flutter 制作有关电影的信息列表。现在我希望左边的封面图片是圆角图片。我做了以下,但没有奏效。谢谢!

    getItem(var subject) {
    var row = Container(
      margin: EdgeInsets.all(8.0),
      child: Row(
        children: <Widget>[
          Container(
            width: 100.0,
            height: 150.0,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(8.0)),
              color: Colors.redAccent,
            ),
            child: Image.network(
              subject['images']['large'],
              height: 150.0,
              width: 100.0,
            ),
          ),
        ],
      ),
    );
    return Card(
      color: Colors.blueGrey,
      child: row,
    );
  }

如下

最佳答案

使用 ClipRRect它将完美运行。

ClipRRect(
    borderRadius: BorderRadius.circular(8.0),
    child: Image.network(
        subject['images']['large'],
        height: 150.0,
        width: 100.0,
    ),
)

https://stackoverflow.com/questions/51513429/

相关文章:

flutter - 如何在 Flutter 小部件中创建超链接?

flutter - 如何在 flutter 中更改包名称?

flutter - 如何关闭屏幕键盘?

flutter - 如何在 Flutter 中创建数字输入字段?

flutter - 如何处理不需要的小部件构建?

Flutter - 在溢出时换行,例如插入省略号或淡入淡出

flutter - 将数据传递给 StatefulWidget 并在 Flutter 中以它的状态访

flutter - Flutter中文本小部件下的黄线?

flutter - 以编程方式滚动到 ListView 的末尾

flutter - 如何更改 CircularProgressIndicator 的颜色