From 7f2e3894debf3981d3f1a75a722bc8f92652b1e4 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 12 Jun 2025 14:26:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=A9=E6=B0=94=E9=A2=84?= =?UTF-8?q?=E6=8A=A5=E5=8D=A1=E7=89=87=E8=AF=9D=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/modules/agent/views/message_bubble.dart | 8 ++++---- lib/modules/agent/views/weather_card.dart | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/modules/agent/views/message_bubble.dart b/lib/modules/agent/views/message_bubble.dart index ee6af73c5..c72c22ee5 100644 --- a/lib/modules/agent/views/message_bubble.dart +++ b/lib/modules/agent/views/message_bubble.dart @@ -249,12 +249,12 @@ class MessageBubble extends GetView { rawList.map((e) => Map.from(e)).toList(); //音乐播放列表 return buildMusicContent(context, playlist); - } else if (meta!.keys.contains('card_weather')) { - final city = meta!['card_weather']['city'] as String; - final rawList = meta!['card_weather']['dayweather'] as List; + } else if (meta!.keys.contains('maps_weather')) { + final city = meta!['maps_weather']['city'] as String; + final rawList = meta!['maps_weather']['forecasts'] as List; final daylist = rawList.map((e) => Map.from(e)).toList(); - final now = meta!['card_weather']['day'] as Map; + final now = daylist[0] as Map; //天气 return buildWeatherContent( context, diff --git a/lib/modules/agent/views/weather_card.dart b/lib/modules/agent/views/weather_card.dart index aba39038e..323a4a483 100644 --- a/lib/modules/agent/views/weather_card.dart +++ b/lib/modules/agent/views/weather_card.dart @@ -62,7 +62,7 @@ Widget buildWeatherContent(BuildContext context, String city, ), SizedBox(height: 4), Text( - now["weatherCondition"], + now["dayweather"], style: TextStyle( fontSize: 14, color: Colors.white.withOpacity(0.9), @@ -72,7 +72,7 @@ Widget buildWeatherContent(BuildContext context, String city, Row( children: [ Text( - "${now["temperature"]}°", + "${now["daytemp"]}°", style: const TextStyle( fontSize: 36, fontWeight: FontWeight.bold, @@ -84,14 +84,14 @@ Widget buildWeatherContent(BuildContext context, String city, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - '最高: ${now["maxTemperature"]}°', + '最高: ${now["daytemp"]}°', style: TextStyle( fontSize: 12, color: Colors.white.withOpacity(0.9), ), ), Text( - '最低: ${now["minTemperature"]}°', + '最低: ${now["nighttemp"]}°', style: TextStyle( fontSize: 12, color: Colors.white.withOpacity(0.9), @@ -103,8 +103,8 @@ Widget buildWeatherContent(BuildContext context, String city, ), ], ), - const Icon( - Icons.wb_sunny, + Icon( + getWeatherIcon(now['dayweather']), size: 48, color: Colors.white, ), @@ -133,10 +133,10 @@ Widget buildWeatherContent(BuildContext context, String city, String dateStr = days[index]['date']; DateTime? date = DateUtil.getDateTime(dateStr); IconData weatherIcon = - getWeatherIcon(days[index]['weatherCondition']); + getWeatherIcon(days[index]['dayweather']); String weekday = DateUtil.getWeekday(date, languageCode: "zh", short: true); - String temp = "${days[index]['temperature']}°"; + String temp = "${days[index]['daytemp']}°"; return _buildForecastDay( weekday, weatherIcon,