[Flutter]Containerに円の枠線をつける方法

Flutter

どうも、ちょげ(@chogetarou)です。

Containerに円の枠線をつける方法を紹介します。

スポンサーリンク

方法

インターフェース, インターネット, プログラム, ブラウザ, Www

Containerに円の枠線をつけるには、まず引数「decoration」にBoxDecorationを指定します。

次に、指定したBoxDecorationの引数「shape」にBoxShape.circleを指定します。

Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle,
  ),
),

そして、引数「border」に「Border.all()」を指定します。

Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle,
    border: Border.all(),
  ),
),

これでContainerに円の枠線がつきます。

使用例
Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle,
    border: Border.all(),
  ),
  height: 200,
  width: 200,
)

コメント

タイトルとURLをコピーしました