mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
End continuous mode when clicking text field
This commit is contained in:
@@ -22,6 +22,22 @@ class _ChatInputFieldState extends State<ChatInputField> {
|
|||||||
final TextEditingController _controller = TextEditingController();
|
final TextEditingController _controller = TextEditingController();
|
||||||
final FocusNode _focusNode = FocusNode();
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_focusNode.addListener(() {
|
||||||
|
if (_focusNode.hasFocus && widget.isContinuousMode) {
|
||||||
|
widget.onContinuousModePressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_focusNode.dispose(); // Dispose of the FocusNode when you're done.
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Using LayoutBuilder to provide the current constraints of the widget,
|
// Using LayoutBuilder to provide the current constraints of the widget,
|
||||||
@@ -54,7 +70,6 @@ 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: Include tool tip to explain clicking text field will end continuous mode
|
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
|
|||||||
Reference in New Issue
Block a user