I have made a horizontal list view and in it, I have CircleAvatar
just like how Instagram stories are placed in the app but I want to add a shadow under all of the circles.
Here is my code :
Container(
height: 105.0,
child: ListView.builder(
padding: EdgeInsets.only(left: 10.0),
scrollDirection: Axis.horizontal,
itemCount: favorites.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
CircleAvatar(
radius: 30.0,
backgroundImage: AssetImage(favorites[index].imageUrl),
),
SizedBox(height: 6.0),
Text(
favorites[index].name,
style: TextStyle(
color: Colors.grey,
fontSize: 14.0,
fontWeight: FontWeight.w400),
),
],
),
);
},
),
),
Wrap your avatar inside a container:
Container(
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
boxShadow: [BoxShadow(blurRadius: 10, color: Colors.black, spreadRadius: 5)],
),
child: CircleAvatar(
radius: 30.0,
backgroundImage: AssetImage(favorites[index].imageUrl),
),
);