title: A PageView needs the parent to have a defined height. How can I accommodate the parent height to the PageView content?
body: <p>Basically I'm trying to implement a <code>PageView</code>, as I understand I must define a height in the parent of the<code>PageView</code> to work. In the gif you can see that if I don't define the height an error appears in its parent, but if I define a height the error disappears.</p>
  
  <p><a href="https://i.stack.imgur.com/gjPMk.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gjPMk.gif" alt="enter image description here"></a></p>
  
  <p>The <code>Text("hola")</code> elements in my actual code will be dynamically generated, so I can't define a fixed height. In fact you can see that if I put a height, another error appears because the height of the content of the <code>PageView</code> is greater than what I defined. (<code>MediaQuery.of(context).size.height</code>)</p>
  
  <p>How can i solve this problem?</p>
  
  <p>this is my code:</p>
  
  <pre><code>  import 'package:flutter/material.dart';
  
    void main() {
      runApp(MyApp());
    }
  
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        print("main");
        return MaterialApp(title: 'Provider Example', initialRoute: '/', routes: {
          '/': (context) =&gt; Home(),
          'home': (context) =&gt; Home(),
        });
      }
    }
  
    class Home extends StatelessWidget {
      Home() {
        print("home");
      }
  
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            backgroundColor: Colors.white,
            appBar: AppBar(
              title: const Text('home'),
            ),
            body: Stack(overflow: Overflow.visible, children: &lt;Widget&gt;[
              Positioned.fill(
                  top: 40,
                  child: Align(
                    alignment: Alignment.topCenter,
                    child: SingleChildScrollView(
                      child: Column(
                        children: &lt;Widget&gt;[
                          Text("text1"),
                          Text("text2",
                              style: Theme.of(context).textTheme.bodyText2),
                          Container(
                              height: MediaQuery.of(context).size.height,
                              margin: EdgeInsets.symmetric(
                                  vertical: 50, horizontal: 20),
                              child: PageView(
                                  physics: NeverScrollableScrollPhysics(),
                                  children: [
                                    Container(
                                      color: Colors.yellow,
                                      child: Column(
                                        children: &lt;Widget&gt;[
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                          Text("hola"),
                                        ],
                                      ),
                                    ),
                                    Container(color: Colors.blue)
                                  ])),
                        ],
                      ),
                    ),
                  )),
            ]));
      }
    }
  </code></pre>