fix(home): 修复按住说话功能,移除旧麦克风逻辑
This commit is contained in:
@@ -792,10 +792,6 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
borderRadius: BorderRadius.circular(_inputRadius),
|
||||
border: Border.all(color: AppColors.slate300),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _isRecording
|
||||
? _buildListeningIndicator()
|
||||
: _isTranscribing
|
||||
@@ -818,28 +814,21 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
),
|
||||
onSubmitted: (_) => _sendMessage(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildInputActionIcon(state),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInputActionIcon(ChatState state) {
|
||||
Widget _buildRightActionButton(ChatState state) {
|
||||
final isWaitingAgent =
|
||||
state.isWaitingFirstToken || state.isStreaming || state.isCancelling;
|
||||
return GestureDetector(
|
||||
key: _inputActionButtonKey,
|
||||
onTap: _isTranscribing
|
||||
? null
|
||||
: _isRecording
|
||||
? () => _stopRecording(autoSendAfterTranscribe: true)
|
||||
: isWaitingAgent
|
||||
? () => _onStopGenerating(context)
|
||||
: _hasMessage
|
||||
? () => _sendMessage(context)
|
||||
: _startRecording,
|
||||
: _toggleHoldToSpeakMode,
|
||||
child: _isTranscribing
|
||||
? const SizedBox(
|
||||
width: _transcribingSpinnerSize,
|
||||
@@ -853,43 +842,19 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
key: _inputActionIconKey,
|
||||
isWaitingAgent
|
||||
? LucideIcons.square
|
||||
: _isRecording || _hasMessage
|
||||
: _hasMessage
|
||||
? LucideIcons.send
|
||||
: LucideIcons.mic,
|
||||
: _isHoldToSpeakMode
|
||||
? LucideIcons.keyboard
|
||||
: LucideIcons.activity,
|
||||
size: _iconSize,
|
||||
color: isWaitingAgent || _isRecording || _hasMessage
|
||||
color: isWaitingAgent || _hasMessage
|
||||
? AppColors.blue600
|
||||
: AppColors.slate500,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRightActionButton(ChatState state) {
|
||||
return GestureDetector(
|
||||
key: _inputActionButtonKey,
|
||||
onTap: _isTranscribing
|
||||
? null
|
||||
: _isHoldToSpeakMode
|
||||
? _toggleHoldToSpeakMode
|
||||
: _startRecording,
|
||||
child: _isTranscribing
|
||||
? const SizedBox(
|
||||
width: _transcribingSpinnerSize,
|
||||
height: _transcribingSpinnerSize,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: _transcribingStrokeWidth,
|
||||
color: AppColors.blue600,
|
||||
),
|
||||
)
|
||||
: Icon(
|
||||
key: _inputActionIconKey,
|
||||
_isHoldToSpeakMode ? LucideIcons.keyboard : LucideIcons.activity,
|
||||
size: _iconSize,
|
||||
color: AppColors.slate500,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHoldToSpeakHint() {
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user