diff --git a/lib/modules/chat/views/chat_view.dart b/lib/modules/chat/views/chat_view.dart index 073d079dc..edb80a3fc 100644 --- a/lib/modules/chat/views/chat_view.dart +++ b/lib/modules/chat/views/chat_view.dart @@ -7,6 +7,7 @@ import '../models/message_model.dart'; import '../../../core/theme/app_colors.dart'; import 'chat_music_card.dart'; import 'chat_navigation_card.dart'; +import 'weather_day_card.dart'; class ChatView extends GetView { const ChatView({Key? key}) : super(key: key); @@ -355,10 +356,13 @@ class ChatView extends GetView { ); } if (message.data != null) { - // if (message.data?['musicaudio'] != null) { - // box = ChatMusicCard(message.data, isDarkMode); - // } + if (message.data?['weatherDays'] != null) { + box = WeatherDayCard(message.data, isDarkMode); + } if (message.data?['musicaudio'] != null) { + box = ChatMusicCard(message.data, isDarkMode); + } + if (message.data?['navigationcard'] != null) { box = ChatNavigationCard(message.data, isDarkMode); } } diff --git a/lib/modules/chat/views/weather_day_card.dart b/lib/modules/chat/views/weather_day_card.dart new file mode 100644 index 000000000..72d7c0f10 --- /dev/null +++ b/lib/modules/chat/views/weather_day_card.dart @@ -0,0 +1,94 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class WeatherDayCard extends StatelessWidget { + final Map? data; + final bool isDarkMode; + + const WeatherDayCard(this.data, this.isDarkMode, {super.key}); + + @override + Widget build(BuildContext context) { + final Map weatherDays = data?['weatherDays'].first; + + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + weatherDays['date'], + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 10.sp, + ), + ), + Text( + '${weatherDays['maxTemperature']}°', + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 30.sp, + ), + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Icon( + Icons.sunny, + color: isDarkMode ? Colors.white : Colors.amber[600]!, + size: 18.w, + ), + Text( + '${weatherDays['weatherCondition']},${weatherDays['windDirection']}', + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 14.sp, + ), + ), + Row( + children: [ + Text( + '最\n高', + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 10.sp, + height: 1, + ), + ), + 5.horizontalSpace, + Text( + '${weatherDays['maxTemperature']}°', + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 20.sp, + ), + ), + 10.horizontalSpace, + Text( + '最\n低', + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 10.sp, + height: 1, + ), + ), + 5.horizontalSpace, + Text( + '${weatherDays['minTemperature']}°', + style: TextStyle( + color: isDarkMode ? Colors.white : Colors.black, + fontSize: 20.sp, + ), + ), + ], + ), + ], + ), + ], + ); + } +}