Flutter - FloatingActionButton in the center

前端 未结 10 1274
无人及你
无人及你 2020-12-15 18:18

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

import \'package:flutter/material.dart\';
import \'numb         


        
10条回答
  •  暖寄归人
    2020-12-15 19:00

    I modified the code, now the button is in the bottom center but I do not know if it will always stay in the bottom, regardless of the size of the screen.

    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: [
            new Number(),
            new Keyboard(),
            new Stack(
              alignment: new FractionalOffset(0.5, 1.0),
              children: [
                new FloatingActionButton(
                  elevation: 0.0,
                  child: new Icon(Icons.check),
                  backgroundColor: new Color(0xFFE57373),
                  onPressed: (){}
                )
              ],
            )
          ],
        ), 
      );
    }
    

提交回复
热议问题