From cc7b672cbcbc4552eeabb0f92f76656c201458ad Mon Sep 17 00:00:00 2001 From: BluewhaleYF Date: Sun, 26 Jul 2026 20:57:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=90=A7=20Use=20native=20title=20bar?= =?UTF-8?q?=20on=20Linux=20for=20flexible=20window=20resizing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes Solsynth#384 --- lib/main.dart | 6 +++--- lib/shared/widgets/app_scaffold.dart | 4 +++- packages/island_ui_foundation/lib/src/window_frame.dart | 7 ++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 94e715794..b60e89bf3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -288,14 +288,14 @@ void main(List args) async { center: true, backgroundColor: Colors.transparent, skipTaskbar: false, - titleBarStyle: TitleBarStyle.hidden, + titleBarStyle: Platform.isLinux ? TitleBarStyle.normal : TitleBarStyle.hidden, windowButtonVisibility: true, ); windowManager.waitUntilReadyToShow(windowOptions, () async { final env = Platform.environment; final isWayland = env.containsKey('WAYLAND_DISPLAY'); - if (isWayland) { + if (isWayland && !Platform.isLinux) { try { await windowManager.setAsFrameless(); } catch (e) { @@ -309,7 +309,7 @@ void main(List args) async { await windowManager.setOpacity(opacity); Logger.root.info( "[SplashScreen] Desktop window is ready with size: ${initialSize.width}x${initialSize.height}" - "${isWayland ? " (Wayland frameless fix applied)" : ""}", + "${isWayland && !Platform.isLinux ? " (Wayland frameless fix applied)" : ""}", ); }); } diff --git a/lib/shared/widgets/app_scaffold.dart b/lib/shared/widgets/app_scaffold.dart index eca0a2876..349a6d93c 100644 --- a/lib/shared/widgets/app_scaffold.dart +++ b/lib/shared/widgets/app_scaffold.dart @@ -39,6 +39,7 @@ class WindowScaffold extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final showPalette = useState(false); final isDesktop = DesktopWindowFrame.isPlatformDesktop; + final useCustomTitleBar = isDesktop && !Platform.isLinux; final shakeEnabled = ref.watch(shakeDetectionEnabledProvider); useEffect(() { @@ -104,7 +105,8 @@ class WindowScaffold extends HookConsumerWidget { }, child: DesktopWindowFrame( isDesktopPlatform: isDesktop, - title: isDesktop + showTitleBar: useCustomTitleBar, + title: useCustomTitleBar ? Platform.isMacOS ? Text( 'Solar Network', diff --git a/packages/island_ui_foundation/lib/src/window_frame.dart b/packages/island_ui_foundation/lib/src/window_frame.dart index fe07b7068..b911f9672 100644 --- a/packages/island_ui_foundation/lib/src/window_frame.dart +++ b/packages/island_ui_foundation/lib/src/window_frame.dart @@ -19,6 +19,7 @@ class DesktopWindowFrame extends HookWidget { additionalTitleBarActions; final VoidCallback? onClose; final bool isDesktopPlatform; + final bool showTitleBar; const DesktopWindowFrame({ super.key, @@ -28,6 +29,7 @@ class DesktopWindowFrame extends HookWidget { this.additionalTitleBarActions, this.onClose, this.isDesktopPlatform = false, + this.showTitleBar = true, }); static bool get isPlatformDesktop => @@ -63,7 +65,10 @@ class DesktopWindowFrame extends HookWidget { children: [ Column( children: [ - DragToMoveArea(child: _buildTitleBar(context, isMaximized)), + if (showTitleBar) + DragToMoveArea( + child: _buildTitleBar(context, isMaximized), + ), Expanded(child: child), ], ), From 80c565f5573c59bfe803756e9090f83d7e64efaf Mon Sep 17 00:00:00 2001 From: BluewhaleYF Date: Sun, 26 Jul 2026 22:12:46 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E2=9C=A8=20Add=20option=20to=20use=20nativ?= =?UTF-8?q?e=20window=20title=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/i18n/en-US.json | 2 ++ assets/i18n/es-ES.json | 2 ++ assets/i18n/ja-JP.json | 2 ++ assets/i18n/ko-KR.json | 2 ++ assets/i18n/zh-CN.json | 26 +++++++++++++----------- assets/i18n/zh-OG.json | 2 ++ assets/i18n/zh-TW.json | 2 ++ lib/core/config.dart | 25 +++++++++++++++++++++++ lib/main.dart | 13 ++++++++---- lib/misc/settings.dart | 22 ++++++++++++++++++++ lib/shared/widgets/app_scaffold.dart | 30 +++++++++++++++++++++++++++- 11 files changed, 111 insertions(+), 17 deletions(-) diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index 93fff2909..ec7c10304 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -3426,6 +3426,8 @@ "settingsUnknownRoom": "Unknown Room", "settingsUpdate": "Update", "settingsWindowOpacity": "Window Opacity", + "settingsLinuxNativeTitleBar": "Use Native Title Bar", + "settingsLinuxNativeTitleBarDescription": "Use the Linux system title bar. If you experience issues resizing the window, try enabling this option.", "share": "Share", "shareCheckInSlogan": "See your today fortune on the Solar Network.", "shareCodeWithRecipient": "Share this code with the recipient to redeem the gift.", diff --git a/assets/i18n/es-ES.json b/assets/i18n/es-ES.json index 0c719e913..f37bff7bd 100644 --- a/assets/i18n/es-ES.json +++ b/assets/i18n/es-ES.json @@ -1725,6 +1725,8 @@ "settingsTtsVolume": "Volumen", "settingsUnknownRoom": "Unknown Room", "settingsWindowOpacity": "Window Opacity", + "settingsLinuxNativeTitleBar": "Usar barra de título nativa", + "settingsLinuxNativeTitleBarDescription": "Usa la barra de título del sistema en lugar de la barra de título personalizada de escritorio de Solian.", "share": "Share", "shareCodeWithRecipient": "Share this code with the recipient to redeem the gift.", "sharePost": "Share Post", diff --git a/assets/i18n/ja-JP.json b/assets/i18n/ja-JP.json index 8046d641e..d771c1e7e 100644 --- a/assets/i18n/ja-JP.json +++ b/assets/i18n/ja-JP.json @@ -1812,6 +1812,8 @@ "settingsTtsVolume": "音量", "settingsUnknownRoom": "Unknown Room", "settingsWindowOpacity": "ウィンドウの不透明度", + "settingsLinuxNativeTitleBar": "ネイティブタイトルバーを使う", + "settingsLinuxNativeTitleBarDescription": "Solian のカスタムデスクトップタイトルバーではなく、システムのウィンドウタイトルバーを使います。", "share": "共有", "shareCodeWithRecipient": "このコードを受取人と共有してギフトを引き換えてください。", "sharePost": "投稿を共有", diff --git a/assets/i18n/ko-KR.json b/assets/i18n/ko-KR.json index 80db2f30a..983bf4e37 100644 --- a/assets/i18n/ko-KR.json +++ b/assets/i18n/ko-KR.json @@ -2044,6 +2044,8 @@ "settingsTtsVolume": "음량", "settingsUnknownRoom": "Unknown Room", "settingsWindowOpacity": "창 투명도", + "settingsLinuxNativeTitleBar": "기본 제목 표시줄 사용", + "settingsLinuxNativeTitleBarDescription": "Solian의 사용자 지정 데스크톱 제목 표시줄 대신 시스템 창 제목 표시줄을 사용합니다.", "share": "공유", "shareCodeWithRecipient": "이 코드를 받는 사람과 공유하여 선물을 받을 수 있도록 하세요.", "sharePost": "게시물 공유", diff --git a/assets/i18n/zh-CN.json b/assets/i18n/zh-CN.json index 0138450d6..8f7879474 100644 --- a/assets/i18n/zh-CN.json +++ b/assets/i18n/zh-CN.json @@ -2469,8 +2469,8 @@ "personalWalletHint": "此钱包将是您的个人钱包。", "phaseComplete": "完成", "phaseDownload": "下载测试", - "phaseHttpPing": "HTTP Ping", - "phaseTcpPing": "TCP Ping", + "phaseHttpPing": "HTTP 延迟测试", + "phaseTcpPing": "TCP 延迟测试", "physicalPassport": "实体通行证", "physicalPassportActive": "已激活", "physicalPassportActiveDescription": "启用或禁用通行证功能", @@ -3228,8 +3228,8 @@ "settingsChatEventMessageModeImportant": "仅重要", "settingsChatEventMessageModeNone": "不显示", "settingsChatEventMessageModeVerbose": "全部显示", - "settingsChatRoomStorage": "Chat Room Storage", - "settingsChatRoomStorageHelper": "View stored messages per chat room", + "settingsChatRoomStorage": "聊天室存储", + "settingsChatRoomStorageHelper": "查看每个聊天室已存储的消息", "settingsCheckForUpdates": "检查更新", "settingsCheckForUpdatesHelper": "从 GitHub 检查最新版本", "settingsCheckForUpdatesSection": "检查更新", @@ -3239,8 +3239,8 @@ "settingsCleanPreviousUpdatesNone": "未找到历史更新缓存", "settingsClearCache": "清除缓存", "settingsClearCacheConfirm": "您确定要清除缓存吗?此操作将删除所有缓存的图片和临时文件。", - "settingsClearChatHistory": "Clear Chat History", - "settingsClearChatHistoryConfirm": "Are you sure you want to clear all messages from \"{}\"? This action cannot be undone.", + "settingsClearChatHistory": "清除聊天记录", + "settingsClearChatHistoryConfirm": "你确定要清除“{}”中的所有消息吗?此操作无法撤销。", "settingsColorBackground": "背景", "settingsColorError": "错误", "settingsColorOnPrimary": "主要之上", @@ -3346,14 +3346,14 @@ "settingsManagePluginsDescription": "查看、启用或禁用已安装的插件", "settingsMediaProxy": "媒体代理", "settingsMediaProxyHelper": "媒体代理将在您的设备上运行一个本地 HTTP 服务器,以支持流式缓存,提供更好的媒体播放体验。", - "settingsMessageCount": "{} messages", + "settingsMessageCount": "{} 条消息", "settingsMessageDisplayStyle": "消息样式", "settingsMessageDisplayStyleBubble": "气泡", "settingsMessageDisplayStyleColumn": "列表", "settingsMessageDisplayStyleCompact": "紧凑", "settingsMixedFeed": "混合动态", "settingsNativeCache": "系统缓存", - "settingsNoChatMessages": "No chat messages stored", + "settingsNoChatMessages": "没有已存储的聊天消息", "settingsNotifyWithHaptic": "通知触感反馈", "settingsShakeDetection": "摇一摇打开命令面板", "settingsShakeDetectionHelper": "摇动设备以打开命令面板", @@ -3414,7 +3414,7 @@ "settingsThemeModeDark": "深色", "settingsThemeModeLight": "浅色", "settingsThemeModeSystem": "跟随系统", - "settingsTotalMessages": "Total Messages", + "settingsTotalMessages": "消息总数", "settingsTransparentAppBar": "使用完全透明的状态栏", "settingsTts": "文字转语音", "settingsTtsLanguage": "语言", @@ -3423,9 +3423,11 @@ "settingsTtsTest": "测试 TTS", "settingsTtsVoice": "语音", "settingsTtsVolume": "音量", - "settingsUnknownRoom": "Unknown Room", + "settingsUnknownRoom": "未知聊天室", "settingsUpdate": "更新", "settingsWindowOpacity": "窗口不透明度", + "settingsLinuxNativeTitleBar": "使用原生标题栏", + "settingsLinuxNativeTitleBarDescription": "使用 Linux 系统标题栏。若遇到窗口无法调整大小的问题,可尝试启用此选项。", "share": "分享", "shareCheckInSlogan": "在 Solar Network 查看今日运势。", "shareCodeWithRecipient": "与收件人分享此代码来兑换礼物。", @@ -3874,8 +3876,8 @@ "currency": "货币", "walletCurrencyGolds": "金太阳点", "walletCurrencyPoints": "数据位元", - "walletCurrencyShortGolds": "Gold", - "walletCurrencyShortPoints": "Bits", + "walletCurrencyShortGolds": "金点", + "walletCurrencyShortPoints": "数据位元", "walletDescription": "您的源点钱包。", "walletDisablePublicId": "禁用钱包 ID", "walletEnablePublicId": "启用钱包 ID", diff --git a/assets/i18n/zh-OG.json b/assets/i18n/zh-OG.json index efedb10bf..1c60b6faf 100644 --- a/assets/i18n/zh-OG.json +++ b/assets/i18n/zh-OG.json @@ -1722,6 +1722,8 @@ "settingsTtsVolume": "聲量", "settingsUnknownRoom": "Unknown Room", "settingsWindowOpacity": "窗透度", + "settingsLinuxNativeTitleBar": "用原生題欄", + "settingsLinuxNativeTitleBarDescription": "用系統窗題欄,不復用 Solian 舊自訂桌面題欄。", "share": "分享", "shareCodeWithRecipient": "與受者享此碼以兌禮", "sharePost": "分享帖文", diff --git a/assets/i18n/zh-TW.json b/assets/i18n/zh-TW.json index 1773bb144..26284a020 100644 --- a/assets/i18n/zh-TW.json +++ b/assets/i18n/zh-TW.json @@ -3249,6 +3249,8 @@ "settingsTtsVolume": "音量", "settingsUnknownRoom": "Unknown Room", "settingsWindowOpacity": "視窗不透明度", + "settingsLinuxNativeTitleBar": "使用原生標題列", + "settingsLinuxNativeTitleBarDescription": "使用系統視窗標題列,而不是 Solian 原本的自訂桌面標題列。", "share": "分享", "shareCheckInSlogan": "在 Solar Network 檢視今日運勢。", "shareCodeWithRecipient": "與收件人分享此程式碼來兌換禮物。", diff --git a/lib/core/config.dart b/lib/core/config.dart index bfa04660f..6e63307c8 100644 --- a/lib/core/config.dart +++ b/lib/core/config.dart @@ -9,6 +9,7 @@ import 'package:island/core/services/analytics_service.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:window_manager/window_manager.dart'; +import 'package:flutter_riverpod/legacy.dart'; part 'config.freezed.dart'; part 'config.g.dart'; @@ -57,6 +58,7 @@ const kAppSoundEffects = 'app_sound_effects'; const kAppFestivalFeatures = 'app_feastival_features'; const kAppWindowSize = 'app_window_size'; const kAppWindowOpacity = 'app_window_opacity'; +const kAppLinuxUseNativeTitleBar = 'app_linux_use_native_title_bar'; const kAppCardTransparent = 'app_card_transparent'; const kAppEnterToSend = 'app_enter_to_send'; const kAppDefaultPoolId = 'app_default_pool_id'; @@ -119,6 +121,29 @@ final developerModeProvider = Provider((ref) { return prefs.getBool(kAppDeveloperMode) ?? false; }); +final linuxNativeTitleBarProvider = + StateNotifierProvider((ref) { + final prefs = ref.watch(sharedPreferencesProvider); + return LinuxNativeTitleBarNotifier(prefs); + }); + +class LinuxNativeTitleBarNotifier extends StateNotifier { + LinuxNativeTitleBarNotifier(this._prefs) + : super( + !kIsWeb && Platform.isLinux + ? (_prefs.getBool(kAppLinuxUseNativeTitleBar) ?? true) + : false, + ); + + final SharedPreferences _prefs; + + Future setEnabled(bool value) async { + if (kIsWeb || !Platform.isLinux) return; + await _prefs.setBool(kAppLinuxUseNativeTitleBar, value); + state = value; + } +} + @freezed sealed class IpOverride with _$IpOverride { const factory IpOverride({required String ip, int? port}) = _IpOverride; diff --git a/lib/main.dart b/lib/main.dart index b60e89bf3..6ad0bf682 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -283,19 +283,24 @@ void main(List args) async { } } + final useLinuxNativeTitleBar = Platform.isLinux + ? (prefs.getBool(kAppLinuxUseNativeTitleBar) ?? true) + : false; WindowOptions windowOptions = WindowOptions( size: initialSize, center: true, backgroundColor: Colors.transparent, skipTaskbar: false, - titleBarStyle: Platform.isLinux ? TitleBarStyle.normal : TitleBarStyle.hidden, - windowButtonVisibility: true, + titleBarStyle: useLinuxNativeTitleBar + ? TitleBarStyle.normal + : TitleBarStyle.hidden, + windowButtonVisibility: useLinuxNativeTitleBar, ); windowManager.waitUntilReadyToShow(windowOptions, () async { final env = Platform.environment; final isWayland = env.containsKey('WAYLAND_DISPLAY'); - if (isWayland && !Platform.isLinux) { + if (isWayland && (!Platform.isLinux || !useLinuxNativeTitleBar)) { try { await windowManager.setAsFrameless(); } catch (e) { @@ -309,7 +314,7 @@ void main(List args) async { await windowManager.setOpacity(opacity); Logger.root.info( "[SplashScreen] Desktop window is ready with size: ${initialSize.width}x${initialSize.height}" - "${isWayland && !Platform.isLinux ? " (Wayland frameless fix applied)" : ""}", + "${isWayland && (!Platform.isLinux || !useLinuxNativeTitleBar) ? " (Wayland frameless fix applied)" : ""}", ); }); } diff --git a/lib/misc/settings.dart b/lib/misc/settings.dart index fdc6d48ef..082d8b6d2 100644 --- a/lib/misc/settings.dart +++ b/lib/misc/settings.dart @@ -72,6 +72,7 @@ class SettingsScreen extends HookConsumerWidget { final prefs = ref.watch(sharedPreferencesProvider); final controller = TextEditingController(text: serverUrl); final settings = ref.watch(appSettingsProvider); + final useLinuxNativeTitleBar = ref.watch(linuxNativeTitleBarProvider); final isDesktop = !kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux); final isWide = isWideScreen(context); @@ -153,6 +154,8 @@ class SettingsScreen extends HookConsumerWidget { 'settingsCustomColors', 'settingsCardBackgroundOpacity', 'settingsWindowOpacity', + 'settingsLinuxNativeTitleBar', + 'settingsLinuxNativeTitleBarDescription', 'settingsCustomFonts', 'settingsLinkCollapseMode', 'settingsTransparentAppBar', @@ -592,6 +595,25 @@ class SettingsScreen extends HookConsumerWidget { ), ), ), + if (Platform.isLinux) + ListTile( + minLeadingWidth: 48, + title: Text('settingsLinuxNativeTitleBar').tr(), + subtitle: Text('settingsLinuxNativeTitleBarDescription').tr(), + contentPadding: _kSettingsTilePadding, + leading: const Icon(Symbols.web_traffic), + trailing: Switch( + value: useLinuxNativeTitleBar, + onChanged: (value) async { + await ref + .read(linuxNativeTitleBarProvider.notifier) + .setEnabled(value); + if (context.mounted) { + showSnackBar('settingsApplied'.tr()); + } + }, + ), + ), if (isDesktop) const Divider(height: 24), ListTile( isThreeLine: true, diff --git a/lib/shared/widgets/app_scaffold.dart b/lib/shared/widgets/app_scaffold.dart index 349a6d93c..873e38971 100644 --- a/lib/shared/widgets/app_scaffold.dart +++ b/lib/shared/widgets/app_scaffold.dart @@ -39,9 +39,37 @@ class WindowScaffold extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final showPalette = useState(false); final isDesktop = DesktopWindowFrame.isPlatformDesktop; - final useCustomTitleBar = isDesktop && !Platform.isLinux; + final useLinuxNativeTitleBar = ref.watch(linuxNativeTitleBarProvider); + final useCustomTitleBar = + isDesktop && (!Platform.isLinux || !useLinuxNativeTitleBar); final shakeEnabled = ref.watch(shakeDetectionEnabledProvider); + useEffect(() { + if (kIsWeb || !isDesktop || !Platform.isLinux) return null; + + Future(() async { + if (useLinuxNativeTitleBar) { + await windowManager.setTitleBarStyle( + TitleBarStyle.normal, + windowButtonVisibility: true, + ); + } else { + await windowManager.setTitleBarStyle( + TitleBarStyle.hidden, + windowButtonVisibility: false, + ); + final env = Platform.environment; + if (env.containsKey('WAYLAND_DISPLAY')) { + try { + await windowManager.setAsFrameless(); + } catch (_) {} + } + } + }); + + return null; + }, [isDesktop, useLinuxNativeTitleBar]); + useEffect(() { if (!isDesktop) return null; From 2a19a1c9f9529a2958d58c34bf53c7029479c8d2 Mon Sep 17 00:00:00 2001 From: BluewhaleYF Date: Sun, 26 Jul 2026 22:15:55 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=8C=90=20Fix=20zh-CN=20Plugin=20Marke?= =?UTF-8?q?tplace=20i18n=20translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/i18n/zh-CN.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/i18n/zh-CN.json b/assets/i18n/zh-CN.json index 8f7879474..4adba7139 100644 --- a/assets/i18n/zh-CN.json +++ b/assets/i18n/zh-CN.json @@ -1940,7 +1940,7 @@ "contentWarning": "内容提示", "tapToReveal": "点击显示", "markComplete": "标记为完成", - "marketplace": "贴图市场", + "marketplace": "市场", "matches": { "zero": "无匹配项", "one": "{} 个匹配", @@ -4051,7 +4051,7 @@ "languagePT": "葡萄牙语", "plugins": "插件", "pluginsEmptyTitle": "暂无已安装的插件", - "pluginsEmptyHint": "使用编辑器创建、从文件夹安装,或浏览市场", + "pluginsEmptyHint": "使用编辑器创建、从文件夹安装,或浏览插件市场", "newPlugin": "新建插件", "fromFolder": "从文件夹导入", "pluginsCount": { From 660e18a1b9de9711e40b4019ba2758cf9cf0ff4e Mon Sep 17 00:00:00 2001 From: BluewhaleYF Date: Mon, 27 Jul 2026 20:27:42 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Address=20PR=20review?= =?UTF-8?q?=20feedback=20-=20Merge=20the=20native=20title=20bar=20setting?= =?UTF-8?q?=20into=20the=20app=20settings=20provider=20-=20Replace=20manua?= =?UTF-8?q?l=20provider=20implementation=20with=20@riverpod=20generator=20?= =?UTF-8?q?-=20Rename=20the=20localization=20key=20consistently=20-=20Expa?= =?UTF-8?q?nd=20platform=20checks=20for=20desktop=20support=20-=20Guard=20?= =?UTF-8?q?platform-specific=20APIs=20on=20web=20using=20!kIsWeb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/i18n/en-US.json | 4 +-- assets/i18n/zh-CN.json | 4 +-- lib/chat/messages_notifier.g.dart | 2 +- lib/core/config.dart | 39 ++++++++++--------------- lib/core/config.freezed.dart | 43 +++++++++++++++------------- lib/core/config.g.dart | 2 +- lib/main.dart | 15 ++++++---- lib/misc/settings.dart | 24 +++++++++------- lib/shared/widgets/app_scaffold.dart | 15 ++++++---- 9 files changed, 76 insertions(+), 72 deletions(-) diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index ec7c10304..07aacd8ad 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -3426,8 +3426,8 @@ "settingsUnknownRoom": "Unknown Room", "settingsUpdate": "Update", "settingsWindowOpacity": "Window Opacity", - "settingsLinuxNativeTitleBar": "Use Native Title Bar", - "settingsLinuxNativeTitleBarDescription": "Use the Linux system title bar. If you experience issues resizing the window, try enabling this option.", + "settingsDesktopNativeTitleBar": "Use Native Title Bar", + "settingsDesktopNativeTitleBarDescription": "Use the Linux system title bar. If you experience issues resizing the window, try enabling this option.", "share": "Share", "shareCheckInSlogan": "See your today fortune on the Solar Network.", "shareCodeWithRecipient": "Share this code with the recipient to redeem the gift.", diff --git a/assets/i18n/zh-CN.json b/assets/i18n/zh-CN.json index 4adba7139..8fdd4af9e 100644 --- a/assets/i18n/zh-CN.json +++ b/assets/i18n/zh-CN.json @@ -3426,8 +3426,8 @@ "settingsUnknownRoom": "未知聊天室", "settingsUpdate": "更新", "settingsWindowOpacity": "窗口不透明度", - "settingsLinuxNativeTitleBar": "使用原生标题栏", - "settingsLinuxNativeTitleBarDescription": "使用 Linux 系统标题栏。若遇到窗口无法调整大小的问题,可尝试启用此选项。", + "settingsDesktopNativeTitleBar": "使用原生标题栏", + "settingsDesktopNativeTitleBarDescription": "使用 Linux 系统标题栏。若遇到窗口无法调整大小的问题,可尝试启用此选项。", "share": "分享", "shareCheckInSlogan": "在 Solar Network 查看今日运势。", "shareCodeWithRecipient": "与收件人分享此代码来兑换礼物。", diff --git a/lib/chat/messages_notifier.g.dart b/lib/chat/messages_notifier.g.dart index 1665e63ed..759bd304f 100644 --- a/lib/chat/messages_notifier.g.dart +++ b/lib/chat/messages_notifier.g.dart @@ -50,7 +50,7 @@ final class MessagesNotifierProvider } } -String _$messagesNotifierHash() => r'0fd094605f52ef5877f60e0e30b75e8d68a28b9d'; +String _$messagesNotifierHash() => r'da87abc18a2ac64e339356dd59b3c7b008cb0d5c'; final class MessagesNotifierFamily extends $Family with diff --git a/lib/core/config.dart b/lib/core/config.dart index 6e63307c8..d1b063577 100644 --- a/lib/core/config.dart +++ b/lib/core/config.dart @@ -58,7 +58,7 @@ const kAppSoundEffects = 'app_sound_effects'; const kAppFestivalFeatures = 'app_feastival_features'; const kAppWindowSize = 'app_window_size'; const kAppWindowOpacity = 'app_window_opacity'; -const kAppLinuxUseNativeTitleBar = 'app_linux_use_native_title_bar'; +const kAppLinuxUseNativeTitleBarLegacy = 'app_linux_use_native_title_bar'; const kAppCardTransparent = 'app_card_transparent'; const kAppEnterToSend = 'app_enter_to_send'; const kAppDefaultPoolId = 'app_default_pool_id'; @@ -102,6 +102,7 @@ const kAppDesktopIdleStatusEnabled = 'app_desktop_idle_status_enabled'; const kAppDesktopNowPlayingEnabled = 'app_desktop_now_playing_enabled'; const kAppDesktopRpcServerEnabled = 'app_desktop_rpc_server_enabled'; const kAppDesktopUseSeparateCallWindow = 'app_desktop_use_separate_call_window'; +const kAppDesktopUseNativeTitleBar = 'app_desktop_use_native_title_bar'; const kAppShakeDetectionEnabled = 'app_shake_detection_enabled'; const kMacosNowPlayingCliDefaultPath = '/opt/homebrew/bin/nowplaying-cli'; @@ -121,29 +122,6 @@ final developerModeProvider = Provider((ref) { return prefs.getBool(kAppDeveloperMode) ?? false; }); -final linuxNativeTitleBarProvider = - StateNotifierProvider((ref) { - final prefs = ref.watch(sharedPreferencesProvider); - return LinuxNativeTitleBarNotifier(prefs); - }); - -class LinuxNativeTitleBarNotifier extends StateNotifier { - LinuxNativeTitleBarNotifier(this._prefs) - : super( - !kIsWeb && Platform.isLinux - ? (_prefs.getBool(kAppLinuxUseNativeTitleBar) ?? true) - : false, - ); - - final SharedPreferences _prefs; - - Future setEnabled(bool value) async { - if (kIsWeb || !Platform.isLinux) return; - await _prefs.setBool(kAppLinuxUseNativeTitleBar, value); - state = value; - } -} - @freezed sealed class IpOverride with _$IpOverride { const factory IpOverride({required String ip, int? port}) = _IpOverride; @@ -533,6 +511,7 @@ sealed class AppSettings with _$AppSettings { required ExploreSettings exploreSettings, required bool mediaProxyEnabled, required bool friendStatusDesktopNotification, + required bool desktopUseNativeTitleBar, }) = _AppSettings; } @@ -586,6 +565,12 @@ class AppSettingsNotifier extends _$AppSettingsNotifier { mediaProxyEnabled: prefs.getBool(kAppMediaProxyEnabled) ?? true, friendStatusDesktopNotification: prefs.getBool(kAppFriendStatusDesktopNotification) ?? true, + desktopUseNativeTitleBar: + !kIsWeb && (Platform.isLinux || Platform.isWindows) + ? (prefs.getBool(kAppDesktopUseNativeTitleBar) ?? + prefs.getBool(kAppLinuxUseNativeTitleBarLegacy) ?? + true) + : false, ); } @@ -756,6 +741,12 @@ class AppSettingsNotifier extends _$AppSettingsNotifier { state = state.copyWith(linkCollapseMode: value); } + void setDesktopUseNativeTitleBar(bool value) { + final prefs = ref.read(sharedPreferencesProvider); + prefs.setBool(kAppDesktopUseNativeTitleBar, value); + state = state.copyWith(desktopUseNativeTitleBar: value); + } + void setWindowOpacity(double value) { final prefs = ref.read(sharedPreferencesProvider); prefs.setDouble(kAppWindowOpacity, value); diff --git a/lib/core/config.freezed.dart b/lib/core/config.freezed.dart index d8cb8acc7..a1a105a7a 100644 --- a/lib/core/config.freezed.dart +++ b/lib/core/config.freezed.dart @@ -1467,7 +1467,7 @@ as List, /// @nodoc mixin _$AppSettings implements DiagnosticableTreeMixin { - bool get dataSavingMode; bool get weakConnectionMode; bool get soundEffects; bool get festivalFeatures; bool get enterToSend; bool get appBarTransparent; bool get showBackgroundImage; bool get notifyWithHaptic; String? get customFonts; int? get appColorScheme; ThemeColors? get customColors; Size? get windowSize; double get windowOpacity; double get cardTransparency; String? get defaultPoolId; String get messageDisplayStyle; String get attachmentsListStyle; String get attachmentPreviewMode; String get linkCollapseMode; String? get themeMode; bool get disableAnimation; bool get groupedChatList; String? get firstLaunchAt; bool get askedReview; String? get dashSearchEngine; String? get defaultScreen; String get realmDisplayMode; String get chatEventMessageMode; bool get showChatSystemMessages; DashboardConfig? get dashboardConfig; ExploreSettings get exploreSettings; bool get mediaProxyEnabled; bool get friendStatusDesktopNotification; + bool get dataSavingMode; bool get weakConnectionMode; bool get soundEffects; bool get festivalFeatures; bool get enterToSend; bool get appBarTransparent; bool get showBackgroundImage; bool get notifyWithHaptic; String? get customFonts; int? get appColorScheme; ThemeColors? get customColors; Size? get windowSize; double get windowOpacity; double get cardTransparency; String? get defaultPoolId; String get messageDisplayStyle; String get attachmentsListStyle; String get attachmentPreviewMode; String get linkCollapseMode; String? get themeMode; bool get disableAnimation; bool get groupedChatList; String? get firstLaunchAt; bool get askedReview; String? get dashSearchEngine; String? get defaultScreen; String get realmDisplayMode; String get chatEventMessageMode; bool get showChatSystemMessages; DashboardConfig? get dashboardConfig; ExploreSettings get exploreSettings; bool get mediaProxyEnabled; bool get friendStatusDesktopNotification; bool get desktopUseNativeTitleBar; /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -1479,21 +1479,21 @@ $AppSettingsCopyWith get copyWith => _$AppSettingsCopyWithImpl Object.hashAll([runtimeType,dataSavingMode,weakConnectionMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,attachmentsListStyle,attachmentPreviewMode,linkCollapseMode,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,realmDisplayMode,chatEventMessageMode,showChatSystemMessages,dashboardConfig,exploreSettings,mediaProxyEnabled,friendStatusDesktopNotification]); +int get hashCode => Object.hashAll([runtimeType,dataSavingMode,weakConnectionMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,attachmentsListStyle,attachmentPreviewMode,linkCollapseMode,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,realmDisplayMode,chatEventMessageMode,showChatSystemMessages,dashboardConfig,exploreSettings,mediaProxyEnabled,friendStatusDesktopNotification,desktopUseNativeTitleBar]); @override String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { - return 'AppSettings(dataSavingMode: $dataSavingMode, weakConnectionMode: $weakConnectionMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, attachmentsListStyle: $attachmentsListStyle, attachmentPreviewMode: $attachmentPreviewMode, linkCollapseMode: $linkCollapseMode, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, realmDisplayMode: $realmDisplayMode, chatEventMessageMode: $chatEventMessageMode, showChatSystemMessages: $showChatSystemMessages, dashboardConfig: $dashboardConfig, exploreSettings: $exploreSettings, mediaProxyEnabled: $mediaProxyEnabled, friendStatusDesktopNotification: $friendStatusDesktopNotification)'; + return 'AppSettings(dataSavingMode: $dataSavingMode, weakConnectionMode: $weakConnectionMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, attachmentsListStyle: $attachmentsListStyle, attachmentPreviewMode: $attachmentPreviewMode, linkCollapseMode: $linkCollapseMode, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, realmDisplayMode: $realmDisplayMode, chatEventMessageMode: $chatEventMessageMode, showChatSystemMessages: $showChatSystemMessages, dashboardConfig: $dashboardConfig, exploreSettings: $exploreSettings, mediaProxyEnabled: $mediaProxyEnabled, friendStatusDesktopNotification: $friendStatusDesktopNotification, desktopUseNativeTitleBar: $desktopUseNativeTitleBar)'; } @@ -1504,7 +1504,7 @@ abstract mixin class $AppSettingsCopyWith<$Res> { factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl; @useResult $Res call({ - bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification + bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification, bool desktopUseNativeTitleBar }); @@ -1521,7 +1521,7 @@ class _$AppSettingsCopyWithImpl<$Res> /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? dataSavingMode = null,Object? weakConnectionMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? attachmentsListStyle = null,Object? attachmentPreviewMode = null,Object? linkCollapseMode = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? realmDisplayMode = null,Object? chatEventMessageMode = null,Object? showChatSystemMessages = null,Object? dashboardConfig = freezed,Object? exploreSettings = null,Object? mediaProxyEnabled = null,Object? friendStatusDesktopNotification = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? dataSavingMode = null,Object? weakConnectionMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? attachmentsListStyle = null,Object? attachmentPreviewMode = null,Object? linkCollapseMode = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? realmDisplayMode = null,Object? chatEventMessageMode = null,Object? showChatSystemMessages = null,Object? dashboardConfig = freezed,Object? exploreSettings = null,Object? mediaProxyEnabled = null,Object? friendStatusDesktopNotification = null,Object? desktopUseNativeTitleBar = null,}) { return _then(_self.copyWith( dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable as bool,weakConnectionMode: null == weakConnectionMode ? _self.weakConnectionMode : weakConnectionMode // ignore: cast_nullable_to_non_nullable @@ -1556,6 +1556,7 @@ as bool,dashboardConfig: freezed == dashboardConfig ? _self.dashboardConfig : da as DashboardConfig?,exploreSettings: null == exploreSettings ? _self.exploreSettings : exploreSettings // ignore: cast_nullable_to_non_nullable as ExploreSettings,mediaProxyEnabled: null == mediaProxyEnabled ? _self.mediaProxyEnabled : mediaProxyEnabled // ignore: cast_nullable_to_non_nullable as bool,friendStatusDesktopNotification: null == friendStatusDesktopNotification ? _self.friendStatusDesktopNotification : friendStatusDesktopNotification // ignore: cast_nullable_to_non_nullable +as bool,desktopUseNativeTitleBar: null == desktopUseNativeTitleBar ? _self.desktopUseNativeTitleBar : desktopUseNativeTitleBar // ignore: cast_nullable_to_non_nullable as bool, )); } @@ -1671,10 +1672,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification, bool desktopUseNativeTitleBar)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AppSettings() when $default != null: -return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.attachmentsListStyle,_that.attachmentPreviewMode,_that.linkCollapseMode,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.realmDisplayMode,_that.chatEventMessageMode,_that.showChatSystemMessages,_that.dashboardConfig,_that.exploreSettings,_that.mediaProxyEnabled,_that.friendStatusDesktopNotification);case _: +return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.attachmentsListStyle,_that.attachmentPreviewMode,_that.linkCollapseMode,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.realmDisplayMode,_that.chatEventMessageMode,_that.showChatSystemMessages,_that.dashboardConfig,_that.exploreSettings,_that.mediaProxyEnabled,_that.friendStatusDesktopNotification,_that.desktopUseNativeTitleBar);case _: return orElse(); } @@ -1692,10 +1693,10 @@ return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification, bool desktopUseNativeTitleBar) $default,) {final _that = this; switch (_that) { case _AppSettings(): -return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.attachmentsListStyle,_that.attachmentPreviewMode,_that.linkCollapseMode,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.realmDisplayMode,_that.chatEventMessageMode,_that.showChatSystemMessages,_that.dashboardConfig,_that.exploreSettings,_that.mediaProxyEnabled,_that.friendStatusDesktopNotification);} +return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.attachmentsListStyle,_that.attachmentPreviewMode,_that.linkCollapseMode,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.realmDisplayMode,_that.chatEventMessageMode,_that.showChatSystemMessages,_that.dashboardConfig,_that.exploreSettings,_that.mediaProxyEnabled,_that.friendStatusDesktopNotification,_that.desktopUseNativeTitleBar);} } /// A variant of `when` that fallback to returning `null` /// @@ -1709,10 +1710,10 @@ return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification, bool desktopUseNativeTitleBar)? $default,) {final _that = this; switch (_that) { case _AppSettings() when $default != null: -return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.attachmentsListStyle,_that.attachmentPreviewMode,_that.linkCollapseMode,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.realmDisplayMode,_that.chatEventMessageMode,_that.showChatSystemMessages,_that.dashboardConfig,_that.exploreSettings,_that.mediaProxyEnabled,_that.friendStatusDesktopNotification);case _: +return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.attachmentsListStyle,_that.attachmentPreviewMode,_that.linkCollapseMode,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.realmDisplayMode,_that.chatEventMessageMode,_that.showChatSystemMessages,_that.dashboardConfig,_that.exploreSettings,_that.mediaProxyEnabled,_that.friendStatusDesktopNotification,_that.desktopUseNativeTitleBar);case _: return null; } @@ -1724,7 +1725,7 @@ return $default(_that.dataSavingMode,_that.weakConnectionMode,_that.soundEffects class _AppSettings with DiagnosticableTreeMixin implements AppSettings { - const _AppSettings({required this.dataSavingMode, required this.weakConnectionMode, required this.soundEffects, required this.festivalFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.notifyWithHaptic, required this.customFonts, required this.appColorScheme, required this.customColors, required this.windowSize, required this.windowOpacity, required this.cardTransparency, required this.defaultPoolId, required this.messageDisplayStyle, required this.attachmentsListStyle, required this.attachmentPreviewMode, required this.linkCollapseMode, required this.themeMode, required this.disableAnimation, required this.groupedChatList, required this.firstLaunchAt, required this.askedReview, required this.dashSearchEngine, required this.defaultScreen, required this.realmDisplayMode, required this.chatEventMessageMode, required this.showChatSystemMessages, required this.dashboardConfig, required this.exploreSettings, required this.mediaProxyEnabled, required this.friendStatusDesktopNotification}); + const _AppSettings({required this.dataSavingMode, required this.weakConnectionMode, required this.soundEffects, required this.festivalFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.notifyWithHaptic, required this.customFonts, required this.appColorScheme, required this.customColors, required this.windowSize, required this.windowOpacity, required this.cardTransparency, required this.defaultPoolId, required this.messageDisplayStyle, required this.attachmentsListStyle, required this.attachmentPreviewMode, required this.linkCollapseMode, required this.themeMode, required this.disableAnimation, required this.groupedChatList, required this.firstLaunchAt, required this.askedReview, required this.dashSearchEngine, required this.defaultScreen, required this.realmDisplayMode, required this.chatEventMessageMode, required this.showChatSystemMessages, required this.dashboardConfig, required this.exploreSettings, required this.mediaProxyEnabled, required this.friendStatusDesktopNotification, required this.desktopUseNativeTitleBar}); @override final bool dataSavingMode; @@ -1760,6 +1761,7 @@ class _AppSettings with DiagnosticableTreeMixin implements AppSettings { @override final ExploreSettings exploreSettings; @override final bool mediaProxyEnabled; @override final bool friendStatusDesktopNotification; +@override final bool desktopUseNativeTitleBar; /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. @@ -1772,21 +1774,21 @@ _$AppSettingsCopyWith<_AppSettings> get copyWith => __$AppSettingsCopyWithImpl<_ void debugFillProperties(DiagnosticPropertiesBuilder properties) { properties ..add(DiagnosticsProperty('type', 'AppSettings')) - ..add(DiagnosticsProperty('dataSavingMode', dataSavingMode))..add(DiagnosticsProperty('weakConnectionMode', weakConnectionMode))..add(DiagnosticsProperty('soundEffects', soundEffects))..add(DiagnosticsProperty('festivalFeatures', festivalFeatures))..add(DiagnosticsProperty('enterToSend', enterToSend))..add(DiagnosticsProperty('appBarTransparent', appBarTransparent))..add(DiagnosticsProperty('showBackgroundImage', showBackgroundImage))..add(DiagnosticsProperty('notifyWithHaptic', notifyWithHaptic))..add(DiagnosticsProperty('customFonts', customFonts))..add(DiagnosticsProperty('appColorScheme', appColorScheme))..add(DiagnosticsProperty('customColors', customColors))..add(DiagnosticsProperty('windowSize', windowSize))..add(DiagnosticsProperty('windowOpacity', windowOpacity))..add(DiagnosticsProperty('cardTransparency', cardTransparency))..add(DiagnosticsProperty('defaultPoolId', defaultPoolId))..add(DiagnosticsProperty('messageDisplayStyle', messageDisplayStyle))..add(DiagnosticsProperty('attachmentsListStyle', attachmentsListStyle))..add(DiagnosticsProperty('attachmentPreviewMode', attachmentPreviewMode))..add(DiagnosticsProperty('linkCollapseMode', linkCollapseMode))..add(DiagnosticsProperty('themeMode', themeMode))..add(DiagnosticsProperty('disableAnimation', disableAnimation))..add(DiagnosticsProperty('groupedChatList', groupedChatList))..add(DiagnosticsProperty('firstLaunchAt', firstLaunchAt))..add(DiagnosticsProperty('askedReview', askedReview))..add(DiagnosticsProperty('dashSearchEngine', dashSearchEngine))..add(DiagnosticsProperty('defaultScreen', defaultScreen))..add(DiagnosticsProperty('realmDisplayMode', realmDisplayMode))..add(DiagnosticsProperty('chatEventMessageMode', chatEventMessageMode))..add(DiagnosticsProperty('showChatSystemMessages', showChatSystemMessages))..add(DiagnosticsProperty('dashboardConfig', dashboardConfig))..add(DiagnosticsProperty('exploreSettings', exploreSettings))..add(DiagnosticsProperty('mediaProxyEnabled', mediaProxyEnabled))..add(DiagnosticsProperty('friendStatusDesktopNotification', friendStatusDesktopNotification)); + ..add(DiagnosticsProperty('dataSavingMode', dataSavingMode))..add(DiagnosticsProperty('weakConnectionMode', weakConnectionMode))..add(DiagnosticsProperty('soundEffects', soundEffects))..add(DiagnosticsProperty('festivalFeatures', festivalFeatures))..add(DiagnosticsProperty('enterToSend', enterToSend))..add(DiagnosticsProperty('appBarTransparent', appBarTransparent))..add(DiagnosticsProperty('showBackgroundImage', showBackgroundImage))..add(DiagnosticsProperty('notifyWithHaptic', notifyWithHaptic))..add(DiagnosticsProperty('customFonts', customFonts))..add(DiagnosticsProperty('appColorScheme', appColorScheme))..add(DiagnosticsProperty('customColors', customColors))..add(DiagnosticsProperty('windowSize', windowSize))..add(DiagnosticsProperty('windowOpacity', windowOpacity))..add(DiagnosticsProperty('cardTransparency', cardTransparency))..add(DiagnosticsProperty('defaultPoolId', defaultPoolId))..add(DiagnosticsProperty('messageDisplayStyle', messageDisplayStyle))..add(DiagnosticsProperty('attachmentsListStyle', attachmentsListStyle))..add(DiagnosticsProperty('attachmentPreviewMode', attachmentPreviewMode))..add(DiagnosticsProperty('linkCollapseMode', linkCollapseMode))..add(DiagnosticsProperty('themeMode', themeMode))..add(DiagnosticsProperty('disableAnimation', disableAnimation))..add(DiagnosticsProperty('groupedChatList', groupedChatList))..add(DiagnosticsProperty('firstLaunchAt', firstLaunchAt))..add(DiagnosticsProperty('askedReview', askedReview))..add(DiagnosticsProperty('dashSearchEngine', dashSearchEngine))..add(DiagnosticsProperty('defaultScreen', defaultScreen))..add(DiagnosticsProperty('realmDisplayMode', realmDisplayMode))..add(DiagnosticsProperty('chatEventMessageMode', chatEventMessageMode))..add(DiagnosticsProperty('showChatSystemMessages', showChatSystemMessages))..add(DiagnosticsProperty('dashboardConfig', dashboardConfig))..add(DiagnosticsProperty('exploreSettings', exploreSettings))..add(DiagnosticsProperty('mediaProxyEnabled', mediaProxyEnabled))..add(DiagnosticsProperty('friendStatusDesktopNotification', friendStatusDesktopNotification))..add(DiagnosticsProperty('desktopUseNativeTitleBar', desktopUseNativeTitleBar)); } @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.weakConnectionMode, weakConnectionMode) || other.weakConnectionMode == weakConnectionMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.attachmentsListStyle, attachmentsListStyle) || other.attachmentsListStyle == attachmentsListStyle)&&(identical(other.attachmentPreviewMode, attachmentPreviewMode) || other.attachmentPreviewMode == attachmentPreviewMode)&&(identical(other.linkCollapseMode, linkCollapseMode) || other.linkCollapseMode == linkCollapseMode)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.realmDisplayMode, realmDisplayMode) || other.realmDisplayMode == realmDisplayMode)&&(identical(other.chatEventMessageMode, chatEventMessageMode) || other.chatEventMessageMode == chatEventMessageMode)&&(identical(other.showChatSystemMessages, showChatSystemMessages) || other.showChatSystemMessages == showChatSystemMessages)&&(identical(other.dashboardConfig, dashboardConfig) || other.dashboardConfig == dashboardConfig)&&(identical(other.exploreSettings, exploreSettings) || other.exploreSettings == exploreSettings)&&(identical(other.mediaProxyEnabled, mediaProxyEnabled) || other.mediaProxyEnabled == mediaProxyEnabled)&&(identical(other.friendStatusDesktopNotification, friendStatusDesktopNotification) || other.friendStatusDesktopNotification == friendStatusDesktopNotification)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.weakConnectionMode, weakConnectionMode) || other.weakConnectionMode == weakConnectionMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.attachmentsListStyle, attachmentsListStyle) || other.attachmentsListStyle == attachmentsListStyle)&&(identical(other.attachmentPreviewMode, attachmentPreviewMode) || other.attachmentPreviewMode == attachmentPreviewMode)&&(identical(other.linkCollapseMode, linkCollapseMode) || other.linkCollapseMode == linkCollapseMode)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.realmDisplayMode, realmDisplayMode) || other.realmDisplayMode == realmDisplayMode)&&(identical(other.chatEventMessageMode, chatEventMessageMode) || other.chatEventMessageMode == chatEventMessageMode)&&(identical(other.showChatSystemMessages, showChatSystemMessages) || other.showChatSystemMessages == showChatSystemMessages)&&(identical(other.dashboardConfig, dashboardConfig) || other.dashboardConfig == dashboardConfig)&&(identical(other.exploreSettings, exploreSettings) || other.exploreSettings == exploreSettings)&&(identical(other.mediaProxyEnabled, mediaProxyEnabled) || other.mediaProxyEnabled == mediaProxyEnabled)&&(identical(other.friendStatusDesktopNotification, friendStatusDesktopNotification) || other.friendStatusDesktopNotification == friendStatusDesktopNotification)&&(identical(other.desktopUseNativeTitleBar, desktopUseNativeTitleBar) || other.desktopUseNativeTitleBar == desktopUseNativeTitleBar)); } @override -int get hashCode => Object.hashAll([runtimeType,dataSavingMode,weakConnectionMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,attachmentsListStyle,attachmentPreviewMode,linkCollapseMode,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,realmDisplayMode,chatEventMessageMode,showChatSystemMessages,dashboardConfig,exploreSettings,mediaProxyEnabled,friendStatusDesktopNotification]); +int get hashCode => Object.hashAll([runtimeType,dataSavingMode,weakConnectionMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,attachmentsListStyle,attachmentPreviewMode,linkCollapseMode,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,realmDisplayMode,chatEventMessageMode,showChatSystemMessages,dashboardConfig,exploreSettings,mediaProxyEnabled,friendStatusDesktopNotification,desktopUseNativeTitleBar]); @override String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { - return 'AppSettings(dataSavingMode: $dataSavingMode, weakConnectionMode: $weakConnectionMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, attachmentsListStyle: $attachmentsListStyle, attachmentPreviewMode: $attachmentPreviewMode, linkCollapseMode: $linkCollapseMode, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, realmDisplayMode: $realmDisplayMode, chatEventMessageMode: $chatEventMessageMode, showChatSystemMessages: $showChatSystemMessages, dashboardConfig: $dashboardConfig, exploreSettings: $exploreSettings, mediaProxyEnabled: $mediaProxyEnabled, friendStatusDesktopNotification: $friendStatusDesktopNotification)'; + return 'AppSettings(dataSavingMode: $dataSavingMode, weakConnectionMode: $weakConnectionMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, attachmentsListStyle: $attachmentsListStyle, attachmentPreviewMode: $attachmentPreviewMode, linkCollapseMode: $linkCollapseMode, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, realmDisplayMode: $realmDisplayMode, chatEventMessageMode: $chatEventMessageMode, showChatSystemMessages: $showChatSystemMessages, dashboardConfig: $dashboardConfig, exploreSettings: $exploreSettings, mediaProxyEnabled: $mediaProxyEnabled, friendStatusDesktopNotification: $friendStatusDesktopNotification, desktopUseNativeTitleBar: $desktopUseNativeTitleBar)'; } @@ -1797,7 +1799,7 @@ abstract mixin class _$AppSettingsCopyWith<$Res> implements $AppSettingsCopyWith factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl; @override @useResult $Res call({ - bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification + bool dataSavingMode, bool weakConnectionMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String attachmentsListStyle, String attachmentPreviewMode, String linkCollapseMode, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, String realmDisplayMode, String chatEventMessageMode, bool showChatSystemMessages, DashboardConfig? dashboardConfig, ExploreSettings exploreSettings, bool mediaProxyEnabled, bool friendStatusDesktopNotification, bool desktopUseNativeTitleBar }); @@ -1814,7 +1816,7 @@ class __$AppSettingsCopyWithImpl<$Res> /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? dataSavingMode = null,Object? weakConnectionMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? attachmentsListStyle = null,Object? attachmentPreviewMode = null,Object? linkCollapseMode = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? realmDisplayMode = null,Object? chatEventMessageMode = null,Object? showChatSystemMessages = null,Object? dashboardConfig = freezed,Object? exploreSettings = null,Object? mediaProxyEnabled = null,Object? friendStatusDesktopNotification = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? dataSavingMode = null,Object? weakConnectionMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? attachmentsListStyle = null,Object? attachmentPreviewMode = null,Object? linkCollapseMode = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? realmDisplayMode = null,Object? chatEventMessageMode = null,Object? showChatSystemMessages = null,Object? dashboardConfig = freezed,Object? exploreSettings = null,Object? mediaProxyEnabled = null,Object? friendStatusDesktopNotification = null,Object? desktopUseNativeTitleBar = null,}) { return _then(_AppSettings( dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable as bool,weakConnectionMode: null == weakConnectionMode ? _self.weakConnectionMode : weakConnectionMode // ignore: cast_nullable_to_non_nullable @@ -1849,6 +1851,7 @@ as bool,dashboardConfig: freezed == dashboardConfig ? _self.dashboardConfig : da as DashboardConfig?,exploreSettings: null == exploreSettings ? _self.exploreSettings : exploreSettings // ignore: cast_nullable_to_non_nullable as ExploreSettings,mediaProxyEnabled: null == mediaProxyEnabled ? _self.mediaProxyEnabled : mediaProxyEnabled // ignore: cast_nullable_to_non_nullable as bool,friendStatusDesktopNotification: null == friendStatusDesktopNotification ? _self.friendStatusDesktopNotification : friendStatusDesktopNotification // ignore: cast_nullable_to_non_nullable +as bool,desktopUseNativeTitleBar: null == desktopUseNativeTitleBar ? _self.desktopUseNativeTitleBar : desktopUseNativeTitleBar // ignore: cast_nullable_to_non_nullable as bool, )); } diff --git a/lib/core/config.g.dart b/lib/core/config.g.dart index b8f4742d6..38dc60d90 100644 --- a/lib/core/config.g.dart +++ b/lib/core/config.g.dart @@ -158,7 +158,7 @@ final class AppSettingsNotifierProvider } String _$appSettingsNotifierHash() => - r'5601ca7f5136124c775528eaf4d2212812a93502'; + r'f1c28ba63c4895952fd2634d8791e11b3b640ce1'; abstract class _$AppSettingsNotifier extends $Notifier { AppSettings build(); diff --git a/lib/main.dart b/lib/main.dart index 6ad0bf682..50c45aa2c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -283,24 +283,27 @@ void main(List args) async { } } - final useLinuxNativeTitleBar = Platform.isLinux - ? (prefs.getBool(kAppLinuxUseNativeTitleBar) ?? true) + final useDesktopNativeTitleBar = + !kIsWeb && (Platform.isLinux || Platform.isWindows) + ? (prefs.getBool(kAppDesktopUseNativeTitleBar) ?? + prefs.getBool(kAppLinuxUseNativeTitleBarLegacy) ?? + true) : false; WindowOptions windowOptions = WindowOptions( size: initialSize, center: true, backgroundColor: Colors.transparent, skipTaskbar: false, - titleBarStyle: useLinuxNativeTitleBar + titleBarStyle: useDesktopNativeTitleBar ? TitleBarStyle.normal : TitleBarStyle.hidden, - windowButtonVisibility: useLinuxNativeTitleBar, + windowButtonVisibility: useDesktopNativeTitleBar, ); windowManager.waitUntilReadyToShow(windowOptions, () async { final env = Platform.environment; final isWayland = env.containsKey('WAYLAND_DISPLAY'); - if (isWayland && (!Platform.isLinux || !useLinuxNativeTitleBar)) { + if (isWayland && (!Platform.isLinux || !useDesktopNativeTitleBar)) { try { await windowManager.setAsFrameless(); } catch (e) { @@ -314,7 +317,7 @@ void main(List args) async { await windowManager.setOpacity(opacity); Logger.root.info( "[SplashScreen] Desktop window is ready with size: ${initialSize.width}x${initialSize.height}" - "${isWayland && (!Platform.isLinux || !useLinuxNativeTitleBar) ? " (Wayland frameless fix applied)" : ""}", + "${isWayland && (!Platform.isLinux || !useDesktopNativeTitleBar) ? " (Wayland frameless fix applied)" : ""}", ); }); } diff --git a/lib/misc/settings.dart b/lib/misc/settings.dart index 082d8b6d2..e921310ad 100644 --- a/lib/misc/settings.dart +++ b/lib/misc/settings.dart @@ -72,7 +72,9 @@ class SettingsScreen extends HookConsumerWidget { final prefs = ref.watch(sharedPreferencesProvider); final controller = TextEditingController(text: serverUrl); final settings = ref.watch(appSettingsProvider); - final useLinuxNativeTitleBar = ref.watch(linuxNativeTitleBarProvider); + final useDesktopNativeTitleBar = ref.watch( + appSettingsProvider.select((s) => s.desktopUseNativeTitleBar), + ); final isDesktop = !kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux); final isWide = isWideScreen(context); @@ -154,8 +156,8 @@ class SettingsScreen extends HookConsumerWidget { 'settingsCustomColors', 'settingsCardBackgroundOpacity', 'settingsWindowOpacity', - 'settingsLinuxNativeTitleBar', - 'settingsLinuxNativeTitleBarDescription', + 'settingsDesktopNativeTitleBar', + 'settingsDesktopNativeTitleBarDescription', 'settingsCustomFonts', 'settingsLinkCollapseMode', 'settingsTransparentAppBar', @@ -595,19 +597,19 @@ class SettingsScreen extends HookConsumerWidget { ), ), ), - if (Platform.isLinux) + if (Platform.isLinux || Platform.isWindows) ListTile( minLeadingWidth: 48, - title: Text('settingsLinuxNativeTitleBar').tr(), - subtitle: Text('settingsLinuxNativeTitleBarDescription').tr(), + title: Text('settingsDesktopNativeTitleBar').tr(), + subtitle: Text('settingsDesktopNativeTitleBarDescription').tr(), contentPadding: _kSettingsTilePadding, leading: const Icon(Symbols.web_traffic), trailing: Switch( - value: useLinuxNativeTitleBar, - onChanged: (value) async { - await ref - .read(linuxNativeTitleBarProvider.notifier) - .setEnabled(value); + value: useDesktopNativeTitleBar, + onChanged: (value) { + ref + .read(appSettingsProvider.notifier) + .setDesktopUseNativeTitleBar(value); if (context.mounted) { showSnackBar('settingsApplied'.tr()); } diff --git a/lib/shared/widgets/app_scaffold.dart b/lib/shared/widgets/app_scaffold.dart index 873e38971..dd545c520 100644 --- a/lib/shared/widgets/app_scaffold.dart +++ b/lib/shared/widgets/app_scaffold.dart @@ -39,16 +39,21 @@ class WindowScaffold extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final showPalette = useState(false); final isDesktop = DesktopWindowFrame.isPlatformDesktop; - final useLinuxNativeTitleBar = ref.watch(linuxNativeTitleBarProvider); + final useDesktopNativeTitleBar = ref.watch( + appSettingsProvider.select((s) => s.desktopUseNativeTitleBar), + ); final useCustomTitleBar = - isDesktop && (!Platform.isLinux || !useLinuxNativeTitleBar); + isDesktop && + (!(Platform.isLinux || Platform.isWindows) || + !useDesktopNativeTitleBar); final shakeEnabled = ref.watch(shakeDetectionEnabledProvider); useEffect(() { - if (kIsWeb || !isDesktop || !Platform.isLinux) return null; + if (kIsWeb || !isDesktop || !(Platform.isLinux || Platform.isWindows)) + return null; Future(() async { - if (useLinuxNativeTitleBar) { + if (useDesktopNativeTitleBar) { await windowManager.setTitleBarStyle( TitleBarStyle.normal, windowButtonVisibility: true, @@ -68,7 +73,7 @@ class WindowScaffold extends HookConsumerWidget { }); return null; - }, [isDesktop, useLinuxNativeTitleBar]); + }, [isDesktop, useDesktopNativeTitleBar]); useEffect(() { if (!isDesktop) return null; From 49489636b304323de8570014b0a7e5373431a13c Mon Sep 17 00:00:00 2001 From: BluewhaleYF Date: Mon, 27 Jul 2026 20:45:25 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9B=20Fix=20web=20platform=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/misc/settings.dart | 25 ++++++++-- lib/shared/widgets/app_scaffold.dart | 46 +++++++++++++++---- .../lib/src/window_frame.dart | 12 +++-- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/lib/misc/settings.dart b/lib/misc/settings.dart index e921310ad..8a95999be 100644 --- a/lib/misc/settings.dart +++ b/lib/misc/settings.dart @@ -72,11 +72,18 @@ class SettingsScreen extends HookConsumerWidget { final prefs = ref.watch(sharedPreferencesProvider); final controller = TextEditingController(text: serverUrl); final settings = ref.watch(appSettingsProvider); + final currentPlatform = defaultTargetPlatform; final useDesktopNativeTitleBar = ref.watch( appSettingsProvider.select((s) => s.desktopUseNativeTitleBar), ); final isDesktop = - !kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux); + !kIsWeb && + switch (currentPlatform) { + TargetPlatform.windows || + TargetPlatform.macOS || + TargetPlatform.linux => true, + _ => false, + }; final isWide = isWideScreen(context); final pools = ref.watch(poolsProvider); final user = ref.watch(userInfoProvider); @@ -597,7 +604,9 @@ class SettingsScreen extends HookConsumerWidget { ), ), ), - if (Platform.isLinux || Platform.isWindows) + if (!kIsWeb && + (currentPlatform == TargetPlatform.linux || + currentPlatform == TargetPlatform.windows)) ListTile( minLeadingWidth: 48, title: Text('settingsDesktopNativeTitleBar').tr(), @@ -1236,7 +1245,7 @@ class SettingsScreen extends HookConsumerWidget { }, ), ), - if (Platform.isMacOS) ...[ + if (!kIsWeb && currentPlatform == TargetPlatform.macOS) ...[ Builder( builder: (context) { final status = ref.watch(desktopNowPlayingCliStatusProvider); @@ -2351,9 +2360,15 @@ class _StorageSettingsSection extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final isIOS = !kIsWeb && Platform.isIOS; + final isIOS = !kIsWeb && defaultTargetPlatform == TargetPlatform.iOS; final isDesktop = - !kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux); + !kIsWeb && + switch (defaultTargetPlatform) { + TargetPlatform.macOS || + TargetPlatform.windows || + TargetPlatform.linux => true, + _ => false, + }; final theme = Theme.of(context); final diskSpace = useState(null); final flutterCacheSize = useState(0); diff --git a/lib/shared/widgets/app_scaffold.dart b/lib/shared/widgets/app_scaffold.dart index dd545c520..39e08e1e0 100644 --- a/lib/shared/widgets/app_scaffold.dart +++ b/lib/shared/widgets/app_scaffold.dart @@ -38,19 +38,26 @@ class WindowScaffold extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final showPalette = useState(false); + final currentPlatform = defaultTargetPlatform; final isDesktop = DesktopWindowFrame.isPlatformDesktop; final useDesktopNativeTitleBar = ref.watch( appSettingsProvider.select((s) => s.desktopUseNativeTitleBar), ); final useCustomTitleBar = isDesktop && - (!(Platform.isLinux || Platform.isWindows) || + (!(!kIsWeb && + (currentPlatform == TargetPlatform.linux || + currentPlatform == TargetPlatform.windows)) || !useDesktopNativeTitleBar); final shakeEnabled = ref.watch(shakeDetectionEnabledProvider); useEffect(() { - if (kIsWeb || !isDesktop || !(Platform.isLinux || Platform.isWindows)) + if (kIsWeb || + !isDesktop || + !(currentPlatform == TargetPlatform.linux || + currentPlatform == TargetPlatform.windows)) { return null; + } Future(() async { if (useDesktopNativeTitleBar) { @@ -63,7 +70,7 @@ class WindowScaffold extends HookConsumerWidget { TitleBarStyle.hidden, windowButtonVisibility: false, ); - final env = Platform.environment; + const env = {}; if (env.containsKey('WAYLAND_DISPLAY')) { try { await windowManager.setAsFrameless(); @@ -104,7 +111,10 @@ class WindowScaffold extends HookConsumerWidget { useEffect(() { ShakeDetector? detector; - if (!kIsWeb && (Platform.isIOS || Platform.isAndroid) && shakeEnabled) { + if (!kIsWeb && + (currentPlatform == TargetPlatform.iOS || + currentPlatform == TargetPlatform.android) && + shakeEnabled) { detector = ShakeDetector.autoStart( onPhoneShake: (_) { showPalette.value = true; @@ -140,7 +150,7 @@ class WindowScaffold extends HookConsumerWidget { isDesktopPlatform: isDesktop, showTitleBar: useCustomTitleBar, title: useCustomTitleBar - ? Platform.isMacOS + ? (!kIsWeb && currentPlatform == TargetPlatform.macOS) ? Text( 'Solar Network', style: TextStyle( @@ -166,7 +176,7 @@ class WindowScaffold extends HookConsumerWidget { if (showPalette.value) CommandPaletteWidget(onDismiss: () => showPalette.value = false), ], - onClose: () => windowManager.hide(), + onClose: isDesktop ? () => windowManager.hide() : null, child: Column( children: [ Expanded(child: child), @@ -192,7 +202,9 @@ class _WindowSizeObserver extends WidgetsBindingObserver { state == AppLifecycleState.detached || state == AppLifecycleState.hidden) { if (!kIsWeb && - (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { + (defaultTargetPlatform == TargetPlatform.windows || + defaultTargetPlatform == TargetPlatform.linux || + defaultTargetPlatform == TargetPlatform.macOS)) { onSaveWindowSize(); } } @@ -322,7 +334,13 @@ class PageBackButton extends StatelessWidget { }); static bool isDesktop() => - (!kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows)); + !kIsWeb && + switch (defaultTargetPlatform) { + TargetPlatform.macOS || + TargetPlatform.linux || + TargetPlatform.windows => true, + _ => false, + }; @override Widget build(BuildContext context) { @@ -347,7 +365,9 @@ class PageBackButton extends StatelessWidget { icon: Icon( color: color, canPop - ? (!kIsWeb && (Platform.isMacOS || Platform.isIOS)) + ? (!kIsWeb && + (defaultTargetPlatform == TargetPlatform.macOS || + defaultTargetPlatform == TargetPlatform.iOS)) ? Symbols.arrow_back_ios_new : Symbols.arrow_back : Symbols.home, @@ -451,7 +471,13 @@ class _WebSocketIndicator extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final isDesktop = - !kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux); + !kIsWeb && + switch (defaultTargetPlatform) { + TargetPlatform.macOS || + TargetPlatform.windows || + TargetPlatform.linux => true, + _ => false, + }; final devicePadding = MediaQuery.of(context).padding; diff --git a/packages/island_ui_foundation/lib/src/window_frame.dart b/packages/island_ui_foundation/lib/src/window_frame.dart index b911f9672..c91419aab 100644 --- a/packages/island_ui_foundation/lib/src/window_frame.dart +++ b/packages/island_ui_foundation/lib/src/window_frame.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -33,7 +31,13 @@ class DesktopWindowFrame extends HookWidget { }); static bool get isPlatformDesktop => - !kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows); + !kIsWeb && + switch (defaultTargetPlatform) { + TargetPlatform.macOS || + TargetPlatform.linux || + TargetPlatform.windows => true, + _ => false, + }; @override Widget build(BuildContext context) { @@ -95,7 +99,7 @@ class DesktopWindowFrame extends HookWidget { } Widget _buildTitleBar(BuildContext context, ValueNotifier isMaximized) { - if (Platform.isMacOS) { + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.macOS) { return SizedBox( height: 32, child: Stack(alignment: Alignment.center, children: [?title]), From 4fe95fa0ceef736ac71aa553f99ceca82f58df2b Mon Sep 17 00:00:00 2001 From: BluewhaleYF Date: Mon, 27 Jul 2026 20:57:57 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=8E=A8=20Resolve=20Flutter=20analyze?= =?UTF-8?q?=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/config.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/core/config.dart b/lib/core/config.dart index d1b063577..9f106845f 100644 --- a/lib/core/config.dart +++ b/lib/core/config.dart @@ -9,7 +9,6 @@ import 'package:island/core/services/analytics_service.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:window_manager/window_manager.dart'; -import 'package:flutter_riverpod/legacy.dart'; part 'config.freezed.dart'; part 'config.g.dart';