如何将Flutter中提供的扩展FAB集中在材料设计规范中?
这里扩展的FAB是右对齐的:
new Scaffold(
floatingActionButton: new FloatingActionButton.extended(
onTap: () => {},
label: new Text('See all results')
}
)
答案 0 :(得分:3)
您需要做的就是在floatingActionButtonLocation
Scaffhold
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: ...
body: ...
floatingActionButton: MyFloatingActionButton(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat
);
}
class MyFloatingActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FloatingActionButton.extended(
icon: Icon(Icons.plus_one),
onPressed: () => {},
label: new Text('See all results'));
}
}
请注意,这是问题的重复:Flutter - FloatingActionButton in the center