简体   繁体   中英

how can i apply radius to image with flutter?

i want to display gridview contains card contains image. i apply radius to card but it did not apply to its child image

here's my code:

child: new GridView.builder(
    itemCount: 20,
    gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
    itemBuilder: (BuildContext context,int index){
      return new Card(
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(10.0)
        ),
          elevation: 5.0,
          child: new Image.network('http://i.pravatar.cc/1000'),              
        );

    }
  ),

The default clip behavior for Card is Clip.none . Set it to eg Clip.antiAlias :

Card(
  clipBehavior: Clip.antiAlias,
  child: ...,
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM