Flutter - FloatingActionButton in the center

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

    Align(
                          alignment: Alignment.center,
                          child: Container(
                            child: FloatingActionButton(
                              hoverColor: Colors.black,
                              elevation: 10,
                              onPressed: () {},
                              backgroundColor: Colors.pink,
                              child: Icon(Icons.add,),
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.all(Radius.circular(20.0))),
                            ),
                          ),
                        ),
    

    Here I used "Align" widget to make the FloatingActionButton center. You can see it here.

提交回复
热议问题