mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 06:24:20 +01:00
Deselect text field after user goes into continuous mode
This commit is contained in:
@@ -20,6 +20,7 @@ class ChatInputField extends StatefulWidget {
|
|||||||
class _ChatInputFieldState extends State<ChatInputField> {
|
class _ChatInputFieldState extends State<ChatInputField> {
|
||||||
// Controller for the TextField to manage its content
|
// Controller for the TextField to manage its content
|
||||||
final TextEditingController _controller = TextEditingController();
|
final TextEditingController _controller = TextEditingController();
|
||||||
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -53,10 +54,10 @@ class _ChatInputFieldState extends State<ChatInputField> {
|
|||||||
// when the content exceeds its maximum height
|
// when the content exceeds its maximum height
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
reverse: true,
|
reverse: true,
|
||||||
// TODO: Deselect text field after user goes into continous mode
|
|
||||||
// TODO: Include tool tip to explain clicking text field will end continuous mode
|
// TODO: Include tool tip to explain clicking text field will end continuous mode
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
|
focusNode: _focusNode,
|
||||||
// Allowing the TextField to expand vertically and accommodate multiple lines
|
// Allowing the TextField to expand vertically and accommodate multiple lines
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -86,6 +87,7 @@ class _ChatInputFieldState extends State<ChatInputField> {
|
|||||||
if (!widget.isContinuousMode) {
|
if (!widget.isContinuousMode) {
|
||||||
widget.onSendPressed(_controller.text);
|
widget.onSendPressed(_controller.text);
|
||||||
_controller.clear();
|
_controller.clear();
|
||||||
|
_focusNode.unfocus();
|
||||||
}
|
}
|
||||||
widget.onContinuousModePressed();
|
widget.onContinuousModePressed();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user