WelcomeFieldController constructor
WelcomeFieldController( - ChatService _chatService, {
- void onSubmit()?,
})
Implementation
WelcomeFieldController(this._chatService, {this.onSubmit}) {
field = TextFieldState(
submitted: false,
onSubmitted: (s) {
field.unsubmit();
onSubmit?.call();
},
focus: FocusNode(
onKeyEvent:
(_, KeyEvent e) => MessageFieldController.handleNewLines(e, field),
),
);
_editedWorker ??= ever(edited, (item) {
if (item != null) {
field.text = item.text?.val ?? '';
attachments.value =
item.attachments.map((e) => MapEntry(GlobalKey(), e)).toList();
} else {
field.text = '';
attachments.clear();
}
});
}