diff --git a/lib/data/services/network/nw_api.dart b/lib/data/services/network/nw_api.dart index 69b0e9eef..8feff1db5 100644 --- a/lib/data/services/network/nw_api.dart +++ b/lib/data/services/network/nw_api.dart @@ -1,5 +1,5 @@ class NWApi { // static const baseApi = "https://www.deapsound.com"; - // static const baseApi = "https://api.deapsound.com"; - static const baseApi = "https://api.ideapsound.com"; + static const baseApi = "https://api.deapsound.com"; + // static const baseApi = "https://api.ideapsound.com"; } diff --git a/lib/modules/agent/views/message_bubble.dart b/lib/modules/agent/views/message_bubble.dart index 8eeb04681..2c13b6f80 100644 --- a/lib/modules/agent/views/message_bubble.dart +++ b/lib/modules/agent/views/message_bubble.dart @@ -224,6 +224,12 @@ class MessageBubble extends GetView { now, daylist, ); + } else if (mate!.keys.contains('card_travel')) { + final rawList = mate!['card_travel']['items'] as List; + final travellist = + rawList.map((e) => Map.from(e)).toList(); + // 旅游 + return _buildTravelContent(context, travellist); } // if (message.contains('播放列表') || message.contains('音乐')) { @@ -406,12 +412,13 @@ class MessageBubble extends GetView { } /// 构建旅游内容卡片 - Widget _buildTravelContent(BuildContext context) { + Widget _buildTravelContent( + BuildContext context, List> travellist) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - '以下是一些推荐的景点:', + const Text( + '以下是一些推搜索结果:', style: TextStyle( color: Colors.black87, fontSize: 14, @@ -437,32 +444,54 @@ class MessageBubble extends GetView { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Icon( - Icons.place, - size: 16, - color: Color(0xFFE11D48), - ), - const SizedBox(width: 6), - Text( - '热门景点 · 东京', - style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.w600, - color: Colors.grey[700], - ), - ), - ], - ), - const SizedBox(height: 10), + // Row( + // children: [ + // Icon( + // Icons.place, + // size: 16, + // color: Color(0xFFE11D48), + // ), + // const SizedBox(width: 6), + // Text( + // '热门景点 · 东京', + // style: TextStyle( + // fontSize: 13, + // fontWeight: FontWeight.w600, + // color: Colors.grey[700], + // ), + // ), + // ], + // ), + // const SizedBox(height: 10), - // 景点列表 - _buildLocationItem('东京塔', '标志性建筑,可俯瞰东京全景', context), - Divider(height: 1, thickness: 1, color: Colors.grey[100]), - _buildLocationItem('涩谷十字路口', '世界上最繁忙的十字路口之一', context), - Divider(height: 1, thickness: 1, color: Colors.grey[100]), - _buildLocationItem('浅草寺', '东京最古老的寺庙', context), + // 动态生成音乐条目 + ...travellist.asMap().entries.map((entry) { + final index = entry.key; + final item = entry.value; + final name = item["name"] ?? "未知歌曲"; //名字 + final addr = item["addr"] ?? ""; //地址 + final tag = item["tag"] ?? "未知歌手"; //标签 + final rating = item["rating"] ?? ""; //评分 + final distance = item["distance"] ?? ""; //距离 + final images = item["images"] ?? []; // 图片列表 + return Column( + children: [ + _buildLocationItem( + context, + name, + addr, + ), + if (index != travellist.length - 1) + Divider(height: 1, thickness: 1, color: Colors.grey[100]), + ], + ); + }).toList(), + // // 景点列表 + // _buildLocationItem('东京塔', '标志性建筑,可俯瞰东京全景', context), + // Divider(height: 1, thickness: 1, color: Colors.grey[100]), + // _buildLocationItem('涩谷十字路口', '世界上最繁忙的十字路口之一', context), + // Divider(height: 1, thickness: 1, color: Colors.grey[100]), + // _buildLocationItem('浅草寺', '东京最古老的寺庙', context), const SizedBox(height: 8), Center( @@ -621,7 +650,7 @@ class MessageBubble extends GetView { /// 构建地点项目 Widget _buildLocationItem( - String name, String description, BuildContext context) { + BuildContext context, String name, String description) { return Padding( padding: const EdgeInsets.symmetric(vertical: 8), child: Row(