fixes
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
|
|
||||||
|
/// A Controller for storing and handling the [Message]
|
||||||
class MessageInputController extends ValueNotifier<Message> {
|
class MessageInputController extends ValueNotifier<Message> {
|
||||||
/// Creates a controller for an editable text field.
|
/// Creates a controller for an editable text field.
|
||||||
///
|
///
|
||||||
@@ -17,7 +17,7 @@ class MessageInputController extends ValueNotifier<Message> {
|
|||||||
factory MessageInputController.fromText(String? text) =>
|
factory MessageInputController.fromText(String? text) =>
|
||||||
MessageInputController._(Message(text: 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(
|
factory MessageInputController.fromAttachments(
|
||||||
List<Attachment> attachments,
|
List<Attachment> attachments,
|
||||||
) =>
|
) =>
|
||||||
@@ -55,23 +55,17 @@ class MessageInputController extends ValueNotifier<Message> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
get baseOffset {
|
int get baseOffset => textEditingController.selection.baseOffset;
|
||||||
return textEditingController.selection.baseOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
get selectionStart {
|
int get selectionStart => textEditingController.selection.start;
|
||||||
return textEditingController.selection.start;
|
|
||||||
}
|
|
||||||
|
|
||||||
set showInChannel(bool newValue) {
|
set showInChannel(bool newValue) {
|
||||||
value = value.copyWith(showInChannel: newValue);
|
value = value.copyWith(showInChannel: newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
bool get showInChannel {
|
bool get showInChannel => value.showInChannel ?? false;
|
||||||
return value.showInChannel ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
List<Attachment> get attachments => value.attachments;
|
List<Attachment> get attachments => value.attachments;
|
||||||
@@ -142,7 +136,7 @@ class MessageInputController extends ValueNotifier<Message> {
|
|||||||
/// After calling this function, [text], [attachments] and [mentionedUsers]
|
/// After calling this function, [text], [attachments] and [mentionedUsers]
|
||||||
/// all will be empty.
|
/// 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,
|
/// 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
|
/// this method should only be called between frames, e.g. in response to user
|
||||||
/// actions, not during the build, layout, or paint phases.
|
/// actions, not during the build, layout, or paint phases.
|
||||||
|
|||||||
Reference in New Issue
Block a user