どうも、ちょげ(@chogetarou)です。
Columnの上部にパディングを設定する方法を紹介します。
方法

Columnの上部にパディングを設定するには、Paddingウェジェットを使いまず。
そして、Paddingの引数「padding」にEdgeInsets.onlyを指定します。
上部のパディングは、EdgeInsets.onlyの引数「top」で設定します。
Padding(
padding: EdgeInsets.only(
top: /*上のパディング*/,
),
child: Column(
children: [
・・・
],
),
),
これでColumnの上部にパディングを設定することが出来ます。
使用例
以下は、使用例です。

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text('Test App'),
),
body: Padding(
padding: EdgeInsets.only(
top: 50.0, //上に50のパディング
),
child: Column(
children: [
Expanded(
child: Container(
color: Colors.pink,
),
),
Expanded(
child: Container(
color: Colors.green,
),
),
Expanded(
child: Container(
color: Colors.blue,
),
),
],
),
),
),
);
}
コメント