From b020c90ac579a3c80441b6c7b3cab2181b31930a Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Tue, 12 Aug 2025 09:50:43 +0900 Subject: [PATCH 1/3] feat: support xdp selector for linux use xdp selector --- lib/utils/file_selector.dart | 34 ++++++------------- .../matrix_file_extension.dart | 19 ++++------- pubspec.lock | 4 +-- pubspec.yaml | 4 +-- 4 files changed, 20 insertions(+), 41 deletions(-) diff --git a/lib/utils/file_selector.dart b/lib/utils/file_selector.dart index fd35891af..2e09b492f 100644 --- a/lib/utils/file_selector.dart +++ b/lib/utils/file_selector.dart @@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart'; import 'package:file_picker/file_picker.dart'; import 'package:file_selector/file_selector.dart'; -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/widgets/app_lock.dart'; import 'package:fluffychat/widgets/future_loading_dialog.dart'; @@ -13,31 +12,18 @@ Future> selectFiles( FileSelectorType type = FileSelectorType.any, bool allowMultiple = false, }) async { - if (!PlatformInfos.isLinux) { - final result = await AppLock.of(context).pauseWhile( - showFutureLoadingDialog( - context: context, - future: () => FilePicker.platform.pickFiles( - compressionQuality: 0, - allowMultiple: allowMultiple, - type: type.filePickerType, - allowedExtensions: type.extensions, - ), + final result = await AppLock.of(context).pauseWhile( + showFutureLoadingDialog( + context: context, + future: () => FilePicker.platform.pickFiles( + compressionQuality: 0, + allowMultiple: allowMultiple, + type: type.filePickerType, + allowedExtensions: type.extensions, ), - ); - return result.result?.xFiles ?? []; - } - - if (allowMultiple) { - return await AppLock.of(context).pauseWhile( - openFiles(confirmButtonText: title, acceptedTypeGroups: type.groups), - ); - } - final file = await AppLock.of(context).pauseWhile( - openFile(confirmButtonText: title, acceptedTypeGroups: type.groups), + ), ); - if (file == null) return []; - return [file]; + return result.result?.xFiles ?? []; } enum FileSelectorType { diff --git a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart index 069b6ec8b..f84f21996 100644 --- a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart +++ b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart @@ -3,7 +3,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:file_picker/file_picker.dart'; -import 'package:file_selector/file_selector.dart'; import 'package:matrix/matrix.dart'; import 'package:share_plus/share_plus.dart'; import 'package:universal_html/html.dart' as html; @@ -20,18 +19,12 @@ extension MatrixFileExtension on MatrixFile { return; } - final downloadPath = !PlatformInfos.isMobile - ? (await getSaveLocation( - suggestedName: name, - confirmButtonText: L10n.of(context).saveFile, - )) - ?.path - : await FilePicker.platform.saveFile( - dialogTitle: L10n.of(context).saveFile, - fileName: name, - type: filePickerFileType, - bytes: bytes, - ); + final downloadPath = await FilePicker.platform.saveFile( + dialogTitle: L10n.of(context).saveFile, + fileName: name, + type: filePickerFileType, + bytes: bytes, + ); if (downloadPath == null) return; if (PlatformInfos.isDesktop) { diff --git a/pubspec.lock b/pubspec.lock index 4fa2798d4..913d28b74 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -410,10 +410,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "8f9f429998f9232d65bc4757af74475ce44fc80f10704ff5dfa8b1d14fc429b9" + sha256: ef7d2a085c1b1d69d17b6842d0734aad90156de08df6bd3c12496d0bd6ddf8e2 url: "https://pub.dev" source: hosted - version: "10.2.3" + version: "10.3.1" file_selector: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 28360a08a..59bc2f7d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: dynamic_color: ^1.8.1 emoji_picker_flutter: ^4.3.0 emojis: ^0.9.9 - file_picker: ^10.2.3 + file_picker: ^10.3.1 file_selector: ^1.0.3 flutter: sdk: flutter @@ -144,4 +144,4 @@ dependency_overrides: git: url: https://github.com/ThexXTURBOXx/flutter_web_auth_2.git ref: 3.x-without-v1 - path: flutter_web_auth_2 \ No newline at end of file + path: flutter_web_auth_2 From 510f9ca9d0ddeef3393f96d4893d49d0156d4208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 18 Aug 2025 08:24:01 +0200 Subject: [PATCH 2/3] fix: Follow up fix rectangle avatars --- lib/widgets/avatar.dart | 49 +++++++++++++++++++------------------ lib/widgets/mxc_image.dart | 50 +++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index e55b9cb17..31a523fa3 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -60,37 +60,38 @@ class Avatar extends StatelessWidget { side: border ?? BorderSide.none, ), clipBehavior: Clip.antiAlias, - child: noPic - ? Container( - decoration: BoxDecoration(color: name?.lightColorAvatar), - alignment: Alignment.center, - child: Text( - fallbackLetters, - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: 'RobotoMono', - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: (size / 2.5).roundToDouble(), + child: MxcImage( + client: client, + borderRadius: borderRadius, + key: ValueKey(mxContent.toString()), + cacheKey: '${mxContent}_$size', + uri: mxContent, + fit: BoxFit.cover, + width: size, + height: size, + placeholder: (_) => noPic + ? Container( + decoration: BoxDecoration(color: name?.lightColorAvatar), + alignment: Alignment.center, + child: Text( + fallbackLetters, + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'RobotoMono', + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: (size / 2.5).roundToDouble(), + ), ), - ), - ) - : MxcImage( - client: client, - key: ValueKey(mxContent.toString()), - cacheKey: '${mxContent}_$size', - uri: mxContent, - fit: BoxFit.cover, - width: size, - height: size, - placeholder: (_) => Center( + ) + : Center( child: Icon( Icons.person_2, color: theme.colorScheme.tertiary, size: size / 1.5, ), ), - ), + ), ), ), if (presenceUserId != null) diff --git a/lib/widgets/mxc_image.dart b/lib/widgets/mxc_image.dart index 70c558da9..1572fa6b9 100644 --- a/lib/widgets/mxc_image.dart +++ b/lib/widgets/mxc_image.dart @@ -26,6 +26,7 @@ class MxcImage extends StatefulWidget { final Widget Function(BuildContext context)? placeholder; final String? cacheKey; final Client? client; + final BorderRadius borderRadius; const MxcImage({ this.uri, @@ -42,6 +43,7 @@ class MxcImage extends StatefulWidget { this.thumbnailMethod = ThumbnailMethod.scale, this.cacheKey, this.client, + this.borderRadius = BorderRadius.zero, super.key, }); @@ -141,30 +143,34 @@ class _MxcImageState extends State { final hasData = data != null && data.isNotEmpty; return AnimatedSwitcher( - duration: const Duration(milliseconds: 128), + duration: FluffyThemes.animationDuration, child: hasData - ? Image.memory( - data, - width: widget.width, - height: widget.height, - fit: widget.fit, - filterQuality: - widget.isThumbnail ? FilterQuality.low : FilterQuality.medium, - errorBuilder: (context, e, s) { - Logs().d('Unable to render mxc image', e, s); - return SizedBox( - width: widget.width, - height: widget.height, - child: Material( - color: Theme.of(context).colorScheme.surfaceContainer, - child: Icon( - Icons.broken_image_outlined, - size: min(widget.height ?? 64, 64), - color: Theme.of(context).colorScheme.onSurface, + ? ClipRRect( + borderRadius: widget.borderRadius, + child: Image.memory( + data, + width: widget.width, + height: widget.height, + fit: widget.fit, + filterQuality: widget.isThumbnail + ? FilterQuality.low + : FilterQuality.medium, + errorBuilder: (context, e, s) { + Logs().d('Unable to render mxc image', e, s); + return SizedBox( + width: widget.width, + height: widget.height, + child: Material( + color: Theme.of(context).colorScheme.surfaceContainer, + child: Icon( + Icons.broken_image_outlined, + size: min(widget.height ?? 64, 64), + color: Theme.of(context).colorScheme.onSurface, + ), ), - ), - ); - }, + ); + }, + ), ) : placeholder(context), ); From ce6915450d7244449bfcc4781fd7e9f2e979d18b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 07:14:36 +0000 Subject: [PATCH 3/3] build: (deps): bump image_picker from 1.1.2 to 1.2.0 Bumps [image_picker](https://github.com/flutter/packages/tree/main/packages/image_picker) from 1.1.2 to 1.2.0. - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/image_picker-v1.2.0/packages/image_picker) --- updated-dependencies: - dependency-name: image_picker dependency-version: 1.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pubspec.lock | 32 ++++++++++++++++---------------- pubspec.yaml | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 48798ef51..516afab4e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -950,66 +950,66 @@ packages: dependency: "direct main" description: name: image_picker - sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" + sha256: "736eb56a911cf24d1859315ad09ddec0b66104bc41a7f8c5b96b4e2620cf5041" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "317a5d961cec5b34e777b9252393f2afbd23084aa6e60fcf601dcf6341b9ebeb" + sha256: e83b2b05141469c5e19d77e1dfa11096b6b1567d09065b2265d7c6904560050c url: "https://pub.dev" source: hosted - version: "0.8.12+23" + version: "0.8.13" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83" + sha256: "40c2a6a0da15556dc0f8e38a3246064a971a9f512386c3339b89f76db87269b6" url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.1.0" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "05da758e67bc7839e886b3959848aa6b44ff123ab4b28f67891008afe8ef9100" + sha256: eb06fe30bab4c4497bad449b66448f50edcc695f1c59408e78aa3a8059eb8f0e url: "https://pub.dev" source: hosted - version: "0.8.12+2" + version: "0.8.13" image_picker_linux: dependency: transitive description: name: image_picker_linux - sha256: "34a65f6740df08bbbeb0a1abd8e6d32107941fd4868f67a507b25601651022c9" + sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4" url: "https://pub.dev" source: hosted - version: "0.2.1+2" + version: "0.2.2" image_picker_macos: dependency: transitive description: name: image_picker_macos - sha256: "1b90ebbd9dcf98fb6c1d01427e49a55bd96b5d67b8c67cf955d60a5de74207c1" + sha256: d58cd9d67793d52beefd6585b12050af0a7663c0c2a6ece0fb110a35d6955e04 url: "https://pub.dev" source: hosted - version: "0.2.1+2" + version: "0.2.2" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - sha256: "886d57f0be73c4b140004e78b9f28a8914a09e50c2d816bdd0520051a71236a0" + sha256: "9f143b0dba3e459553209e20cc425c9801af48e6dfa4f01a0fcf927be3f41665" url: "https://pub.dev" source: hosted - version: "2.10.1" + version: "2.11.0" image_picker_windows: dependency: transitive description: name: image_picker_windows - sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae url: "https://pub.dev" source: hosted - version: "0.2.1+1" + version: "0.2.2" import_sorter: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index e2307c1d4..8170d4939 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,7 +52,7 @@ dependencies: html: ^0.15.4 http: ^1.5.0 image: ^4.1.7 - image_picker: ^1.1.0 + image_picker: ^1.2.0 intl: any just_audio: ^0.10.4 latlong2: ^0.9.1