floating action button position flutter code example
Example 1: floatingactionbutton flutter
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Floating Action Button'),
),
body: Center(
child: const Text('Press the button below!')
),
floatingActionButton: FloatingActionButton(
onPressed: () {
// Add your onPressed code here!
},
child: Icon(Icons.navigation),
backgroundColor: Colors.green,
),
);
}
Example 2: flutter floating action button gradient
floatingActionButton: FloatingActionButton(
child: Container(
width: 60,
height: 60,
child: Icon(Icons.add),
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(colors: [Colors.red, Colors.blue])),
),
onPressed: () {},
)