🚀
gridviewでのエラー
flutter大学の教科書2をやっている時に発生したエラー
ertical viewport was given unbounded height. Viewports expand in the scrolling direction to fill their container. In this case, a vertical viewport was given an unlimited amount of vertical space in which to expand. This situation typically happens when a scrollable widget is
てな感じの長いエラーが出ました。ざっくり言うとスクロール部分に問題があるみたいです。
最終的に原因はわかりませんでしたが、解決はしたので記す。
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.network(
'https://spirits-ltd.com/media/wp-content/uploads/2023/03/4.png',
width: 100,
height: 60,
),
const Spacer(),
const Column(
children: [
Text('投稿'),
Text('7000'),
],
),
const SizedBox(width: 20,),
const Column(
children: [
Text('フォロワー'),
Text('70000'),
],
),
const SizedBox(width: 20,),
const Column(
children: [
Text('フォロー'),
Text('0'),
],
),
],
),
),
Text('instagram'),
GridView.count(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
primary: false,
padding: const EdgeInsets.all(20),
crossAxisSpacing: 10,
mainAxisSpacing: 10,
crossAxisCount: 2,
children: <Widget>[
Container(
padding: const EdgeInsets.all(8),
color: Colors.teal[100],
child: const Text("He'd have you all unravel at the"),
),
Container(
padding: const EdgeInsets.all(8),
color: Colors.teal[200],
child: const Text('Heed not the rabble'),
),
Container(
padding: const EdgeInsets.all(8),
color: Colors.teal[300],
child: const Text('Sound of screams but the'),
),
Container(
padding: const EdgeInsets.all(8),
color: Colors.teal[400],
child: const Text('Who scream'),
),
Container(
padding: const EdgeInsets.all(8),
color: Colors.teal[500],
child: const Text('Revolution is coming...'),
),
Container(
padding: const EdgeInsets.all(8),
color: Colors.teal[600],
child: const Text('Revolution, they...'),
),
],
)
],
),
),
Discussion