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

Containerの下部のパディングを設定するには、引数「EdgeInsets.only」を使います。
まず、Containerの引数「padding」に「EdgeInsets.only()」を指定します。
そして、EdgeInsets.onlyの引数「bottom」で下部のパディングに設定したい値を指定します。
Container(
padding: EdgeInsets.only(
bottom: /*下部のパディング*/,
),
),
これでContainerの下部のパディングを設定することが出来ます。
以下は、使用例です。
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
padding: EdgeInsets.only(
bottom: 50, //パディング50
),
width: 250,
height: 250,
child: Text('パディング'),
color: Colors.yellow,
alignment: Alignment.bottomLeft, //childを左下に
),
),
);
}

コメント