[Flutter]FloatingActionButtonを角丸の四角形にする方法

Flutter

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

FloatingActionButtonを角丸の四角形にする方法を紹介します。

スポンサーリンク

方法

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

FloatingActionButtonを角丸の四角形にするには、まず引数「shape」に「RoundedRectangleBorder」を指定します。

そして、RoundedRectangleBorderの引数「borderRadius」で角丸の設定をします。

FloatingActionButton(
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(20), //角の丸み
  ),
  onPressed: () {},
  child: Icon(Icons.add),
),

角の丸みは、「BorderRadius.circular()」の引数で設定します。

コメント

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