63 lines
2.2 KiB
Dart
63 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/theme/app_theme.dart';
|
|
import '../../../core/widgets/glass_container.dart';
|
|
import '../../../core/widgets/status_badge.dart';
|
|
|
|
/// Corporate Calendar event item widget.
|
|
class CalendarEventItem extends StatelessWidget {
|
|
final Map<String, dynamic> event;
|
|
|
|
const CalendarEventItem({super.key, required this.event});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final symbol = event['symbol']?.toString() ?? 'ASSET';
|
|
final company = event['companyName']?.toString() ?? symbol;
|
|
final type = event['eventType']?.toString() ?? 'Earnings';
|
|
final desc = event['description']?.toString() ?? '';
|
|
final dateStr = event['eventDate']?.toString() ?? '';
|
|
|
|
Color badgeColor = AppTheme.primaryEmerald;
|
|
if (type == 'ExDividend') badgeColor = AppTheme.accentCyan;
|
|
if (type == 'Payout') badgeColor = Colors.amber;
|
|
|
|
return GlassContainer(
|
|
margin: const EdgeInsets.only(bottom: 10),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: badgeColor.withValues(alpha: 0.15),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Icon(
|
|
type == 'Earnings' ? Icons.bar_chart : (type == 'ExDividend' ? Icons.content_cut : Icons.payments),
|
|
color: badgeColor,
|
|
),
|
|
),
|
|
const SizedBox(width: 14),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text('$company ($symbol)', style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14)),
|
|
const Spacer(),
|
|
StatusBadge(label: type, color: badgeColor),
|
|
],
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(desc, style: TextStyle(color: AppTheme.textSecondary, fontSize: 12)),
|
|
const SizedBox(height: 4),
|
|
Text('Datum: $dateStr', style: TextStyle(color: AppTheme.textMuted, fontSize: 11)),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|