From 3d622b8918e3b754ec9c1a4f210a58e907712858 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sat, 23 Dec 2023 09:17:31 +0100 Subject: [PATCH] fix: Cannot change send on enter on desktop --- lib/config/app_config.dart | 2 +- lib/pages/chat/chat_input_row.dart | 4 +++- lib/pages/chat/input_bar.dart | 4 +--- lib/pages/settings_chat/settings_chat_view.dart | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index 296c8e90..75072c8e 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -47,7 +47,7 @@ abstract class AppConfig { static bool separateChatTypes = false; static bool autoplayImages = true; static bool sendTypingNotifications = true; - static bool sendOnEnter = false; + static bool? sendOnEnter; static bool experimentalVoip = false; static const bool hideTypingUsernames = false; static const bool hideAllStateEvents = false; diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 8e0f5982..d72e4cf3 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -251,7 +251,9 @@ class ChatInputRow extends StatelessWidget { autofocus: !PlatformInfos.isMobile, keyboardType: TextInputType.multiline, textInputAction: - AppConfig.sendOnEnter ? TextInputAction.send : null, + AppConfig.sendOnEnter ?? !PlatformInfos.isMobile + ? TextInputAction.send + : null, onSubmitted: controller.onInputBarSubmitted, onSubmitImage: controller.sendImageFromClipBoard, focusNode: controller.inputFocus, diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index c179227a..7f1936de 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -394,9 +394,7 @@ class InputBar extends StatelessWidget { @override Widget build(BuildContext context) { - final useShortCuts = (PlatformInfos.isWeb || - PlatformInfos.isDesktop || - AppConfig.sendOnEnter); + final useShortCuts = (AppConfig.sendOnEnter ?? !PlatformInfos.isMobile); return Shortcuts( shortcuts: !useShortCuts ? {} diff --git a/lib/pages/settings_chat/settings_chat_view.dart b/lib/pages/settings_chat/settings_chat_view.dart index 1d0f6686..9ba61eb8 100644 --- a/lib/pages/settings_chat/settings_chat_view.dart +++ b/lib/pages/settings_chat/settings_chat_view.dart @@ -74,7 +74,7 @@ class SettingsChatView extends StatelessWidget { title: L10n.of(context)!.sendOnEnter, onChanged: (b) => AppConfig.sendOnEnter = b, storeKey: SettingKeys.sendOnEnter, - defaultValue: AppConfig.sendOnEnter, + defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile, ), SettingsSwitchListTile.adaptive( title: L10n.of(context)!.experimentalVideoCalls,