From 9fab7630a39429802030b98d4d51b4e1c1263d46 Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 15 Nov 2024 07:50:19 +0100 Subject: [PATCH] chore: Follow up send file dialog --- assets/l10n/intl_en.arb | 2 +- lib/pages/chat/send_file_dialog.dart | 41 ++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 173c33bf4..c3eae0523 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2806,5 +2806,5 @@ "name": "Name", "version": "Version", "website": "Website", - "compressBeforeSending": "Compress before sending" + "sendUncompressed": "Send uncompressed" } diff --git a/lib/pages/chat/send_file_dialog.dart b/lib/pages/chat/send_file_dialog.dart index 95850e09c..ce3ae7ecf 100644 --- a/lib/pages/chat/send_file_dialog.dart +++ b/lib/pages/chat/send_file_dialog.dart @@ -149,7 +149,7 @@ class SendFileDialogState extends State { var sendStr = L10n.of(context).sendFile; final uniqueMimeType = widget.files - .map((file) => file.mimeType ?? lookupMimeType(file.path)) + .map((file) => file.mimeType ?? lookupMimeType(file.name)) .toSet() .singleOrNull; @@ -250,23 +250,42 @@ class SendFileDialogState extends State { Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - CupertinoSwitch( - value: compress, - onChanged: uniqueMimeType.startsWith('video') && - !PlatformInfos.isMobile - ? null - : (v) => setState(() => compress = v), - ), + if ({TargetPlatform.iOS, TargetPlatform.macOS} + .contains(theme.platform)) + CupertinoSwitch( + value: !compress, + onChanged: uniqueMimeType.startsWith('video') && + !PlatformInfos.isMobile + ? null + : (v) => setState(() => compress = !v), + ) + else + Switch.adaptive( + value: !compress, + onChanged: uniqueMimeType.startsWith('video') && + !PlatformInfos.isMobile + ? null + : (v) => setState(() => compress = !v), + ), const SizedBox(width: 16), Expanded( child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + L10n.of(context).sendUncompressed, + style: theme.textTheme.titleMedium, + textAlign: TextAlign.left, + ), + ], + ), Text( - L10n.of(context).compressBeforeSending, - style: theme.textTheme.labelMedium, - textAlign: TextAlign.left, + ' ($sizeString)', + style: theme.textTheme.labelSmall, ), ], ),