要素を横に並べる方法について
Rowを使用する
Dartでは、Rowキーワードを使用することで、要素を横並びにすることが出来る。
children:[要素]で横並びにする要素を設定する。
mainAxisAlignment: MainAxisAlignment.spaceAround,はRow要素を中央ぞろえして適度にマージンを取るものである。
以下にコード例を示す。
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [
Icon(
Icons.favorite,
color: Colors.pink,
size: 24.0,
),
Icon(
Icons.audiotrack,
color: Colors.green,
size: 30.0,
),
Icon(
Icons.beach_access,
color: Colors.blue,
size: 36.0,
),
],
)