|
|
|
@ -224,6 +224,12 @@ class MessageBubble extends GetView<AgentController> { |
|
|
|
now, |
|
|
|
daylist, |
|
|
|
); |
|
|
|
} else if (mate!.keys.contains('card_travel')) { |
|
|
|
final rawList = mate!['card_travel']['items'] as List; |
|
|
|
final travellist = |
|
|
|
rawList.map((e) => Map<String, dynamic>.from(e)).toList(); |
|
|
|
// 旅游 |
|
|
|
return _buildTravelContent(context, travellist); |
|
|
|
} |
|
|
|
|
|
|
|
// if (message.contains('播放列表') || message.contains('音乐')) { |
|
|
|
@ -406,12 +412,13 @@ class MessageBubble extends GetView<AgentController> { |
|
|
|
} |
|
|
|
|
|
|
|
/// 构建旅游内容卡片 |
|
|
|
Widget _buildTravelContent(BuildContext context) { |
|
|
|
Widget _buildTravelContent( |
|
|
|
BuildContext context, List<Map<String, dynamic>> 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<AgentController> { |
|
|
|
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<AgentController> { |
|
|
|
|
|
|
|
/// 构建地点项目 |
|
|
|
Widget _buildLocationItem( |
|
|
|
String name, String description, BuildContext context) { |
|
|
|
BuildContext context, String name, String description) { |
|
|
|
return Padding( |
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8), |
|
|
|
child: Row( |
|
|
|
|