I got a Container with a PageView inside which contains a handfull of Columns inside. Whenever the page is changed, a different height is assigned to the height of the Container. If the current page is 350 in size and the next should be 735, i get a "RenderFlex overflow by 355 pixels on the bottom" error.
GIF to demonstrate the problem
Here is the code:
child: Container(
height: _pageViewHeight,
child: PageView(
controller: _pageController,
onPageChanged: (int page) {
setState(() {
_currentPage = page;
_pageViewHeight = _heights[page];
});
},
children: <Widget>[
Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(vertical: 60),
child: Image(
image: AssetImage('assets/images/3_todo.png'),
width: 100,
height: 100,
),
),
],
),
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
child: Text(
"Download your data",
style: TextStyle(
fontSize: 32,
color: Colors.white,
),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Image(
image: AssetImage(
'assets/images/json_tutorial.gif',
)),
),
],
),
]),
),
Row(
children: [_button(_currentPage)],
)
_heights[]
contains the two heights.
When I go to the second page, I get the following error:
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during layout:
A RenderFlex overflowed by 355 pixels on the bottom.
The relevant error-causing widget was
Column
lib\views\onboarding.dart:176
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
This is how it looks like while changing
And this is how it looks when changed
Is there a way to have dynamically changing sizes without this error?