Issue
I've implemented cards in a Flutter app. I need a custom BoxShadow
for every card. How can this be done?
What I've tried so far is to add the BoxShadow
property to the Card()
constructor, which is not working...
Solution
The Card Widget doesn't have decoration property so you need to make a card inside a Container and then apply the BoxShadow to the Container,
Sample :
class MyCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Container(
child: new Card(
child: new Center(
child: new Icon(
Icons.refresh,
size: 150.0,
),
),
),
decoration: new BoxDecoration(
boxShadow: [
new BoxShadow(
color: Colors.black,
blurRadius: 20.0,
),
],
),
);
}
}
Answered By - Raouf Rahiche
Answer Checked By - Candace Johnson (JavaFixing Volunteer)