title: How to fix Image overflow in Flutter PageView?
body: <p>I'm building an app where it shows the title, author name, number of upvotes, and an image from the subreddit in a page view. Everything is working fine but for some images, the page view is overflowing, how do I fix this?</p>
  <p>Here's the overflow error:</p>
  <p><a href="https://i.stack.imgur.com/VSQOQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VSQOQ.jpg" alt="enter image description here" /></a></p>
  <p>Here's my code</p>
  <pre><code>import 'dart:convert';
  
  import 'package:flutter/material.dart';
  import 'package:http/http.dart' as http;
  
  class Stardew extends StatefulWidget {
    const Stardew({ Key? key }) : super(key: key);
  
    @override
    State&lt;Stardew&gt; createState() =&gt; _StardewState();
  }
  
  class _StardewState extends State&lt;Stardew&gt; {
  
    List data = [];
  
    Future&lt;String&gt; getData() async {
  
      List temp_data = [];
  
      var response = await http.get(
        Uri.parse(&quot;https://m...content-available-to-author-only...p.com/gimme/stardewvalley/100&quot;)
      );
  
      return response.body;
    }
  
  
    @override
    Widget build(BuildContext context) {
  
      return FutureBuilder(
        future: getData(),
        builder: (BuildContext context, AsyncSnapshot snapshot){
  
          if(snapshot.data == null){
            return Center(child: CircularProgressIndicator(color: Color(0xff008b00)));
          }
  
          var jsonData = jsonDecode(snapshot.data);
          jsonData = jsonData[&quot;memes&quot;];
  
  
          return PageView.builder(
            //scrollDirection: Axis.vertical,
  
            itemCount: jsonData.length,
            itemBuilder: (BuildContext context, int index){
  
              return Center(
                child: Padding(
                  padding: const EdgeInsets.all(1.0),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                    
                      getImgCard(
                        jsonData[index][&quot;title&quot;], 
                        //jsonData[index][&quot;preview&quot;][2],//preview image
                        jsonData[index][&quot;url&quot;], //original image 
                        jsonData[index][&quot;author&quot;], 
                        (jsonData[index][&quot;ups&quot;]).toString()
                      )
  
                    ],
                  ),
                ),
              );
            },
          );
        }
      );
    }
  
  
    Widget getImage(String imgUrl){
      return Container(
        child: Image.network(
          imgUrl,
          
          fit: BoxFit.scaleDown,
          loadingBuilder: (BuildContext context, Widget child,
              ImageChunkEvent? loadingProgress) {
            if (loadingProgress == null) return child;
            return Center(
              child: CircularProgressIndicator(
                value: loadingProgress.expectedTotalBytes != null ? loadingProgress.cumulativeBytesLoaded/loadingProgress.expectedTotalBytes! : null,
                color: Color(0xff008b00),
              ),
            );
          },
        ),
      );
    }
  
  
  
    Widget getImgCard(String title, String imgUrl, String author, String ups){
      return Card(
        color: Color(0xff000000),
        clipBehavior: Clip.antiAlias,
        child: Column(
          children: [
            
            ListTile(
              leading: RichText(
                text: TextSpan(
                  children: [
                    TextSpan(
                      text: ups,
                      
                    ),
                    const WidgetSpan(
                      child: Icon(Icons.arrow_upward, size: 18, color: Color(0xff008b00),),
                    )
                  ],
                ),
              ),
              
              title: Text(title, style: TextStyle(color: Colors.white),),
  
  
              subtitle: Text(
                &quot;Posted by u/${author}&quot;,
                style: TextStyle(color: Colors.white.withOpacity(0.6)),
              ),
            ),
            
            getImage(imgUrl),
  
            
            Padding(padding: EdgeInsets.only(bottom: 8))
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>How do I fix this? I have tried changing the box fit and it did not work. Then I used expaned and flexible widgets and still can't find the answer to this solution. please help me.</p>