我正在通过Flutter和DialogFlow创建一个聊天机器人。现在我想在聊天屏幕上添加一些建议按钮,就在说“你好”之后,就像这样:建议按钮示例
我是一个Flutter新手,所以我需要一些想法来创建这些按钮。你有什么想法吗?非常感谢
bfnvny8b1#
试试这个解决方案!System. out. println();if(result.intent.displayName == 'YOUR_INTENT_NAME'){ return Column(children:[ Text(result.fulfillmentText),SizedBox(height:10)、缠绕(间距:8.0,运行间距:4.0,儿童:List.generate(result.fulfillmentMessages[0].suggestions.suggestions.length,(index)=〉SuggestionChip(label:Text(result.fulfillmentMessages[0].suggestions.suggestions[index]),onPressed:()=〉_handleSuggestionTap(result.fulfillmentMessages[0].suggestions.suggestions[index]),),),),],);}
1条答案
按热度按时间bfnvny8b1#
试试这个解决方案!
System. out. println();if(result.intent.displayName == 'YOUR_INTENT_NAME'){ return Column(children:[ Text(result.fulfillmentText),SizedBox(height:10)、缠绕(间距:8.0,运行间距:4.0,儿童:List.generate(result.fulfillmentMessages[0].suggestions.suggestions.length,(index)=〉SuggestionChip(label:Text(result.fulfillmentMessages[0].suggestions.suggestions[index]),onPressed:()=〉_handleSuggestionTap(result.fulfillmentMessages[0].suggestions.suggestions[index]),),),),],);}