どうも、ちょげ(@chogetarou)です。
リストビューの要素の高さを指定する方法を紹介します。
方法

ListViewの要素の高さを指定するには、ListViewの引数「itemExtent」を使います。
具体的には、引数「itemExtent」に要素の高さを指定します。
ListView(
itemExtent : /*高さ*/,
children : []
)
以下は、使用例です。
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
itemExtent: 150,
children: [
Card(
color: Colors.blue,
child: ListTile(
title: Text('Item1'),
),
),
Card(
color: Colors.blue,
child: ListTile(
title: Text('Item2'),
),
),
Card(
color: Colors.blue,
child: ListTile(
title: Text('Item3'),
),
),
],
),
);
}

コメント