feat: Send on enter

This commit is contained in:
Christian Pauly 2021-08-24 20:43:21 +02:00
parent 7ffd895ee1
commit 54aacc1c35
6 changed files with 18 additions and 1 deletions

View File

@ -174,6 +174,7 @@
"supportedVersions": {}
}
},
"sendOnEnter": "Send on enter",
"badServerVersionsException": "The homeserver supports the Spec versions:\n{serverVersions}\nBut this app supports only {supportedVersions}",
"@badServerVersionsException": {
"type": "text",

View File

@ -30,6 +30,7 @@ abstract class AppConfig {
static bool hideRedactedEvents = false;
static bool hideUnknownEvents = true;
static bool autoplayImages = true;
static bool sendOnEnter = false;
static const bool hideTypingUsernames = false;
static const bool hideAllStateEvents = false;
static const String inviteLinkPrefix = 'https://matrix.to/#/';

View File

@ -21,4 +21,5 @@ abstract class SettingKeys {
static const String dontAskForBootstrapKey =
'chat.fluffychat.dont_ask_bootstrap';
static const String autoplayImages = 'chat.fluffy.autoplay_images';
static const String sendOnEnter = 'chat.fluffy.send_on_enter';
}

View File

@ -1,6 +1,7 @@
import 'dart:ui';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/pages/chat.dart';
import 'package:fluffychat/widgets/avatar.dart';
@ -697,7 +698,9 @@ class ChatView extends StatelessWidget {
minLines: 1,
maxLines: 8,
autofocus: !PlatformInfos.isMobile,
keyboardType: TextInputType.multiline,
keyboardType: AppConfig.sendOnEnter
? null
: TextInputType.multiline,
onSubmitted:
controller.onInputBarSubmitted,
focusNode: controller.inputFocus,

View File

@ -1,5 +1,6 @@
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'package:fluffychat/widgets/settings_switch_list_tile.dart';
import 'package:flutter/material.dart';
@ -55,6 +56,13 @@ class SettingsChatView extends StatelessWidget {
storeKey: SettingKeys.autoplayImages,
defaultValue: AppConfig.autoplayImages,
),
if (PlatformInfos.isMobile)
SettingsSwitchListTile(
title: L10n.of(context).sendOnEnter,
onChanged: (b) => AppConfig.sendOnEnter = b,
storeKey: SettingKeys.sendOnEnter,
defaultValue: AppConfig.sendOnEnter,
),
],
),
),

View File

@ -419,6 +419,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
store
.getItemBool(SettingKeys.autoplayImages, AppConfig.autoplayImages)
.then((value) => AppConfig.autoplayImages = value);
store
.getItemBool(SettingKeys.sendOnEnter, AppConfig.sendOnEnter)
.then((value) => AppConfig.sendOnEnter = value);
}
}