feat(App): update Finlytic Flutter app UI and blocs
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/utils/asset_utils.dart';
|
||||
import '../../../core/widgets/asset_logo_widget.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
import '../../../core/widgets/status_badge.dart';
|
||||
import '../../asset_detail/views/asset_detail_screen.dart';
|
||||
|
||||
/// Glassmorphic Event Tile widget for Corporate Calendar (Kachelansicht).
|
||||
class CalendarEventTile extends StatelessWidget {
|
||||
final Map<String, dynamic> event;
|
||||
final ApiClient apiClient;
|
||||
|
||||
const CalendarEventTile({
|
||||
super.key,
|
||||
required this.event,
|
||||
required this.apiClient,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final rawSymbol = event['symbol']?.toString() ?? event['Symbol']?.toString() ?? 'ASSET';
|
||||
final rawCompany = event['companyName']?.toString() ?? event['CompanyName']?.toString() ?? rawSymbol;
|
||||
final displayName = AssetUtils.getAssetName(rawCompany.isNotEmpty ? rawCompany : rawSymbol);
|
||||
final type = event['eventType']?.toString() ?? event['EventType']?.toString() ?? 'Earnings';
|
||||
final desc = event['description']?.toString() ?? event['Description']?.toString() ?? '';
|
||||
final dateStr = event['eventDate']?.toString() ?? event['EventDate']?.toString() ?? '';
|
||||
|
||||
String formattedDate = dateStr;
|
||||
try {
|
||||
final dt = DateTime.parse(dateStr);
|
||||
formattedDate = '${dt.day.toString().padLeft(2, '0')}.${dt.month.toString().padLeft(2, '0')}.${dt.year}';
|
||||
} catch (_) {}
|
||||
|
||||
Color badgeColor = AppTheme.primaryEmerald;
|
||||
String typeLabel = 'Quartalszahlen';
|
||||
|
||||
if (type == 'ExDividend') {
|
||||
badgeColor = AppTheme.accentCyan;
|
||||
typeLabel = 'Ex-Dividende';
|
||||
} else if (type == 'Payout') {
|
||||
badgeColor = Colors.amber;
|
||||
typeLabel = 'Zahlungstag';
|
||||
}
|
||||
|
||||
return GlassContainer(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => AssetDetailScreen(
|
||||
symbol: displayName,
|
||||
apiClient: apiClient,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
AssetLogoWidget(symbolOrName: displayName, size: 28),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
displayName,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 13.5),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
rawSymbol,
|
||||
style: TextStyle(color: AppTheme.textMuted, fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
StatusBadge(label: typeLabel, color: badgeColor),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
desc,
|
||||
style: TextStyle(color: AppTheme.textSecondary, fontSize: 12),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: [
|
||||
Text('Termin:', style: TextStyle(color: AppTheme.textMuted, fontSize: 10.5)),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
formattedDate,
|
||||
style: TextStyle(color: AppTheme.accentCyan, fontWeight: FontWeight.bold, fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user