1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

FlutterでFloatingActionButtonを上にあげたときのメモ

1
Last updated at Posted at 2019-10-31

FloatingActionButtonを上にあげたかった

Flutterを勉強中です。

スクリーンショット 2019-10-31 23.22.23.png

ScaffoldのfloatingActionButton:に、ただFloatingActionButtonを設置してしまうと、
上の画面のように広告バナーを置きたい時にボタンが重なってしまいます。
これを回避する為にPaddingをつけてFloatingActionButtonをchildにしました。

floatingActionButton: Padding(
  padding: const EdgeInsets.only(bottom: 50.0),
  child: FloatingActionButton(
    child: const Icon(Icons.add),
    onPressed: () {
      Navigator.push(
          context,
          MaterialPageRoute(
              builder: (context) {
                return BlocProvider<ScoreBloc>(
                  creator: (_context, _bag) => ScoreBloc(),
                  child: ScoreScene(),
                );
              },
              fullscreenDialog: true));
    },
  ),
),

padding:にEdgeInsets.only(bottom: 50.0),を書いてbottomから好きな位置までボタンが
あがるように数値を設定します。

スクリーンショット 2019-10-31 23.35.33.png

ボタンが上にずれてバナーを邪魔しないようになりました。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?