diff --git a/assets/l10n/intl_de.arb b/assets/l10n/intl_de.arb index 93d6c4185..2373b118e 100644 --- a/assets/l10n/intl_de.arb +++ b/assets/l10n/intl_de.arb @@ -950,7 +950,7 @@ "type": "text", "placeholders": {} }, - "inviteText": "{username} hat Dich zu FluffyChat eingeladen. \n1. Installiere FluffyChat: https://fluffychat.im \n2. Melde Dich in der App an \n3. Öffne den Einladungslink: {link}", + "inviteText": "{username} hat Dich zu FluffyChat eingeladen. \n1. Gehe auf fluffychat.im und installiere die App \n2. Melde Dich in der App an \n3. Öffne den Einladungslink: \n {link}", "@inviteText": { "type": "text", "placeholders": { diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 17a34c734..b1a5ea0c1 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -633,11 +633,7 @@ "username": {} } }, - "createNewGroup": "Create new group", - "@createNewGroup": { - "type": "text", - "placeholders": {} - }, + "createGroup": "Create group", "createNewSpace": "New space", "@createNewSpace": { "type": "text", @@ -1071,7 +1067,7 @@ "type": "text", "placeholders": {} }, - "inviteText": "{username} invited you to FluffyChat. \n1. Install FluffyChat: https://fluffychat.im \n2. Sign up or sign in \n3. Open the invite link: {link}", + "inviteText": "{username} invited you to FluffyChat.\n1. Visit fluffychat.im and install the app \n2. Sign up or sign in \n3. Open the invite link: \n {link}", "@inviteText": { "type": "text", "placeholders": { @@ -1303,8 +1299,7 @@ "server2": {} } }, - "shareYourInviteLink": "Share your invite link", - "@shareYourInviteLink": {}, + "shareInviteLink": "Share invite link", "scanQrCode": "Scan QR code", "@scanQrCode": {}, "none": "None", diff --git a/lib/pages/chat/events/message_content.dart b/lib/pages/chat/events/message_content.dart index 6098a9ecc..662e34397 100644 --- a/lib/pages/chat/events/message_content.dart +++ b/lib/pages/chat/events/message_content.dart @@ -164,6 +164,7 @@ class MessageContent extends StatelessWidget { onPressed: () => _verifyOrRequestKey(context), icon: const Icon(Icons.lock_outline), label: L10n.of(context)!.encrypted, + fontSize: fontSize, ); case MessageTypes.Location: final geoUri = @@ -215,6 +216,7 @@ class MessageContent extends StatelessWidget { icon: const Icon(Icons.delete_outlined), textColor: buttonTextColor, onPressed: () => onInfoTab!(event), + fontSize: fontSize, ); }, ); @@ -264,6 +266,7 @@ class MessageContent extends StatelessWidget { icon: const Icon(Icons.phone_outlined), textColor: buttonTextColor, onPressed: () => onInfoTab!(event), + fontSize: fontSize, ); }, ); @@ -280,6 +283,7 @@ class MessageContent extends StatelessWidget { icon: const Icon(Icons.info_outlined), textColor: buttonTextColor, onPressed: () => onInfoTab!(event), + fontSize: fontSize, ); }, ); @@ -292,24 +296,35 @@ class _ButtonContent extends StatelessWidget { final String label; final Icon icon; final Color? textColor; + final double fontSize; const _ButtonContent({ required this.label, required this.icon, required this.textColor, required this.onPressed, + required this.fontSize, Key? key, }) : super(key: key); @override Widget build(BuildContext context) { - return TextButton.icon( - onPressed: onPressed, - icon: icon, - label: Text(label, overflow: TextOverflow.ellipsis), - style: TextButton.styleFrom( - foregroundColor: textColor, - textStyle: const TextStyle(fontWeight: FontWeight.bold), + return InkWell( + onTap: onPressed, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + icon, + const SizedBox(width: 8), + Text( + label, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: textColor, + fontSize: fontSize, + ), + ), + ], ), ); } diff --git a/lib/pages/chat_list/chat_list_header.dart b/lib/pages/chat_list/chat_list_header.dart index 473ca28c1..51f68f96a 100644 --- a/lib/pages/chat_list/chat_list_header.dart +++ b/lib/pages/chat_list/chat_list_header.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; -import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/chat_list/client_chooser_button.dart'; @@ -48,10 +47,10 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { textInputAction: TextInputAction.search, onChanged: controller.onSearchEnter, decoration: InputDecoration( + fillColor: Theme.of(context).colorScheme.secondaryContainer, border: UnderlineInputBorder( borderSide: BorderSide.none, - borderRadius: - BorderRadius.circular(AppConfig.borderRadius), + borderRadius: BorderRadius.circular(99), ), hintText: L10n.of(context)!.search, floatingLabelBehavior: FloatingLabelBehavior.never, diff --git a/lib/pages/chat_list/client_chooser_button.dart b/lib/pages/chat_list/client_chooser_button.dart index cc020142d..467835771 100644 --- a/lib/pages/chat_list/client_chooser_button.dart +++ b/lib/pages/chat_list/client_chooser_button.dart @@ -44,7 +44,7 @@ class ClientChooserButton extends StatelessWidget { children: [ const Icon(Icons.group_add_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.createNewGroup), + Text(L10n.of(context)!.createGroup), ], ), ), @@ -221,7 +221,7 @@ class ClientChooserButton extends StatelessWidget { mxContent: snapshot.data?.avatarUrl, name: snapshot.data?.displayName ?? matrix.client.userID!.localpart, - size: 28, + size: 32, fontSize: 12, ), ), @@ -273,13 +273,7 @@ class ClientChooserButton extends StatelessWidget { context.go('/rooms/newspace'); break; case SettingsAction.invite: - FluffyShare.share( - L10n.of(context)!.inviteText( - Matrix.of(context).client.userID!, - 'https://matrix.to/#/${Matrix.of(context).client.userID}?client=im.fluffychat', - ), - context, - ); + FluffyShare.shareInviteLink(context); break; case SettingsAction.settings: context.go('/rooms/settings'); diff --git a/lib/pages/new_group/new_group_view.dart b/lib/pages/new_group/new_group_view.dart index 7aec730ad..7b8dd7b1c 100644 --- a/lib/pages/new_group/new_group_view.dart +++ b/lib/pages/new_group/new_group_view.dart @@ -14,7 +14,7 @@ class NewGroupView extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.createNewGroup), + title: Text(L10n.of(context)!.createGroup), ), body: MaxWidthBody( child: Column( diff --git a/lib/pages/new_private_chat/new_private_chat.dart b/lib/pages/new_private_chat/new_private_chat.dart index 59cd8bd45..179d4aab1 100644 --- a/lib/pages/new_private_chat/new_private_chat.dart +++ b/lib/pages/new_private_chat/new_private_chat.dart @@ -57,10 +57,7 @@ class NewPrivateChatController extends State { return null; } - void inviteAction() => FluffyShare.share( - 'https://matrix.to/#/${Matrix.of(context).client.userID}', - context, - ); + void inviteAction() => FluffyShare.shareInviteLink(context); void openScannerAction() async { if (PlatformInfos.isAndroid) { diff --git a/lib/pages/new_private_chat/new_private_chat_view.dart b/lib/pages/new_private_chat/new_private_chat_view.dart index b5d49cc93..69ea5b4bc 100644 --- a/lib/pages/new_private_chat/new_private_chat_view.dart +++ b/lib/pages/new_private_chat/new_private_chat_view.dart @@ -33,7 +33,7 @@ class NewPrivateChatView extends StatelessWidget { child: TextButton( onPressed: () => context.go('/rooms/newgroup'), child: Text( - L10n.of(context)!.createNewGroup, + L10n.of(context)!.createGroup, style: TextStyle(color: Theme.of(context).colorScheme.secondary), ), @@ -72,7 +72,7 @@ class NewPrivateChatView extends StatelessWidget { foregroundColor: Colors.black, ), icon: Icon(Icons.adaptive.share_outlined), - label: Text(L10n.of(context)!.shareYourInviteLink), + label: Text(L10n.of(context)!.shareInviteLink), onPressed: controller.inviteAction, ), const SizedBox(height: 8), diff --git a/lib/utils/fluffy_share.dart b/lib/utils/fluffy_share.dart index 9e7c1af0c..92f60b1dd 100644 --- a/lib/utils/fluffy_share.dart +++ b/lib/utils/fluffy_share.dart @@ -5,6 +5,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:share_plus/share_plus.dart'; import 'package:fluffychat/utils/platform_infos.dart'; +import '../widgets/matrix.dart'; abstract class FluffyShare { static Future share( @@ -27,4 +28,16 @@ abstract class FluffyShare { ); return; } + + static Future shareInviteLink(BuildContext context) async { + final client = Matrix.of(context).client; + final ownProfile = await client.fetchOwnProfile(); + await FluffyShare.share( + L10n.of(context)!.inviteText( + ownProfile.displayName ?? client.userID!, + 'https://matrix.to/#/${client.userID}?client=im.fluffychat', + ), + context, + ); + } } diff --git a/lib/utils/platform_infos.dart b/lib/utils/platform_infos.dart index e7a0c84c3..b96104df4 100644 --- a/lib/utils/platform_infos.dart +++ b/lib/utils/platform_infos.dart @@ -59,11 +59,11 @@ abstract class PlatformInfos { label: const Text(AppConfig.emojiFontName), ), Builder( - builder: (context) { + builder: (innerContext) { return TextButton.icon( onPressed: () { - Navigator.of(context).pop(); context.go('/logs'); + Navigator.of(innerContext).pop(); }, icon: const Icon(Icons.list_outlined), label: const Text('Logs'),