I want the speech to text function to start when one microphone icon is pressed and the noise meter function to start at the same time.
Currently, the icon for speech to text and the icon for noise meter are separated. Is there any way to combine these into one icon?
- noise_meter
IconButton(
onPressed: () {
setState(() {
_isRecording = !_isRecording;
if (_isRecording) {
NoiseMeterHelper().start(
onData: onData,
onError: onError,
);
} else {
NoiseMeterHelper().stop();
}
});
},
icon: _isRecording ? Icon(Icons.mic) : Icon(Icons.mic),
),
- speech_to_text
IconButton(
onPressed: recognizing ? stopRecording : streamingRecognize,
icon: recognizing
? Icon(Icons.mic, color: Colors.red, size: 30)
: Icon(Icons.mic, color: Colors.blue,size: 30)
),