floatingActionButton: FloatingActionButton(
onPressed: () {},
child: Icon(Icons.add),
backgroundColor: Colors.blueGrey[800],
),
How can I set custom opacity/transparency value to the floatingActionButton? Is there a property where the % of transparency be defined?
you can set transparency of a floating button by adding opacity to its color
floatingActionButton: FloatingActionButton(
onPressed: () {},
child: Icon(Icons.add),
backgroundColor: Colors.blueGrey.withOpacity(0.5),
),
If you want to keep the original color itself but to change the transparency only, use
Theme.of(context).colorScheme.primaryContainer.withOpacity(0.5)
for the backgroundColor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With