如何使FloatingActionButton中心对齐

问题描述 投票:1回答:1
 Widget build(BuildContext context) {
    return Center(
      child: Column(
        children: <Widget>[
          Expanded(
            child: Image.asset('images/ball$go.png'),
          ),
          FloatingActionButton(
            onPressed: () {
              setState(() {
                go = Random().nextInt(5) + 1;
              });
            },
            child: Text('Ask'),
            backgroundColor: Colors.blue.shade300,
            foregroundColor: Colors.black,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(
                Radius.circular(16.0),
              ),
            ),
            elevation: 20.0,
          ),
        ],
      ),
    );
  }
}
flutter alignment center floating-action-button
1个回答
0
投票

使用对齐小部件包装

© www.soinside.com 2019 - 2024. All rights reserved.