Flutter - FloatingActionButton in the center

前端 未结 10 1297
无人及你
无人及你 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:02

    You can use Container and Align widgets as below:

    @override
    Widget build(BuildContext context) {
        return new Scaffold(
          body: Center(
    
          ),
          floatingActionButton: Container(
            padding: EdgeInsets.only(bottom: 100.0),
            child: Align(
              alignment: Alignment.bottomCenter,
              child: FloatingActionButton.extended(
                onPressed: _getPhoneAuthResult,
                icon: Icon(Icons.phone_android),
                label: Text("Authenticate using Phone"),
              ),
            ),
          ),
          floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
        );
      }
    

提交回复
热议问题