mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
fix: UserBottomSheet
This commit is contained in:
parent
5f0ce49c46
commit
38e8e1bce1
@ -27,8 +27,9 @@ class ParticipantListItem extends StatelessWidget {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () => showModalBottomSheet(
|
onTap: () => showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => UserBottomSheet(
|
builder: (c) => UserBottomSheet(
|
||||||
user: user,
|
user: user,
|
||||||
|
l10n: L10n.of(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
|
@ -17,14 +17,19 @@ import 'dialogs/key_verification_dialog.dart';
|
|||||||
class UserBottomSheet extends StatelessWidget {
|
class UserBottomSheet extends StatelessWidget {
|
||||||
final User user;
|
final User user;
|
||||||
final Function onMention;
|
final Function onMention;
|
||||||
|
final L10n l10n;
|
||||||
|
|
||||||
const UserBottomSheet({Key key, @required this.user, this.onMention})
|
const UserBottomSheet({
|
||||||
: super(key: key);
|
Key key,
|
||||||
|
@required this.user,
|
||||||
|
@required this.l10n,
|
||||||
|
this.onMention,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
void participantAction(BuildContext context, String action) async {
|
void participantAction(BuildContext context, String action) async {
|
||||||
final Function _askConfirmation = () async =>
|
final Function _askConfirmation = () async =>
|
||||||
(await showOkCancelAlertDialog(
|
(await showOkCancelAlertDialog(
|
||||||
context: context, title: L10n.of(context).areYouSure) ==
|
context: context, title: l10n.areYouSure) ==
|
||||||
OkCancelResult.ok);
|
OkCancelResult.ok);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'mention':
|
case 'mention':
|
||||||
@ -83,7 +88,10 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
void _verifyAction(BuildContext context) async {
|
void _verifyAction(BuildContext context) async {
|
||||||
final client = user.room.client;
|
final client = user.room.client;
|
||||||
final req = await client.userDeviceKeys[user.id].startVerification();
|
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
|
@override
|
||||||
@ -97,7 +105,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
items.add(
|
items.add(
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: _TextWithIcon(
|
child: _TextWithIcon(
|
||||||
L10n.of(context).mention,
|
l10n.mention,
|
||||||
Icons.alternate_email_outlined,
|
Icons.alternate_email_outlined,
|
||||||
),
|
),
|
||||||
value: 'mention'),
|
value: 'mention'),
|
||||||
@ -107,7 +115,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
items.add(
|
items.add(
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: _TextWithIcon(
|
child: _TextWithIcon(
|
||||||
L10n.of(context).sendAMessage,
|
l10n.sendAMessage,
|
||||||
Icons.send_outlined,
|
Icons.send_outlined,
|
||||||
),
|
),
|
||||||
value: 'message'),
|
value: 'message'),
|
||||||
@ -117,7 +125,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
items.add(
|
items.add(
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: _TextWithIcon(
|
child: _TextWithIcon(
|
||||||
L10n.of(context).setPermissionsLevel,
|
l10n.setPermissionsLevel,
|
||||||
Icons.edit_attributes_outlined,
|
Icons.edit_attributes_outlined,
|
||||||
),
|
),
|
||||||
value: 'permission'),
|
value: 'permission'),
|
||||||
@ -127,7 +135,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
items.add(
|
items.add(
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: _TextWithIcon(
|
child: _TextWithIcon(
|
||||||
L10n.of(context).kickFromChat,
|
l10n.kickFromChat,
|
||||||
Icons.exit_to_app_outlined,
|
Icons.exit_to_app_outlined,
|
||||||
),
|
),
|
||||||
value: 'kick'),
|
value: 'kick'),
|
||||||
@ -137,7 +145,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
items.add(
|
items.add(
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: _TextWithIcon(
|
child: _TextWithIcon(
|
||||||
L10n.of(context).banFromChat,
|
l10n.banFromChat,
|
||||||
Icons.warning_sharp,
|
Icons.warning_sharp,
|
||||||
),
|
),
|
||||||
value: 'ban'),
|
value: 'ban'),
|
||||||
@ -146,7 +154,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
items.add(
|
items.add(
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: _TextWithIcon(
|
child: _TextWithIcon(
|
||||||
L10n.of(context).removeExile,
|
l10n.removeExile,
|
||||||
Icons.warning_outlined,
|
Icons.warning_outlined,
|
||||||
),
|
),
|
||||||
value: 'unban'),
|
value: 'unban'),
|
||||||
@ -203,7 +211,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(L10n.of(context).username),
|
title: Text(l10n.username),
|
||||||
subtitle: Text(user.id),
|
subtitle: Text(user.id),
|
||||||
trailing: Icon(Icons.share_outlined),
|
trailing: Icon(Icons.share_outlined),
|
||||||
onTap: () => FluffyShare.share(user.id, context),
|
onTap: () => FluffyShare.share(user.id, context),
|
||||||
|
@ -492,7 +492,8 @@ class _ChatState extends State<Chat> {
|
|||||||
onTap: room.isDirectChat
|
onTap: room.isDirectChat
|
||||||
? () => showModalBottomSheet(
|
? () => showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => UserBottomSheet(
|
builder: (c) => UserBottomSheet(
|
||||||
|
l10n: L10n.of(context),
|
||||||
user: room.getUserByMXIDSync(
|
user: room.getUserByMXIDSync(
|
||||||
room.directChatMatrixID),
|
room.directChatMatrixID),
|
||||||
onMention: () => sendController.text +=
|
onMention: () => sendController.text +=
|
||||||
@ -735,8 +736,9 @@ class _ChatState extends State<Chat> {
|
|||||||
onAvatarTab: (Event event) =>
|
onAvatarTab: (Event event) =>
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) =>
|
builder: (c) =>
|
||||||
UserBottomSheet(
|
UserBottomSheet(
|
||||||
|
l10n: L10n.of(context),
|
||||||
user: event.sender,
|
user: event.sender,
|
||||||
onMention: () =>
|
onMention: () =>
|
||||||
sendController.text +=
|
sendController.text +=
|
||||||
|
Loading…
Reference in New Issue
Block a user