如何在Flutter中增加网络图像的高度?

How to increase the height of Network Image in Flutter?

我怎样才能改变我的网络图片的高度,它是固定的,不会改变,

This is the output

这是代码。

Container(
      padding: const EdgeInsets.all(10),
      child: SingleChildScrollView(
        child: Column(
          children: [
            TextField(
              decoration: const InputDecoration(
                border: OutlineInputBorder(),
                labelText: 'Movie Title',
              ),
              controller: controller,
            ),
            const SizedBox(
              height: 20,
            ),
            Card(
              child: ListTile(
                leading: Image.network(
                  "https://m.media-amazon.com/images/M/MV5BMTExZmVjY2ItYTAzYi00MDdlLWFlOWItNTJhMDRjMzQ5ZGY0XkEyXkFqcGdeQXVyODIyOTEyMzY@._V1_SX300.jpg",
                  fit: BoxFit.cover,
                  width: 100,
                  height: 150,
                ),
              ),
            ),
          ],
        ),
      ),
    ),

提前致谢!

如果您进入 ListTile,您会看到已给出前导的高度和宽度常量数字。所以你不能改变前导的高度和宽度。您可以使用 SizedBox 或 Container 而不是 ListTile

试试下面的代码希望对你有帮助。使用 Container 而不是 ListTile

参考ContainerHere

  Column(
    children: [
      const TextField(
        decoration: InputDecoration(
          border: OutlineInputBorder(),
          labelText: 'Movie Title',
        ),
      ),
      const SizedBox(
        height: 20,
      ),
      Card(
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              child: Image.network(
                "https://m.media-amazon.com/images/M/MV5BMTExZmVjY2ItYTAzYi00MDdlLWFlOWItNTJhMDRjMzQ5ZGY0XkEyXkFqcGdeQXVyODIyOTEyMzY@._V1_SX300.jpg",
                fit: BoxFit.cover,
                width: 100,
                height: 150,
              ),
            ),
            SizedBox(
              width: 20,
            ),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('Your Other Widgets if you want'),
                  SizedBox(height: 20),
                  Text('Your Other Widgets if you want'),
                ],
              ),
            ),
          ],
        ),
      ),
    ],
  ),

您的结果屏幕->