Rounded Corners Image in Flutter

后端 未结 15 1967
难免孤独
难免孤独 2020-12-22 18:34

I am using Flutter to make a list of information about movies. Now I want the cover image on the left to be a rounded corners picture. I did the following, but it didn’t wor

相关标签:
15条回答
  • Output:

    Using BoxDecoration

    Container(
                  margin: EdgeInsets.all(8),
                  width: 86,
                  height: 86,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    image: DecorationImage(
                        image: NetworkImage('https://i.stack.imgur.com/0VpX0.png'),
                        fit: BoxFit.cover
                    ),
                  ), 
               ),
    
    0 讨论(0)
  • 2020-12-22 19:25
       Container(
          width: 48.0,
          height: 48.0,
          decoration: new BoxDecoration(
            shape: BoxShape.circle,
            image: new DecorationImage(
                fit: BoxFit.fill,
                image: NetworkImage("path to your image")
            )
        )),
    
    0 讨论(0)
  • 2020-12-22 19:26

    For image use this

    ClipOval(
        child: Image.network(
            'https://url to your image',
            fit: BoxFit.fill,
        ),
    );
    

    While for Asset Image use this

    ClipOval(
        child: Image.asset(
            'Path to your image',
            fit: BoxFit.cover,
        ),
    )
    
    0 讨论(0)
提交回复
热议问题