どうも、ちょげ(@chogetarou)です。
Containerに枠線をつける方法を紹介します。
方法

Containerに枠線をつけるには、まず引数「decoration」に「BoxDecoration」を指定します。
そして、BoxDecorationの引数「border」に「Border.all()」を指定します。
Container(
decoration: BoxDecoration(
border: Border.all(),
),
),
これでContainerに枠線がつきます。
以下は、使用例です。
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.pink, //色
width: 2, //太さ
),
),
height: 200,
width: 200,
),
),
);
}

コメント