最佳答案
因此,如果您希望晶圆厂以垂直顺序排列,则将它们包装在列中,如下所示
class RandomFabScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
FloatingActionButton(
child: Icon(Icons.home, color: Colors.white,),
onPressed: (){},
backgroundColor: Colors.cyan,
),
SizedBox(height: 10,),
FloatingActionButton(
child: Icon(Icons.playlist_play, color: Colors.white,),
onPressed: (){},
backgroundColor: Colors.red,
),
SizedBox(height: 10,),
FloatingActionButton(
child: Icon(Icons.person, color: Colors.white,),
backgroundColor: Colors.yellow,
onPressed: (){},
),
SizedBox(height: 10,),
FloatingActionButton(
child: Icon(Icons.warning, color: Colors.white,),
onPressed: (){},
backgroundColor: Colors.blue,
),
],
),
);
}
}
输出:
如果要按水平顺序排列它们,请将其包装在行中
像这样
class RandomFabScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
FloatingActionButton(
child: Icon(Icons.home, color: Colors.white,),
onPressed: (){},
backgroundColor: Colors.cyan,
),
SizedBox(width: 10,),
FloatingActionButton(
child: Icon(Icons.playlist_play, color: Colors.white,),
onPressed: (){},
backgroundColor: Colors.red,
),
SizedBox(width: 10,),
FloatingActionButton(
child: Icon(Icons.person, color: Colors.white,),
backgroundColor: Colors.yellow,
onPressed: (){},
),
SizedBox(width: 10,),
FloatingActionButton(
child: Icon(Icons.warning, color: Colors.white,),
onPressed: (){},
backgroundColor: Colors.blue,
),
],
),
);
}
}
输出:
关于android - 具有FAB风格的自定义按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60878388/