[Flutter]OutlinedButtonの形(shape)を変える方法

Flutter

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

OutlinedButtonの形を変える方法を紹介します。

スポンサーリンク

方法

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

OutlinedButtonの形を変えるには、「OutlinedButton.styleFrom」を使います。

「OutlinedButton.styleFrom」の引数「shape」で、形の指定をすることが出来ます。

そして、引数「shape」で形の設定をした「OutlinedButton.styleFrom」を、「OutlinedButton」の引数「shape」に指定します。

child: OutlinedButton(
  onPressed: () {},
  child: Text('Button'),
  style: OutlinedButton.styleFrom(
    minimumSize: Size(100, 100),
    shape: CircleBorder(), //形状
  ),
),

まとめ

OutlinedButtonの形を変えるには、引数「style」に「OutlinedButton.styledFrom」を指定します。

そして、OutlinedButton.styledFromの引数「shape」で形の設定をします。

コメント

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