feat(news,calendar): improve corporate calendar filters and news sentiment dialogs
This commit is contained in:
@@ -15,15 +15,26 @@ class StatusBadge extends StatelessWidget {
|
||||
});
|
||||
|
||||
factory StatusBadge.sentiment(String status, {double? score}) {
|
||||
Color bg = AppTheme.textMuted;
|
||||
if (status.toUpperCase().contains('POS') || (score != null && score > 0.15)) {
|
||||
final sUpper = status.trim().toUpperCase();
|
||||
Color bg;
|
||||
if (sUpper.contains('POS')) {
|
||||
bg = AppTheme.primaryEmerald;
|
||||
} else if (status.toUpperCase().contains('NEG') || (score != null && score < -0.15)) {
|
||||
} else if (sUpper.contains('NEG')) {
|
||||
bg = AppTheme.accentRed;
|
||||
} else if (status.toUpperCase().contains('NEU')) {
|
||||
} else if (sUpper.contains('NEU')) {
|
||||
bg = AppTheme.accentCyan;
|
||||
} else if (score != null) {
|
||||
if (score > 0.15) {
|
||||
bg = AppTheme.primaryEmerald;
|
||||
} else if (score < -0.15) {
|
||||
bg = AppTheme.accentRed;
|
||||
} else {
|
||||
bg = AppTheme.accentCyan;
|
||||
}
|
||||
} else {
|
||||
bg = AppTheme.textMuted;
|
||||
}
|
||||
return StatusBadge(label: status.toUpperCase(), color: bg);
|
||||
return StatusBadge(label: sUpper.isNotEmpty ? sUpper : 'NEUTRAL', color: bg);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user