This commit is contained in:
Deven Joshi
2021-10-28 18:25:32 +05:30
parent 8e7e6c9542
commit 79aa6aa979
@@ -1,10 +1,10 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:stream_chat/stream_chat.dart';
/// A Controller for storing and handling the [Message]
class MessageInputController extends ValueNotifier<Message> {
/// Creates a controller for an editable text field.
///
@@ -17,7 +17,7 @@ class MessageInputController extends ValueNotifier<Message> {
factory MessageInputController.fromText(String? text) =>
MessageInputController._(Message(text: text));
/// Creates a controller for an editable text field from an initial [attachments].
/// Creates a controller for an editable textfield from initial [attachments].
factory MessageInputController.fromAttachments(
List<Attachment> attachments,
) =>
@@ -55,23 +55,17 @@ class MessageInputController extends ValueNotifier<Message> {
}
///
get baseOffset {
return textEditingController.selection.baseOffset;
}
int get baseOffset => textEditingController.selection.baseOffset;
///
get selectionStart {
return textEditingController.selection.start;
}
int get selectionStart => textEditingController.selection.start;
set showInChannel(bool newValue) {
value = value.copyWith(showInChannel: newValue);
}
///
bool get showInChannel {
return value.showInChannel ?? false;
}
bool get showInChannel => value.showInChannel ?? false;
///
List<Attachment> get attachments => value.attachments;
@@ -142,7 +136,7 @@ class MessageInputController extends ValueNotifier<Message> {
/// After calling this function, [text], [attachments] and [mentionedUsers]
/// all will be empty.
///
/// Calling this will notify all the listeners of this [MessageInputController]
/// Calling this will notify the listeners of this [MessageInputController]
/// that they need to update (it calls [notifyListeners]). For this reason,
/// this method should only be called between frames, e.g. in response to user
/// actions, not during the build, layout, or paint phases.