buildCategoryBox function
Implementation
Widget buildCategoryBox(String name, String imageAsset, String rate) {
return Container(
width: 120,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 2), // changes position of shadow
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
imageAsset,
height: 80,
width: 80,
fit: BoxFit.cover,
),
const SizedBox(height: 8.0),
Text(
name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 4.0),
Text(
'\$$rate',
style: const TextStyle(
fontSize: 14,
color: Colors.orange,
),
),
],
),
);
}