|
|
@ -193,62 +193,104 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver { |
|
|
), |
|
|
), |
|
|
body: Stack( |
|
|
body: Stack( |
|
|
children: [ |
|
|
children: [ |
|
|
|
|
|
IntroStepBuilder( |
|
|
|
|
|
group: 'ai', |
|
|
|
|
|
order: 3, |
|
|
|
|
|
getOverlayPosition: ({ |
|
|
|
|
|
required Offset offset, |
|
|
|
|
|
required Size screenSize, |
|
|
|
|
|
required Size size, |
|
|
|
|
|
}) { |
|
|
|
|
|
return OverlayPosition( |
|
|
|
|
|
top: 200.h, |
|
|
|
|
|
width: screenSize.width, |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
overlayBuilder: (params) { |
|
|
|
|
|
return IntroOverlayBuilder.homeBuilder( |
|
|
|
|
|
params, |
|
|
|
|
|
false, |
|
|
|
|
|
title: '小言正在思考中~', |
|
|
|
|
|
onNext: () {}, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
builder: (BuildContext context, GlobalKey key) => SizedBox( |
|
|
|
|
|
key: key, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
// 主要聊天界面 |
|
|
// 主要聊天界面 |
|
|
Column( |
|
|
Column( |
|
|
children: [ |
|
|
children: [ |
|
|
// 聊天内容 |
|
|
// 聊天内容 |
|
|
Expanded( |
|
|
Expanded( |
|
|
child: Stack( |
|
|
child: Obx(() { |
|
|
children: [ |
|
|
return Align( |
|
|
IntroStepBuilder( |
|
|
alignment: Alignment.topCenter, |
|
|
group: 'ai', |
|
|
child: ListView.builder( |
|
|
order: 3, |
|
|
controller: controller.scrollController, |
|
|
overlayBuilder: (params) { |
|
|
shrinkWrap: true, |
|
|
return IntroOverlayBuilder.aiBuilder( |
|
|
reverse: true, |
|
|
params, |
|
|
padding: EdgeInsets.symmetric( |
|
|
controller.noviceGuideService.aiStepsList[ |
|
|
vertical: 16.h, horizontal: 16.w), |
|
|
controller.noviceGuideService.aiStep]['end'], |
|
|
itemCount: controller.messages.length + |
|
|
onFinish: () async { |
|
|
(controller.hasMoreMessages.value ? 1 : 0), |
|
|
if (controller.noviceGuideService.aiStep < 5) { |
|
|
itemBuilder: (context, index) { |
|
|
await Future.delayed( |
|
|
// 如果是最后一项且有更多消息,显示加载指示器 |
|
|
const Duration(milliseconds: 300)); |
|
|
if (index == controller.messages.length && |
|
|
controller.noviceGuideService.aiStep++; |
|
|
controller.hasMoreMessages.value) { |
|
|
Intro.of(Get.context!) |
|
|
return _buildLoadMoreIndicator(); |
|
|
.start(group: 'ai', reset: true); |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
builder: (BuildContext context, GlobalKey key) => Align( |
|
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
|
child: SizedBox( |
|
|
|
|
|
key: key, |
|
|
|
|
|
width: double.infinity, |
|
|
|
|
|
height: 430.w, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Obx( |
|
|
|
|
|
() => Align( |
|
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
|
child: ListView.builder( |
|
|
|
|
|
controller: controller.scrollController, |
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
reverse: true, |
|
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
|
vertical: 16.h, horizontal: 16.w), |
|
|
|
|
|
itemCount: controller.messages.length + |
|
|
|
|
|
(controller.hasMoreMessages.value ? 1 : 0), |
|
|
|
|
|
itemBuilder: (context, index) { |
|
|
|
|
|
// 如果是最后一项且有更多消息,显示加载指示器 |
|
|
|
|
|
if (index == controller.messages.length && |
|
|
|
|
|
controller.hasMoreMessages.value) { |
|
|
|
|
|
return _buildLoadMoreIndicator(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final message = controller.messages[ |
|
|
final message = controller |
|
|
controller.messages.length - 1 - index]; |
|
|
.messages[controller.messages.length - 1 - index]; |
|
|
return Padding( |
|
|
return index == 0 |
|
|
|
|
|
? IntroStepBuilder( |
|
|
|
|
|
group: 'ai', |
|
|
|
|
|
order: 4, |
|
|
|
|
|
overlayBuilder: (params) { |
|
|
|
|
|
return IntroOverlayBuilder.aiBuilder( |
|
|
|
|
|
params, |
|
|
|
|
|
controller.noviceGuideService.aiStepsList[ |
|
|
|
|
|
controller |
|
|
|
|
|
.noviceGuideService.aiStep]['end'], |
|
|
|
|
|
onFinish: () async { |
|
|
|
|
|
if (controller.noviceGuideService.aiStep < |
|
|
|
|
|
5) { |
|
|
|
|
|
await Future.delayed( |
|
|
|
|
|
const Duration(milliseconds: 300)); |
|
|
|
|
|
controller.noviceGuideService.aiStep++; |
|
|
|
|
|
Intro.of(Get.context!) |
|
|
|
|
|
.start(group: 'ai', reset: true); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
builder: |
|
|
|
|
|
(BuildContext context, GlobalKey key) => |
|
|
|
|
|
Padding( |
|
|
|
|
|
key: key, |
|
|
|
|
|
padding: EdgeInsets.only(bottom: 8.h), |
|
|
|
|
|
child: GestureDetector( |
|
|
|
|
|
onLongPressStart: |
|
|
|
|
|
(LongPressStartDetails details) { |
|
|
|
|
|
messageActionController |
|
|
|
|
|
.onLongPressMessage(context, |
|
|
|
|
|
isDarkMode, details, message); |
|
|
|
|
|
}, |
|
|
|
|
|
child: MessageBubble( |
|
|
|
|
|
isUser: message.isUser, |
|
|
|
|
|
message: message.text, |
|
|
|
|
|
timestamp: message.timestamp, |
|
|
|
|
|
isRecognizing: message.isRecognizing, |
|
|
|
|
|
hasImage: message.hasImage, |
|
|
|
|
|
imagePath: message.imagePath, |
|
|
|
|
|
meta: message.meta, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
) |
|
|
|
|
|
: Padding( |
|
|
padding: EdgeInsets.only(bottom: 8.h), |
|
|
padding: EdgeInsets.only(bottom: 8.h), |
|
|
child: GestureDetector( |
|
|
child: GestureDetector( |
|
|
onLongPressStart: |
|
|
onLongPressStart: |
|
|
@ -265,13 +307,12 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver { |
|
|
imagePath: message.imagePath, |
|
|
imagePath: message.imagePath, |
|
|
meta: message.meta, |
|
|
meta: message.meta, |
|
|
), |
|
|
), |
|
|
)); |
|
|
), |
|
|
}, |
|
|
); |
|
|
), |
|
|
}, |
|
|
), |
|
|
|
|
|
), |
|
|
), |
|
|
], |
|
|
); |
|
|
), |
|
|
}), |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
// 输入区域 |
|
|
// 输入区域 |
|
|
|