Итак, если вы хотите, чтобы фабрики были расположены в вертикальном порядке, оберните их в Столбец , например,
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,
),
],
),
);
}
}
Вывод: