@@ -48,6 +48,9 @@ class _MessageInputState extends State<MessageInput> {
4848 Widget build (BuildContext context) {
4949 var showReply = false ;
5050 var showEdit = false ;
51+ var currentChat = context.read <SendMessageBloc >().currentConversation;
52+ var blockSending = currentChat.type == 'u' && currentChat.opponent == null ;
53+
5154 if (widget.sharedMessage? .type == SharedMediaType .text ||
5255 widget.sharedMessage? .type == SharedMediaType .url) {
5356 BlocProvider .of <SendMessageBloc >(context)
@@ -138,20 +141,23 @@ class _MessageInputState extends State<MessageInput> {
138141 IconButton (
139142 icon: const Icon (Icons .attach_file_outlined),
140143 color: dullGray,
141- onPressed: () {
142- connectionChecker (context, () => showMedia ());
143- },
144+ onPressed: blockSending
145+ ? null
146+ : () => { connectionChecker (context, () => showMedia ()) },
144147 ),
145148 Flexible (
146149 child: TextField (
147150 focusNode: showFocusNode,
151+ enabled: ! blockSending,
148152 keyboardType: TextInputType .multiline,
149153 maxLines: null ,
150154 style: const TextStyle (fontSize: 15.0 ),
151155 controller: textEditingController,
152- decoration: const InputDecoration .collapsed (
153- hintText: 'Type your message...' ,
154- hintStyle: TextStyle (color: dullGray),
156+ decoration: InputDecoration .collapsed (
157+ hintText: blockSending
158+ ? 'Can\' t send message'
159+ : 'Type your message...' ,
160+ hintStyle: const TextStyle (color: dullGray),
155161 ),
156162 onChanged: (text) {
157163 BlocProvider .of <SendMessageBloc >(rootContext)
0 commit comments