FloatingActionButton onpressed()在颤动中不起作用

时间:2019-08-29 07:08:55

标签: android ios flutter

当我单击晶圆厂时,什么都没有发生 这是我的代码,也许你们中的一个可以帮助:)

void initSpeechRecognizer(){
    _speechRecognition = SpeechRecognition
FloatingActionButton(
                    child: Icon(Icons.mic),
                    onPressed: (){
                      if(_isAvailable && !_isListening) _speechRecognition.listen(locale: "id_ID").then((result) => print('result : $result'));
                    },
                     heroTag: "mic",
                  ),

1 个答案:

答案 0 :(得分:2)

你可以试试吗?

void initSpeechRecognizer(){
    _speechRecognition = SpeechRecognition
FloatingActionButton(
                    child: Icon(Icons.mic),
                    onPressed: () async {
                      if(_isAvailable && !_isListening){
                          var result = await _speechRecognition.listen(locale: "id_ID");
                          print('result : $result');
                      }
                    },
                     heroTag: "mic",
                  ),