How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?

后端 未结 12 1114
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 00:10

I have an image that doesn\'t match the aspect ratio of my device\'s screen. I want to stretch the image so that it fully fills the screen, and I don\'t want to crop any par

12条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 00:40

    Visit https://youtu.be/TQ32vqvMR80 OR

    For example if parent contrainer has height: 200, then

    Container(
                decoration: BoxDecoration(
                  image: DecorationImage(
                    image: NetworkImage('url'),
                    fit: BoxFit.cover,
                  ),
                ),
              ),
    

提交回复
热议问题