使用展开的小部件时无法更改图像的高度

问题描述

我正在尝试更改图像的高度,但是当我更改高度时,只有容器的大小会更改,但是图像的高度保持不变。

Container(
            color: Colors.white,height: 250,child: Row(
              children: <Widget>[
                Expanded(
                    flex: 3,child: Container(
                      color: Colors.red,// child: Padding(
                      // padding: const EdgeInsets.all(5.0),child: Image(
                        height: 150,// width: 100,image: Assetimage("images/MiddleEarthWp.jpg"),),// ),)),Expanded(
                  flex: 7,child: Container(
                    color: Colors.Amber,)
              ],

Before changing height of image After changing a height

解决方法

之所以会这样,是因为您的图片是容器的子级,并且因为您没有指定图片的适合度,因此可以尝试以下代码:

1- pipenv install jupyterlab
2- pipenv shell
3- jupyter lab