import 'package:flutter/material.dart'; import '../../core/theme.dart'; import '../../models/announcement_model.dart'; import '../../screens/home/pengumuman_detail_screen.dart'; class PengumumanCard extends StatelessWidget { final AnnouncementModel pengumuman; final VoidCallback? onTap; const PengumumanCard({ Key? key, required this.pengumuman, this.onTap, }) : super(key: key); @override Widget build(BuildContext context) { return Container( width: 300, margin: const EdgeInsets.only(right: AppTheme.spacingMd), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(AppTheme.radiusXl), boxShadow: AppTheme.shadowMd, ), child: Material( color: Colors.transparent, borderRadius: BorderRadius.circular(AppTheme.radiusXl), child: InkWell( onTap: onTap ?? () { Navigator.push( context, MaterialPageRoute( builder: (_) => PengumumanDetailScreen(pengumuman: pengumuman), ), ); }, borderRadius: BorderRadius.circular(AppTheme.radiusXl), child: Padding( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: AppTheme.primaryOrange.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(12), ), child: const Icon( Icons.campaign_rounded, color: AppTheme.primaryOrange, size: 20, ), ), const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( pengumuman.title, style: AppTheme.labelLarge.copyWith( color: AppTheme.textPrimary, fontWeight: FontWeight.bold, fontSize: 14, ), maxLines: 1, overflow: TextOverflow.ellipsis, ), const SizedBox(height: 2), Text( pengumuman.namaPembuat, style: AppTheme.bodySmall.copyWith( color: AppTheme.textTertiary, fontSize: 11, ), ), ], ), ), ], ), const SizedBox(height: 12), Text( pengumuman.description, style: AppTheme.bodySmall.copyWith( color: AppTheme.textSecondary, height: 1.5, ), maxLines: 2, overflow: TextOverflow.ellipsis, ), const Spacer(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( pengumuman.date, style: AppTheme.bodySmall.copyWith( color: AppTheme.textTertiary, fontSize: 10, ), ), Container( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), decoration: BoxDecoration( color: AppTheme.primaryBlue.withValues(alpha: 0.05), borderRadius: BorderRadius.circular(AppTheme.radiusFull), border: Border.all(color: AppTheme.primaryBlue.withValues(alpha: 0.1)), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Text( "Detail", style: AppTheme.bodySmall.copyWith( color: AppTheme.primaryBlue, fontWeight: FontWeight.w600, fontSize: 10, ), ), const SizedBox(width: 4), const Icon(Icons.arrow_forward_ios, color: AppTheme.primaryBlue, size: 8), ], ), ), ], ), ], ), ), ), ), ); } }