|
|
|
@ -42,6 +42,58 @@ class WeatherDetailsPage extends StatelessWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Get color based on category label
|
|
|
|
|
|
|
|
Color _getColorFromCategory(String? categoryLabel) {
|
|
|
|
|
|
|
|
if (categoryLabel == null) return AppColors.successColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final category = categoryLabel.toLowerCase().trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Green: Low, Beneficial
|
|
|
|
|
|
|
|
if (category.contains('low') || category.contains('beneficial')) {
|
|
|
|
|
|
|
|
return AppColors.successColor;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Yellow: Fair
|
|
|
|
|
|
|
|
else if (category.contains('fair')) {
|
|
|
|
|
|
|
|
return AppColors.warningColorYellow;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Red: Very High, At High Risk
|
|
|
|
|
|
|
|
else if (category.contains('very high') || category.contains('at high risk')) {
|
|
|
|
|
|
|
|
return AppColors.errorColor;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Orange: Risk, High (but not "very high" or "at high risk")
|
|
|
|
|
|
|
|
else if (category.contains('risk') || category.contains('high')) {
|
|
|
|
|
|
|
|
return AppColors.warningColor;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return AppColors.successColor; // Default to green
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Get background color based on category label
|
|
|
|
|
|
|
|
Color _getBackgroundFromCategory(String? categoryLabel) {
|
|
|
|
|
|
|
|
if (categoryLabel == null) return AppColors.successLightColor.withValues(alpha: 0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final category = categoryLabel.toLowerCase().trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Green: Low, Beneficial
|
|
|
|
|
|
|
|
if (category.contains('low') || category.contains('beneficial')) {
|
|
|
|
|
|
|
|
return AppColors.successLightColor.withValues(alpha: 0.1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Yellow: Fair
|
|
|
|
|
|
|
|
else if (category.contains('fair')) {
|
|
|
|
|
|
|
|
return AppColors.warningColorYellow.withValues(alpha: 0.1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Red: Very High, At High Risk
|
|
|
|
|
|
|
|
else if (category.contains('very high') || category.contains('at high risk')) {
|
|
|
|
|
|
|
|
return AppColors.errorLightColor.withValues(alpha: 0.1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Orange: Risk, High (but not "very high" or "at high risk")
|
|
|
|
|
|
|
|
else if (category.contains('risk') || category.contains('high')) {
|
|
|
|
|
|
|
|
return AppColors.warningLightColor.withValues(alpha: 0.1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return AppColors.successLightColor.withValues(alpha: 0.1); // Default to green
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IconData _getIconFromCategory(String? category) {
|
|
|
|
IconData _getIconFromCategory(String? category) {
|
|
|
|
if (category == null) return Icons.wb_sunny_outlined;
|
|
|
|
if (category == null) return Icons.wb_sunny_outlined;
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,8 +136,8 @@ class WeatherDetailsPage extends StatelessWidget {
|
|
|
|
return _buildCategoryCard(
|
|
|
|
return _buildCategoryCard(
|
|
|
|
description: cityInfo.name ?? '',
|
|
|
|
description: cityInfo.name ?? '',
|
|
|
|
categoryLabel: cityInfo.category ?? '',
|
|
|
|
categoryLabel: cityInfo.category ?? '',
|
|
|
|
color: _getColorFromColorName(cityInfo.colorName),
|
|
|
|
color: _getColorFromCategory(cityInfo.category),
|
|
|
|
backgroundColor: _getBackgroundColorFromColorName(cityInfo.colorName),
|
|
|
|
backgroundColor: _getBackgroundFromCategory(cityInfo.category),
|
|
|
|
icon: _getIconFromCategory(cityInfo.category),
|
|
|
|
icon: _getIconFromCategory(cityInfo.category),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
@ -173,7 +225,7 @@ class WeatherDetailsPage extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: categoryLabel.toText12(
|
|
|
|
child: categoryLabel.toText12(
|
|
|
|
color: color,
|
|
|
|
color: color,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
isBold: true,
|
|
|
|
maxLine: 1
|
|
|
|
maxLine: 1
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|