我如何可以删除边界半径从下面的图像在Flutter?

vfwfrxfs  于 6个月前  发布在  Flutter
关注(0)|答案(1)|浏览(96)

如何从图像下方删除卡片的边框半径?我想删除附件图像中带有箭头的边框,同时保持图像两侧的边框


的数据

ListView(
        children: [
          Container(
            alignment: Alignment.center,
            child: Text(
              "Cart",
              style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
            ),
          ),
          Container(
            padding: EdgeInsets.symmetric(horizontal: 10),
            child: Column(
              children: [
                Card(
                  child: Container(
                    child: Row(
                      children: [
                        Expanded(
                            flex: 2,
                            child: ClipRRect(
                                borderRadius: BorderRadius.circular(12),
                                child: Image.asset(
                                    AppImageAssets.producttestimage))),
                        Expanded(
                            flex: 3,
                            child: ListTile(title: Text("macbook pro games"))),
                        Expanded(
                            child: Column(
                          children: [],
                        ))
                      ],
                    ),
                  ),
                )
              ],
            ),
          )
        ],
      ),

字符串
我是个初学者,我不知道我做了什么

waxmsbnn

waxmsbnn1#

有几种方法可以实现这一点。您可以将Image.asset Package 在ClipRRect Widget中,如下所示:

ClipRRect(
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(12),
                bottomLeft: Radius.circular(0),
                topRight: Radius.circular(12),
                bottomRight: Radius.circular(12),
              ),
              child: Image.asset(AppImageAssets.producttestimage),

字符串
或者,您可以使用Cardshape属性来应用于整个Card Widget,如下所示:

shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(12),
            topRight: Radius.circular(12),
            bottomRight: Radius.circular(12),
          ),
        ),


如果你使用的是Card小部件,你不需要使用Container小部件,它们几乎是一样的。如果你更喜欢使用Container而不是Card,你可以通过添加边框和阴影来获得更好的设计控制,并使用borderRadius属性控制边缘上的曲线。例如:

Container(
   padding: EdgeInsets.symmetric(horizontal: 10),
   child: Column(
    children: [
      Container(
        padding: EdgeInsets.symmetric(horizontal: 10),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(12),
            topRight: Radius.circular(12),
            bottomRight: Radius.circular(12),
          ),
          border: Border.all(
            color: Colors.grey, // You can adjust the border color
            width: 1.0, // You can adjust the border width
          ),
        ),
        child: Row(...),

相关问题