mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Limit new messages length
This commit is contained in:
		@@ -244,14 +244,29 @@ class _ConversationScreenState extends State<ConversationScreen> {
 | 
				
			|||||||
          // Message area
 | 
					          // Message area
 | 
				
			||||||
          new Flexible(
 | 
					          new Flexible(
 | 
				
			||||||
            child: new TextField(
 | 
					            child: new TextField(
 | 
				
			||||||
 | 
					              maxLines: null,
 | 
				
			||||||
 | 
					              maxLength: 200,
 | 
				
			||||||
 | 
					              maxLengthEnforced: true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					              // Show max length only when there is some text already typed
 | 
				
			||||||
 | 
					              buildCounter: (
 | 
				
			||||||
 | 
					                BuildContext context, {
 | 
				
			||||||
 | 
					                @required int currentLength,
 | 
				
			||||||
 | 
					                @required int maxLength,
 | 
				
			||||||
 | 
					                @required bool isFocused,
 | 
				
			||||||
 | 
					              }) =>
 | 
				
			||||||
 | 
					                  currentLength > 0
 | 
				
			||||||
 | 
					                      ? Text("$currentLength/$maxLength")
 | 
				
			||||||
 | 
					                      : Container(),
 | 
				
			||||||
              enabled: !_isSendingMessage,
 | 
					              enabled: !_isSendingMessage,
 | 
				
			||||||
              controller: _textEditingController,
 | 
					              controller: _textEditingController,
 | 
				
			||||||
              onChanged: _updatedText,
 | 
					              onChanged: _updatedText,
 | 
				
			||||||
              onSubmitted: _isMessageValid
 | 
					              onSubmitted: _isMessageValid
 | 
				
			||||||
                  ? (s) => _submitTextMessage(context, s)
 | 
					                  ? (s) => _submitTextMessage(context, s)
 | 
				
			||||||
                  : null,
 | 
					                  : null,
 | 
				
			||||||
              decoration:
 | 
					              decoration: new InputDecoration.collapsed(
 | 
				
			||||||
                  new InputDecoration.collapsed(hintText: tr("Send a message")),
 | 
					                hintText: tr("Send a message"),
 | 
				
			||||||
 | 
					              ),
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user