I\'m using SingleChildScrollView and a Column to display a swiper and a gridview.
If I use some other widget like text, image in my column, the app shows ok. But my
You cannot have an Expanded
widget within the SingleChildScrollView
which has boundless vertical dimensions.
class _HomePageState extends State {
final List _children;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Container(
height: 200,
child: Swiper(
itemBuilder: (BuildContext context, int index) {
return Image.network(
"http://via.placeholder.com/350x150",
fit: BoxFit.fitHeight,
);
},
itemCount: 5,
pagination: SwiperPagination(),
control: SwiperControl(),
),
)),
Expanded(
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, childAspectRatio: 1.0),
itemBuilder: (BuildContext context, int index) {
return ListItemWidget(_children[index]);
},
itemCount: _children.length,
),
),
],
),
);
}
}