1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 04:48:51 +00:00

Limit new messages length

This commit is contained in:
Pierre HUBERT 2019-04-27 10:13:29 +02:00
parent 0e8803c6a0
commit 91b5d55a83

View File

@ -244,14 +244,29 @@ class _ConversationScreenState extends State<ConversationScreen> {
// Message area
new Flexible(
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,
controller: _textEditingController,
onChanged: _updatedText,
onSubmitted: _isMessageValid
? (s) => _submitTextMessage(context, s)
: null,
decoration:
new InputDecoration.collapsed(hintText: tr("Send a message")),
decoration: new InputDecoration.collapsed(
hintText: tr("Send a message"),
),
),
),