Copy & Paste Engineer

【Flutter】FloatingActionButton の位置を調整する

【Flutter】FloatingActionButton の位置を調整する

Flutter の FloatingActionButton の位置を調整します。

FloatingActionButton の位置

marginpadding で可能です。 (必要な方だけで構いません。

    floatingActionButton: Container(
        margin: const EdgeInsets.only(bottom: 50),
        padding: const EdgeInsets.only(bottom: 50),
        child: FloatingActionButton(
            child: Icon(Icons.remove),
            onPressed: () => null,
        ),
    ),

EdgeInsets の設定

EdgeInsets には以下のようにすると複数の間隔を取ることが出来ます。

    floatingActionButton: Container(
        margin: const EdgeInsets.only(top: 100, left:50),
        child: FloatingActionButton(
            child: Icon(Icons.remove),
            onPressed: () => null,
        ),
    ),

EdgeInsets には以下の4つが設定可能です。

参考