Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add shadow to an icon in flutter?

Tags:

flutter

dart

I need to add shadows to some icons in my flutter project. I've checked the icon class constructors but nothing points to that. Any idea on how to implement that?

like image 378
Dzeri Avatar asked Mar 06 '19 22:03

Dzeri


People also ask

How do I add a shadow to a button in Flutter?

To set specific shadow color for ElevatedButton widget, set shadowColor property in ButtonStyle set to style property of this ElevatedButton with required Color value.

How do I add color to my icon on Flutter?

Steps to change icon color in FlutterStep 1: Locate the file where you have placed the Icon widget. Step 2: Inside the Icon , add color parameter and set the color of your choice. Step 3: Run your app.


2 Answers

I got what i wanted eventually using this workaround. I hope it helps whoever might need something similar.

Stack(
  children: <Widget>[
    Positioned(
      left: 1.0,
      top: 2.0,
      child: Icon(icon, color: Colors.black54),
    ),
    Icon(icon, color: Colors.white),
  ],
),
like image 115
Dzeri Avatar answered Sep 18 '22 15:09

Dzeri


Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle,               
    boxShadow: [
      BoxShadow(
        color: Colors.grey[400],
        blurRadius: 5.0,
      ),
    ]
  ),
  child: Icon(
    Icons.fiber_manual_record,
    color: Colors.amber,
    size:15,
  )
),
like image 31
Dev. Rafiq Avatar answered Sep 20 '22 15:09

Dev. Rafiq