どうも、ちょげ(@chogetarou)です。
Columnの高さを設定する方法を紹介します。
方法

Columnの高さを設定するには、SizedBoxもしくはContainerを使います。
まず、ColumnをSizedBoxもしくはContainerでラップします。
そして、SizedBoxもしくはContainerの引数「height」に高さを設定します。
SizedBox(
height: /*高さ*/,
child: Column(
children: [
・・・
],
),
),
これでColumnの高さを設定することが出来ます。
使用例
以下は、使用例です。

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container( //SizedBoxでも可
height: 200,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 60,
color: Colors.blue,
),
Container(
height: 60,
color: Colors.green,
margin: EdgeInsets.symmetric(vertical: 10),
),
Container(
height: 60,
color: Colors.yellow,
),
],
),
),
),
);
}
コメント