|
|
@ -742,151 +742,143 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver { |
|
|
SizedBox(width: 8.w), |
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
|
|
|
// 动态按钮区域:展开按钮 + 发送按钮 或 图片选择按钮 |
|
|
// 动态按钮区域:展开按钮 + 发送按钮 或 图片选择按钮 |
|
|
Builder(builder: (context) { |
|
|
IntroStepBuilder( |
|
|
StepWidgetParams? widgetParams; |
|
|
group: 'ai', |
|
|
return IntroStepBuilder( |
|
|
order: 2, |
|
|
group: 'ai', |
|
|
getOverlayPosition: |
|
|
order: 2, |
|
|
IntroOverlayBuilder.overlayPosition, |
|
|
onHighlightWidgetTap: () async { |
|
|
overlayBuilder: (params) { |
|
|
await controller |
|
|
return IntroOverlayBuilder.aiBuilder( |
|
|
.noviceGuideService.aiStepsList[ |
|
|
params, |
|
|
controller.noviceGuideService.aiStep] |
|
|
'点击发送,${controller.noviceGuideService.aiStepsList[controller.noviceGuideService.aiStep]['send']}', |
|
|
['method'](); |
|
|
alignment: false, |
|
|
widgetParams!.onNext!(); |
|
|
onTap: () async { |
|
|
controller.sendMessage(); |
|
|
await controller |
|
|
}, |
|
|
.noviceGuideService.aiStepsList[ |
|
|
getOverlayPosition: |
|
|
controller.noviceGuideService |
|
|
IntroOverlayBuilder.overlayPosition, |
|
|
.aiStep]['method'](); |
|
|
overlayBuilder: (params) { |
|
|
params.onNext!(); |
|
|
widgetParams = params; |
|
|
controller.sendMessage(); |
|
|
return IntroOverlayBuilder.aiBuilder( |
|
|
}, |
|
|
params, |
|
|
); |
|
|
'点击发送,${controller.noviceGuideService.aiStepsList[controller.noviceGuideService.aiStep]['send']}', |
|
|
}, |
|
|
alignment: false, |
|
|
builder: (BuildContext context, GlobalKey key) => |
|
|
); |
|
|
Obx( |
|
|
}, |
|
|
key: key, |
|
|
builder: |
|
|
() { |
|
|
(BuildContext context, GlobalKey key) => |
|
|
final hasText = controller.hasTextInput.value; |
|
|
Obx( |
|
|
final hasImage = |
|
|
key: key, |
|
|
controller.isImageInputActive.value; |
|
|
() { |
|
|
final shouldShowSend = hasText || hasImage; |
|
|
final hasText = |
|
|
final shouldShowExpand = |
|
|
controller.hasTextInput.value; |
|
|
controller.shouldShowExpandButton.value; |
|
|
final hasImage = |
|
|
|
|
|
controller.isImageInputActive.value; |
|
|
|
|
|
final shouldShowSend = hasText || hasImage; |
|
|
|
|
|
final shouldShowExpand = |
|
|
|
|
|
controller.shouldShowExpandButton.value; |
|
|
|
|
|
|
|
|
|
|
|
if (shouldShowSend) { |
|
|
if (shouldShowSend) { |
|
|
// 显示发送按钮(可能还有展开按钮) |
|
|
// 显示发送按钮(可能还有展开按钮) |
|
|
return Column( |
|
|
return Column( |
|
|
children: [ |
|
|
children: [ |
|
|
// 展开按钮(在发送按钮上方) |
|
|
// 展开按钮(在发送按钮上方) |
|
|
if (shouldShowExpand && hasText) |
|
|
if (shouldShowExpand && hasText) |
|
|
Padding( |
|
|
Padding( |
|
|
padding: |
|
|
padding: |
|
|
EdgeInsets.only(bottom: 40.h), |
|
|
EdgeInsets.only(bottom: 40.h), |
|
|
child: GestureDetector( |
|
|
child: GestureDetector( |
|
|
onTap: () { |
|
|
onTap: () { |
|
|
// 打开底部弹出编辑模式 |
|
|
// 打开底部弹出编辑模式 |
|
|
|
|
|
controller.openFullScreenEdit(); |
|
|
|
|
|
showModalBottomSheet( |
|
|
|
|
|
context: context, |
|
|
|
|
|
isScrollControlled: true, |
|
|
|
|
|
backgroundColor: |
|
|
|
|
|
Colors.transparent, |
|
|
|
|
|
builder: (context) => |
|
|
|
|
|
const FullScreenEditor(), |
|
|
|
|
|
).then((_) { |
|
|
|
|
|
// 弹出页关闭时的回调 |
|
|
controller |
|
|
controller |
|
|
.openFullScreenEdit(); |
|
|
.closeFullScreenEdit(); |
|
|
showModalBottomSheet( |
|
|
}); |
|
|
context: context, |
|
|
}, |
|
|
isScrollControlled: true, |
|
|
child: Container( |
|
|
backgroundColor: |
|
|
width: 32.w, |
|
|
Colors.transparent, |
|
|
height: 32.w, |
|
|
builder: (context) => |
|
|
decoration: BoxDecoration( |
|
|
const FullScreenEditor(), |
|
|
color: isDarkMode |
|
|
).then((_) { |
|
|
? Colors.grey[700] |
|
|
// 弹出页关闭时的回调 |
|
|
: Colors.grey[300], |
|
|
controller |
|
|
borderRadius: |
|
|
.closeFullScreenEdit(); |
|
|
BorderRadius.circular( |
|
|
}); |
|
|
16.w), |
|
|
}, |
|
|
), |
|
|
child: Container( |
|
|
child: Icon( |
|
|
width: 32.w, |
|
|
Icons.expand_less, |
|
|
height: 32.w, |
|
|
color: isDarkMode |
|
|
decoration: BoxDecoration( |
|
|
? Colors.grey[300] |
|
|
color: isDarkMode |
|
|
: Colors.grey[700], |
|
|
? Colors.grey[700] |
|
|
size: 20.sp, |
|
|
: Colors.grey[300], |
|
|
|
|
|
borderRadius: |
|
|
|
|
|
BorderRadius.circular( |
|
|
|
|
|
16.w), |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.expand_less, |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.grey[300] |
|
|
|
|
|
: Colors.grey[700], |
|
|
|
|
|
size: 20.sp, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
// 发送按钮 |
|
|
|
|
|
GestureDetector( |
|
|
|
|
|
onTap: () => |
|
|
|
|
|
controller.sendMessage(), |
|
|
|
|
|
child: Container( |
|
|
|
|
|
width: 44.w, |
|
|
|
|
|
height: 44.w, |
|
|
|
|
|
margin: EdgeInsets.symmetric( |
|
|
|
|
|
vertical: 2.w), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: primaryColor, |
|
|
|
|
|
borderRadius: |
|
|
|
|
|
BorderRadius.circular(22.w), |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.send, |
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
size: 22.sp, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
// 发送按钮 |
|
|
); |
|
|
GestureDetector( |
|
|
} else { |
|
|
onTap: () => controller.sendMessage(), |
|
|
// 显示'+'选择按钮 |
|
|
|
|
|
return Obx(() { |
|
|
|
|
|
final isExpanded = controller |
|
|
|
|
|
.isPlusOptionsExpanded.value; |
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
controller.togglePlusOptions(); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Container( |
|
|
child: Container( |
|
|
width: 44.w, |
|
|
width: 44.w, |
|
|
height: 44.w, |
|
|
height: 44.w, |
|
|
margin: EdgeInsets.symmetric( |
|
|
margin: EdgeInsets.symmetric( |
|
|
vertical: 2.w), |
|
|
vertical: 2.w), |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: isDarkMode |
|
|
color: primaryColor, |
|
|
? Colors.grey[800] |
|
|
|
|
|
: Colors.grey[200], |
|
|
|
|
|
borderRadius: |
|
|
borderRadius: |
|
|
BorderRadius.circular(22.w), |
|
|
BorderRadius.circular(22.w), |
|
|
), |
|
|
), |
|
|
child: Icon( |
|
|
child: Icon( |
|
|
isExpanded |
|
|
Icons.send, |
|
|
? Icons.close |
|
|
color: Colors.white, |
|
|
: Icons.add, |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.grey[300] |
|
|
|
|
|
: Colors.grey[700], |
|
|
|
|
|
size: 22.sp, |
|
|
size: 22.sp, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
); |
|
|
), |
|
|
}); |
|
|
], |
|
|
} |
|
|
); |
|
|
}, |
|
|
} else { |
|
|
), |
|
|
// 显示'+'选择按钮 |
|
|
); |
|
|
return Obx(() { |
|
|
}), |
|
|
final isExpanded = controller |
|
|
|
|
|
.isPlusOptionsExpanded.value; |
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
controller.togglePlusOptions(); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
width: 44.w, |
|
|
|
|
|
height: 44.w, |
|
|
|
|
|
margin: EdgeInsets.symmetric( |
|
|
|
|
|
vertical: 2.w), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.grey[800] |
|
|
|
|
|
: Colors.grey[200], |
|
|
|
|
|
borderRadius: |
|
|
|
|
|
BorderRadius.circular(22.w), |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
isExpanded |
|
|
|
|
|
? Icons.close |
|
|
|
|
|
: Icons.add, |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.grey[300] |
|
|
|
|
|
: Colors.grey[700], |
|
|
|
|
|
size: 22.sp, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
|