// lib/widgets/NotificationCard.dart import 'package:flutter/material.dart'; class NotificationCard extends StatelessWidget { final IconData icon; final Color iconColor; final String title; final String description; final String? imageUrl; final VoidCallback? onMarkAsRead; final VoidCallback? onDelete; const NotificationCard({ Key? key, required this.icon, required this.iconColor, required this.title, required this.description, this.imageUrl, this.onMarkAsRead, this.onDelete, }) : super(key: key); @override Widget build(BuildContext context) { return Card( color: Colors.white, margin: const EdgeInsets.symmetric(vertical: 8.0), elevation: 4, // Shadow elevation for the card shadowColor: Colors.grey.withOpacity(0.5), // Color of the shadow shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), // Rounded corners for the card ), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, // Align text at the bottom of the icon children: [ Icon( icon, color: iconColor, size: 28, ), const SizedBox(width: 8.0), Expanded( child: Text( title, overflow: TextOverflow.ellipsis, maxLines: 2, style: const TextStyle( fontSize: 16.0, fontFamily: 'Poppins', fontWeight: FontWeight.bold, ), ), ), // Popup Menu for actions PopupMenuButton( onSelected: (value) { if (value == 'read') { if (onMarkAsRead != null) onMarkAsRead!(); } else if (value == 'delete') { if (onDelete != null) onDelete!(); } }, itemBuilder: (BuildContext context) => >[ const PopupMenuItem( value: 'read', child: Text('Mark as Read'), ), const PopupMenuItem( value: 'delete', child: Text('Delete'), ), ], ), ], ), const SizedBox(height: 8.0), const Divider(), // Divider added between title and description const SizedBox(height: 8.0), Text( description, style: const TextStyle( fontSize: 14.0, fontFamily: 'Poppins', fontWeight: FontWeight.normal, color: Colors.black, ), ), if (imageUrl != null) Align( alignment: Alignment.centerRight, child: Padding( padding: const EdgeInsets.only(top: 16.0), child: Image.asset( imageUrl!, width: 80, // Adjusted width height: 80, // Adjusted height fit: BoxFit.contain, ), ), ), ], ), ), ); } }