|
|
|
@ -764,7 +764,7 @@ class MessageBubble extends GetView<AgentController> { |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
Icon( |
|
|
|
const Icon( |
|
|
|
Icons.wb_sunny, |
|
|
|
size: 48, |
|
|
|
color: Colors.white, |
|
|
|
@ -777,7 +777,7 @@ class MessageBubble extends GetView<AgentController> { |
|
|
|
color: Colors.white.withOpacity(0.2), |
|
|
|
), |
|
|
|
SizedBox(height: 16), |
|
|
|
Text( |
|
|
|
const Text( |
|
|
|
'未来预报', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14, |
|
|
|
@ -803,11 +803,15 @@ class MessageBubble extends GetView<AgentController> { |
|
|
|
(index) { |
|
|
|
String dateStr = days[index]['date']; |
|
|
|
DateTime? date = DateUtil.getDateTime(dateStr); |
|
|
|
String weekday = DateUtil.getWeekday(date); |
|
|
|
IconData weatherIcon = |
|
|
|
getWeatherIcon(days[index]['weatherCondition']); |
|
|
|
String weekday = DateUtil.getWeekday(date, |
|
|
|
languageCode: "zh", short: true); |
|
|
|
String temp = "${days[index]['temperature']}°"; |
|
|
|
return _buildForecastDay( |
|
|
|
weekday, |
|
|
|
Icons.wb_sunny, |
|
|
|
days[index]['temperature'], |
|
|
|
weatherIcon, |
|
|
|
temp, |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
@ -915,6 +919,107 @@ class MessageBubble extends GetView<AgentController> { |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 获取天气图标 |
|
|
|
IconData getWeatherIcon(String description) { |
|
|
|
description = description.trim(); |
|
|
|
|
|
|
|
if (["晴", "少云", "晴间多云"].contains(description)) { |
|
|
|
return Icons.wb_sunny; |
|
|
|
} |
|
|
|
|
|
|
|
if (["多云", "阴"].contains(description)) { |
|
|
|
return Icons.cloud; |
|
|
|
} |
|
|
|
|
|
|
|
if (description.contains("雾") || |
|
|
|
["雾", "浓雾", "强浓雾", "轻雾", "大雾", "特强浓雾", "霾", "中度霾", "重度霾", "严重霾"] |
|
|
|
.contains(description)) { |
|
|
|
return Icons.blur_on; |
|
|
|
} |
|
|
|
|
|
|
|
if (description.contains("风") || |
|
|
|
[ |
|
|
|
"有风", |
|
|
|
"平静", |
|
|
|
"微风", |
|
|
|
"和风", |
|
|
|
"清风", |
|
|
|
"强风/劲风", |
|
|
|
"疾风", |
|
|
|
"大风", |
|
|
|
"烈风", |
|
|
|
"风暴", |
|
|
|
"狂爆风", |
|
|
|
"飓风", |
|
|
|
"热带风暴" |
|
|
|
].contains(description)) { |
|
|
|
return Icons.air; |
|
|
|
} |
|
|
|
|
|
|
|
if (description.contains("雨") || |
|
|
|
[ |
|
|
|
"阵雨", |
|
|
|
"雷阵雨", |
|
|
|
"雷阵雨并伴有冰雹", |
|
|
|
"小雨", |
|
|
|
"中雨", |
|
|
|
"大雨", |
|
|
|
"暴雨", |
|
|
|
"大暴雨", |
|
|
|
"特大暴雨", |
|
|
|
"强阵雨", |
|
|
|
"强雷阵雨", |
|
|
|
"极端降雨", |
|
|
|
"毛毛雨/细雨", |
|
|
|
"雨", |
|
|
|
"小雨-中雨", |
|
|
|
"中雨-大雨", |
|
|
|
"大雨-暴雨", |
|
|
|
"暴雨-大暴雨", |
|
|
|
"大暴雨-特大暴雨" |
|
|
|
].contains(description)) { |
|
|
|
return Icons.grain; // 或使用 community icon 包:weather_icons 中的 rain |
|
|
|
} |
|
|
|
|
|
|
|
if (description.contains("雪") || |
|
|
|
[ |
|
|
|
"雨雪天气", |
|
|
|
"雨夹雪", |
|
|
|
"阵雨夹雪", |
|
|
|
"冻雨", |
|
|
|
"雪", |
|
|
|
"阵雪", |
|
|
|
"小雪", |
|
|
|
"中雪", |
|
|
|
"大雪", |
|
|
|
"暴雪", |
|
|
|
"小雪-中雪", |
|
|
|
"中雪-大雪", |
|
|
|
"大雪-暴雪" |
|
|
|
].contains(description)) { |
|
|
|
return Icons.ac_unit; |
|
|
|
} |
|
|
|
|
|
|
|
if (["浮尘", "扬沙", "沙尘暴", "强沙尘暴"].contains(description)) { |
|
|
|
return Icons.filter_drama; |
|
|
|
} |
|
|
|
|
|
|
|
if (["龙卷风"].contains(description)) { |
|
|
|
return Icons.waves; |
|
|
|
} |
|
|
|
|
|
|
|
if (["热"].contains(description)) { |
|
|
|
return Icons.local_fire_department; |
|
|
|
} |
|
|
|
|
|
|
|
if (["冷"].contains(description)) { |
|
|
|
return Icons.ac_unit; |
|
|
|
} |
|
|
|
|
|
|
|
// 默认或未知天气 |
|
|
|
return Icons.help_outline; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 动画点组件 |
|
|
|
|