【发布时间】:2020-08-10 03:41:44
【问题描述】:
我想将FloatingActionButton 在屏幕上水平居中,但我似乎没有找到任何关于如何做到这一点的资源..
这是我的颤振代码..
void main() => runApp(MaterialApp(
home: Home()
));
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My App'),
centerTitle: true,
backgroundColor: Colors.brown[700],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
// Add your onPressed code here!
},
child: Icon(Icons.add),
backgroundColor: Colors.brown[700],
),
backgroundColor: Colors.white70
);
}
}
【问题讨论】: