nesward_flutter_app/lib/widgets/feature.dart

121 lines
2.9 KiB
Dart

import 'package:flutter/material.dart';
/// Feature Model
class Feature {
final IconData? icon; // optional
final String? imagePath; // optional
final String title;
final String description;
Feature({
this.icon,
this.imagePath,
required this.title,
required this.description,
});
}
/// Feature List (Global)
final List<Feature> features = [
Feature(
imagePath: 'assets/img.png', // now valid
title: 'Best prices & offers',
description:
'Oders 50 or more',
),
Feature(
imagePath: 'assets/img_1.png',
title: 'Free delivery',
description:
'24/7 amazing services',
),
Feature(
imagePath: 'assets/img_2.png',
title: 'Smart notifications',
description: 'Get timely alerts and updates that matter to you.',
),
Feature(
imagePath: 'assets/img_3.png',
title: 'Cloud backup',
description:
'Automatic backups ensure you never lose important information.',
),
Feature(
imagePath: 'assets/img_4.png',
title: 'Advanced analytics',
description:
'Gain insights with powerful analytics and reporting tools.',
),
Feature(
imagePath: 'assets/img_5.png',
title: '24/7 support',
description:
'Our support team is always ready to help you with any questions.',
),
];
/// Widget to Display Each Feature Card
class FeatureCard extends StatelessWidget {
final Feature feature;
const FeatureCard({super.key, required this.feature});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(0),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 0,
offset: const Offset(0, 4),
),
],
),
child: Row(
children: [
CircleAvatar(
radius:20,
child: feature.imagePath != null
? Image.asset(
feature.imagePath!,
width: 20,
height: 25,
)
: Icon(
feature.icon,
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
feature.title,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 6),
Text(
feature.description,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
),
),
],
),
),
],
),
);
}
}