How do you implement a SingleChildScrollView on a column with nested widgets?
The code snippet causes an error to be thrown, help a flutter newbie here!!
In the widget below I am attempting to wrap its content in a scrollable container, when implementing the SingleChildScrollView example the RenderFlex children have non-zero flex but incoming height constraints are unbounded. error is generated. I have tested nesting the child widgets in columns but only the sizedbox option works, but this confines the size to a predetermined height which can be different for various settings.
Widget getVideoBody() {
int _index = 0;
return Scaffold(
backgroundColor: Colors.black54,
appBar: AppBar(
backgroundColor: Color(0xff000000),
title: Text(
'GooGGle',
),
),
body: Align(alignment: Alignment.topCenter,
child: SingleChildScrollView(
child: Column(mainAxisSize: MainAxisSize.min,
children: [
ConstrainedBox(
constraints: BoxConstraints(maxHeight: 290, minHeight: 200.0),
//height: 285, // card height
//width: 400,
child: PageView.builder(
itemCount: videObj.results.length,
controller: PageController(viewportFraction: 0.7),
//onPageChanged: (int index) => setState(() => _index = index),
itemBuilder: (_, i) {
String vidKey = videObj.results[i].key;
String thumbPath = VideoDetails.thumbURL.replaceAll('xxxxxx', vidKey);
String videoPath = VideoDetails.videoURL + vidKey;
return Transform.scale(
scale: i == _index ? 1 : 0.9,
child: new InkWell(
//onFocusChange: (hasFocus){ _index++;},
onTap: (){
videoPath;
print(videoPath);
Uri.parse(
videoPath);
},
child: Card(
clipBehavior: Clip.antiAlias,
child: Column(
children: [
Image.network(
thumbPath,
fit: BoxFit.cover,
),
ListTile(
title: Text(videObj.results[i].name),
),
],
),
),
),
);
},
),
),
Container(
child: Container(
child: Container(
color: const Color(0xff000000), // Red
height: 20.0,
alignment: Alignment.topLeft,
padding: EdgeInsets.all(30.0),
child: Text(widget.movieDets.title,
textAlign: TextAlign.justify,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: Colors.white70)
),
),
// ),
),
Spacer(),
Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse semper iaculis elit accumsan lacinia. Nullam non sem non elit sagittis vestibulum id a eros. Proin vitae magna rutrum, hendrerit est nec, aliquam magna. Proin lobortis iaculis felis nec tempus. Nam a consequat ante. Aliquam eu arcu nec velit varius rutrum ac a nisl. Quisque id augue iaculis, convallis massa ut, pretium elit. Suspendisse fringilla ipsum erat, quis feugiat lorem dictum quis. Nullam et iaculis orci, sit amet auctor augue.', style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: Colors.white70),),
],
),
),
),
);
}