feat(news,calendar): improve corporate calendar filters and news sentiment dialogs
This commit is contained in:
@@ -25,9 +25,29 @@ class CalendarLoaded extends CalendarState {
|
||||
this.selectedDate,
|
||||
});
|
||||
|
||||
static bool matchesCategory(String eventType, String category) {
|
||||
if (category == 'Alle' || category.isEmpty) return true;
|
||||
final catKey = category.toLowerCase();
|
||||
final t = eventType.toLowerCase();
|
||||
|
||||
if (catKey.contains('earn') || catKey.contains('quartal') || catKey.contains('ergebnis')) {
|
||||
return t.contains('earn') || t.contains('quart') || t.contains('ergebnis') || t.contains('finan') || t.contains('report') || t.contains('bilanz') || t == 'event';
|
||||
}
|
||||
if (catKey.contains('ex') || catKey.contains('div')) {
|
||||
return (t.contains('ex') || t.contains('div') || t.contains('ausschütt')) && !t.contains('pay') && !t.contains('zahl');
|
||||
}
|
||||
if (catKey.contains('pay') || catKey.contains('zahl')) {
|
||||
return t.contains('pay') || t.contains('zahl') || t.contains('auszahl');
|
||||
}
|
||||
if (catKey.contains('split')) {
|
||||
return t.contains('split');
|
||||
}
|
||||
return t.contains(catKey) || t == catKey;
|
||||
}
|
||||
|
||||
List<CorporateEventModel> get filteredEvents {
|
||||
return allEvents.where((e) {
|
||||
if (selectedCategory != 'Alle' && e.eventType != selectedCategory) {
|
||||
if (!matchesCategory(e.eventType, selectedCategory)) {
|
||||
return false;
|
||||
}
|
||||
if (selectedDate != null) {
|
||||
|
||||
@@ -33,7 +33,7 @@ class _CorporateCalendarScreenContent extends StatelessWidget {
|
||||
|
||||
const _CorporateCalendarScreenContent({required this.apiClient});
|
||||
|
||||
static const List<String> categories = ['Alle', 'Earnings', 'ExDividend', 'Payout'];
|
||||
static const List<String> categories = ['Alle', 'Earnings', 'ExDividend', 'Payout', 'Split'];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -86,6 +86,7 @@ class _CorporateCalendarScreenContent extends StatelessWidget {
|
||||
if (cat == 'Earnings') label = 'Quartalsergebnisse';
|
||||
if (cat == 'ExDividend') label = 'Ex-Dividendentage';
|
||||
if (cat == 'Payout') label = 'Zahlungstage';
|
||||
if (cat == 'Split') label = 'Aktiensplits';
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
|
||||
@@ -36,12 +36,21 @@ class CalendarEventTile extends StatelessWidget {
|
||||
Color badgeColor = AppTheme.primaryEmerald;
|
||||
String typeLabel = 'Quartalszahlen';
|
||||
|
||||
if (type == 'ExDividend') {
|
||||
badgeColor = AppTheme.accentCyan;
|
||||
typeLabel = 'Ex-Dividende';
|
||||
} else if (type == 'Payout') {
|
||||
final tLower = type.toLowerCase();
|
||||
if (tLower.contains('ex') || tLower.contains('div') || tLower.contains('ausschütt')) {
|
||||
if (tLower.contains('pay') || tLower.contains('zahl')) {
|
||||
badgeColor = Colors.amber;
|
||||
typeLabel = 'Zahlungstag';
|
||||
} else {
|
||||
badgeColor = AppTheme.accentCyan;
|
||||
typeLabel = 'Ex-Dividende';
|
||||
}
|
||||
} else if (tLower.contains('pay') || tLower.contains('zahl') || tLower.contains('auszahl')) {
|
||||
badgeColor = Colors.amber;
|
||||
typeLabel = 'Zahlungstag';
|
||||
} else if (tLower.contains('split')) {
|
||||
badgeColor = Colors.purpleAccent;
|
||||
typeLabel = 'Aktiensplit';
|
||||
}
|
||||
|
||||
return GlassContainer(
|
||||
|
||||
Reference in New Issue
Block a user