I used 3 containers encapsulated by a stack to get layout something similar like this, now I want to make the page scroll able?

Viewed 352

enter image description here

Whenever I use any scrollable Widgets like single child scroll view but it throws a renderflex overflowed error. In the below code I am trying to use layout builder to get the scroll view. Any other suggestion, how can I get the scrollable view? I don't want any animation while scrolling now do I want appbar, I just want the normal scrolling option.

 Widget build(BuildContext context) {
final article args = ModalRoute.of(context).settings.arguments;
return new LayoutBuilder(
    builder: (BuildContext context, BoxConstraints viewportConstraints) {
  return SingleChildScrollView(
      child: ConstrainedBox(
          constraints: BoxConstraints(
            minHeight: viewportConstraints.minHeight,
          ),
          child: Stack(
            children: <Widget>[
              Container(
                color: Colors.green,
              ),
              Container(
                height: 300.0,
                decoration: BoxDecoration(
                    image: DecorationImage(
                  image: AssetImage("images/image.jpg"),
                  fit: BoxFit.cover,
                )),
              ),
              Positioned(
                  left: 40.0,
                  right: 40.0,
                  top: 240.0,
                  bottom: 40.0,
                  child: Container(
                    height: 500.0,
                    width: 300.0,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10.0),
                      color: Colors.pink,
                    ),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Container(
                          child: Text(
                            "Title",
                            style: TextStyle(
                              fontSize: 20.0,
                              fontFamily: 'Roboto',
                              color: Colors.black,
                            ),
                          ),
                        ),
                        SizedBox(height: 100),
                        Text(
                          "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
                          style: TextStyle(
                              fontSize: 20.0, color: Colors.black),
                        )
                      ],
                    ),
                  )),
            ],
          )));
});

}

The error is as follows:

I/flutter ( 8759): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY

 ╞═════════════════════════════════════════════════════════
I/flutter ( 8759): The following message was thrown during layout:

I/flutter ( 8759): A RenderFlex overflowed by 134 pixels on the bottom.

I/flutter ( 8759): 

I/flutter ( 8759): The overflowing RenderFlex has an orientation of 
Axis.vertical.
1 Answers

How about this?

Container(
        color: Colors.red,
        child: ConstrainedBox(
            constraints: BoxConstraints(
              maxHeight: 500.0,
              maxWidth: 300.0
            ),
            child: Stack(
              children: <Widget>[
                SingleChildScrollView(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      Container(
                        child: Text(
                          "Title",
                          style: TextStyle(
                            fontSize: 20.0,
                            fontFamily: 'Roboto',
                            color: Colors.black,
                          ),
                        ),
                      ),
                      SizedBox(height: 100),
                      Text(
                        "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
                        style: TextStyle(
                            fontSize: 20.0, color: Colors.black),
                      )
                    ],
                  ),
                ),
              ],
            )),
      ),
Related