diff --git a/lib/components/list_items/participant_list_item.dart b/lib/components/list_items/participant_list_item.dart index 278fb842..b27201ec 100644 --- a/lib/components/list_items/participant_list_item.dart +++ b/lib/components/list_items/participant_list_item.dart @@ -27,8 +27,9 @@ class ParticipantListItem extends StatelessWidget { return ListTile( onTap: () => showModalBottomSheet( context: context, - builder: (context) => UserBottomSheet( + builder: (c) => UserBottomSheet( user: user, + l10n: L10n.of(context), ), ), title: Row( diff --git a/lib/components/user_bottom_sheet.dart b/lib/components/user_bottom_sheet.dart index 448219c8..d1874435 100644 --- a/lib/components/user_bottom_sheet.dart +++ b/lib/components/user_bottom_sheet.dart @@ -17,14 +17,19 @@ import 'dialogs/key_verification_dialog.dart'; class UserBottomSheet extends StatelessWidget { final User user; final Function onMention; + final L10n l10n; - const UserBottomSheet({Key key, @required this.user, this.onMention}) - : super(key: key); + const UserBottomSheet({ + Key key, + @required this.user, + @required this.l10n, + this.onMention, + }) : super(key: key); void participantAction(BuildContext context, String action) async { final Function _askConfirmation = () async => (await showOkCancelAlertDialog( - context: context, title: L10n.of(context).areYouSure) == + context: context, title: l10n.areYouSure) == OkCancelResult.ok); switch (action) { case 'mention': @@ -83,7 +88,10 @@ class UserBottomSheet extends StatelessWidget { void _verifyAction(BuildContext context) async { final client = user.room.client; final req = await client.userDeviceKeys[user.id].startVerification(); - await KeyVerificationDialog(request: req,l10n: L10n.of(context),).show(context); + await KeyVerificationDialog( + request: req, + l10n: L10n.of(context), + ).show(context); } @override @@ -97,7 +105,7 @@ class UserBottomSheet extends StatelessWidget { items.add( PopupMenuItem( child: _TextWithIcon( - L10n.of(context).mention, + l10n.mention, Icons.alternate_email_outlined, ), value: 'mention'), @@ -107,7 +115,7 @@ class UserBottomSheet extends StatelessWidget { items.add( PopupMenuItem( child: _TextWithIcon( - L10n.of(context).sendAMessage, + l10n.sendAMessage, Icons.send_outlined, ), value: 'message'), @@ -117,7 +125,7 @@ class UserBottomSheet extends StatelessWidget { items.add( PopupMenuItem( child: _TextWithIcon( - L10n.of(context).setPermissionsLevel, + l10n.setPermissionsLevel, Icons.edit_attributes_outlined, ), value: 'permission'), @@ -127,7 +135,7 @@ class UserBottomSheet extends StatelessWidget { items.add( PopupMenuItem( child: _TextWithIcon( - L10n.of(context).kickFromChat, + l10n.kickFromChat, Icons.exit_to_app_outlined, ), value: 'kick'), @@ -137,7 +145,7 @@ class UserBottomSheet extends StatelessWidget { items.add( PopupMenuItem( child: _TextWithIcon( - L10n.of(context).banFromChat, + l10n.banFromChat, Icons.warning_sharp, ), value: 'ban'), @@ -146,7 +154,7 @@ class UserBottomSheet extends StatelessWidget { items.add( PopupMenuItem( child: _TextWithIcon( - L10n.of(context).removeExile, + l10n.removeExile, Icons.warning_outlined, ), value: 'unban'), @@ -203,7 +211,7 @@ class UserBottomSheet extends StatelessWidget { ), ), ListTile( - title: Text(L10n.of(context).username), + title: Text(l10n.username), subtitle: Text(user.id), trailing: Icon(Icons.share_outlined), onTap: () => FluffyShare.share(user.id, context), diff --git a/lib/views/chat.dart b/lib/views/chat.dart index 4a26d258..395a4b67 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -492,7 +492,8 @@ class _ChatState extends State { onTap: room.isDirectChat ? () => showModalBottomSheet( context: context, - builder: (context) => UserBottomSheet( + builder: (c) => UserBottomSheet( + l10n: L10n.of(context), user: room.getUserByMXIDSync( room.directChatMatrixID), onMention: () => sendController.text += @@ -735,8 +736,9 @@ class _ChatState extends State { onAvatarTab: (Event event) => showModalBottomSheet( context: context, - builder: (context) => + builder: (c) => UserBottomSheet( + l10n: L10n.of(context), user: event.sender, onMention: () => sendController.text +=