close
0

Flutter How to create Card with background Image?

avatar
asked 13-09-2021

2 Answers


0

using - ClipRRect Widget - is To set semanticContainer: true, of Card Widget. Example Code as Below:

Card(
          semanticContainer: true,
          clipBehavior: Clip.antiAliasWithSaveLayer,
          child: Image.network(
            'https://placeimg.com/640/480/any',
            fit: BoxFit.fill,
          ),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(10.0),
          ),
          elevation: 5,
          margin: EdgeInsets.all(10),
        ),
avatar
answered 13-09-2021

0

wrap your image in ClipRRect

ClipRRect(
  borderRadius: BorderRadius.vertical(top: Radius.circular(10.0)),
  child: Image.network(...),
)
avatar
answered 13-09-2021