AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Refactor ChatInputField to Use Callback for Sending Messages
hunteraraujo5d865a36d939
diff --git a/lib/views/chat/chat_input_field.dart b/lib/views/chat/chat_input_field.dartindex 9082cbb4d2..560e9069fe 100644--- a/lib/views/chat/chat_input_field.dart+++ b/lib/views/chat/chat_input_field.dart@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';class ChatInputField extends StatefulWidget {// Callback to be triggered when the send button is pressed- final VoidCallback onSendPressed;+ final Function(String) onSendPressed;const ChatInputField({Key? key,@@ -59,7 +59,13 @@ class _ChatInputFieldState extends State<ChatInputField> {suffixIcon: IconButton(splashRadius: 0.1,icon: const Icon(Icons.send),- onPressed: widget.onSendPressed,+ onPressed: () {+ // TODO: We allow empty messages?+ if (_controller.text.isNotEmpty) {+ widget.onSendPressed(_controller.text);+ _controller.clear();+ }+ },),),),