From 9e0acdfd5fc274973d0b9dbed19db971de17e081 Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 11 Aug 2023 08:28:34 +0200 Subject: [PATCH] chore: Follow up user bottom sheet --- .../user_bottom_sheet_view.dart | 16 +++++++++++++--- lib/utils/fluffy_share.dart | 8 ++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart b/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart index 12e0525c..b2a8e0f5 100644 --- a/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart +++ b/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart @@ -85,7 +85,10 @@ class UserBottomSheetView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ TextButton.icon( - onPressed: () => FluffyShare.share(userId, context), + onPressed: () => FluffyShare.share( + 'https://matrix.to/#/$userId}', + context, + ), icon: Icon( Icons.adaptive.share_outlined, size: 16, @@ -102,7 +105,11 @@ class UserBottomSheetView extends StatelessWidget { ), ), TextButton.icon( - onPressed: () => FluffyShare.share(userId, context), + onPressed: () => FluffyShare.share( + userId, + context, + copyOnly: true, + ), icon: const Icon( Icons.copy_outlined, size: 14, @@ -125,7 +132,10 @@ class UserBottomSheetView extends StatelessWidget { ), if (userId != client.userID) Padding( - padding: const EdgeInsets.all(12.0), + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, + ), child: ElevatedButton.icon( onPressed: () => controller .participantAction(UserBottomSheetAction.message), diff --git a/lib/utils/fluffy_share.dart b/lib/utils/fluffy_share.dart index b5f1321b..9e7c1af0 100644 --- a/lib/utils/fluffy_share.dart +++ b/lib/utils/fluffy_share.dart @@ -7,8 +7,12 @@ import 'package:share_plus/share_plus.dart'; import 'package:fluffychat/utils/platform_infos.dart'; abstract class FluffyShare { - static Future share(String text, BuildContext context) async { - if (PlatformInfos.isMobile) { + static Future share( + String text, + BuildContext context, { + bool copyOnly = false, + }) async { + if (PlatformInfos.isMobile && !copyOnly) { final box = context.findRenderObject() as RenderBox; return Share.share( text,