61 lines
2.2 KiB
Dart
61 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/theme/app_theme.dart';
|
|
import '../../../core/widgets/asset_logo_widget.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 isin = event['isin']?.toString() ?? '';
|
|
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() ?? '';
|
|
final image = event['image']?.toString() ?? (isin.isNotEmpty ? '/api/v1/logo/$isin' : null);
|
|
|
|
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: [
|
|
AssetLogoWidget(
|
|
symbolOrName: isin.isNotEmpty ? isin : company,
|
|
imageUrl: image,
|
|
size: 36,
|
|
enableHero: false,
|
|
),
|
|
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)),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|