End continuous mode when clicking text field
parent
2e62c517e2
commit
27e9868aa5
|
@ -22,6 +22,22 @@ class _ChatInputFieldState extends State<ChatInputField> {
|
|||
final TextEditingController _controller = TextEditingController();
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
// 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
|
||||
child: SingleChildScrollView(
|
||||
reverse: true,
|
||||
// TODO: Include tool tip to explain clicking text field will end continuous mode
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
focusNode: _focusNode,
|
||||
|
|
Loading…
Reference in New Issue