dartflutterfloating-action-buttoncenter-align

Flutter - FloatingActionButton in the center


Is it possible to make the FloatingActionButton in the centre instead of the right side?

import 'package:flutter/material.dart';
import 'number.dart';
import 'keyboard.dart';

class ContaPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) => new Scaffold(
    body: new Column(
      children: <Widget>[
        new Number(),
        new Keyboard(),
      ],
    ),
    floatingActionButton: new FloatingActionButton(
      elevation: 0.0,
      child: new Icon(Icons.check),
      backgroundColor: new Color(0xFFE57373),
      onPressed: (){}
    )
  );
}

enter image description here


Solution

  • Try wrapping it in a Center widget or use a crossAxisAlignment of CrossAxisAlignment.center on your Column.

    You should pick one part of your Column to be wrapped in a Flexible that will collapse to avoid overflow, or replace some or all of it with a ListView so users can scroll to see the parts that are hidden.