chore: Follow up user dialog theme

pull/1778/head
krille-chan 6 months ago
parent 7209f20235
commit ceeb262a55
No known key found for this signature in database

@ -32,10 +32,10 @@ class AdaptiveDialogAction extends StatelessWidget {
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: autofocus backgroundColor: autofocus
? theme.colorScheme.primary ? theme.colorScheme.primary
: theme.colorScheme.primaryContainer, : theme.colorScheme.surfaceBright,
foregroundColor: autofocus foregroundColor: autofocus
? theme.colorScheme.onPrimary ? theme.colorScheme.onPrimary
: theme.colorScheme.onPrimaryContainer, : theme.colorScheme.primary,
), ),
onPressed: onPressed, onPressed: onPressed,
autofocus: autofocus, autofocus: autofocus,

@ -41,32 +41,35 @@ void showMemberActionsPopupMenu({
items: <PopupMenuEntry<_MemberActions>>[ items: <PopupMenuEntry<_MemberActions>>[
PopupMenuItem( PopupMenuItem(
value: _MemberActions.info, value: _MemberActions.info,
child: Center( child: Padding(
child: Column( padding: const EdgeInsets.symmetric(vertical: 8.0),
mainAxisSize: MainAxisSize.min, child: Center(
children: [ child: Column(
Avatar( mainAxisSize: MainAxisSize.min,
name: displayname, children: [
mxContent: user.avatarUrl, Avatar(
presenceUserId: user.id, name: displayname,
presenceBackgroundColor: theme.colorScheme.surfaceContainer, mxContent: user.avatarUrl,
), presenceUserId: user.id,
const SizedBox(height: 8), presenceBackgroundColor: theme.colorScheme.surfaceContainer,
Text( ),
displayname, const SizedBox(height: 8),
textAlign: TextAlign.center, Text(
style: theme.textTheme.labelLarge, displayname,
maxLines: 1, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, style: theme.textTheme.labelLarge,
), maxLines: 1,
Text( overflow: TextOverflow.ellipsis,
user.id, ),
textAlign: TextAlign.center, Text(
style: const TextStyle(fontSize: 10), user.id,
maxLines: 1, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, style: const TextStyle(fontSize: 10),
), maxLines: 1,
], overflow: TextOverflow.ellipsis,
),
],
),
), ),
), ),
), ),
@ -74,85 +77,99 @@ void showMemberActionsPopupMenu({
if (onMention != null) if (onMention != null)
PopupMenuItem( PopupMenuItem(
value: _MemberActions.mention, value: _MemberActions.mention,
child: ListTile( child: Row(
leading: const Icon(Icons.alternate_email_outlined), children: [
title: Text(L10n.of(context).mention), const Icon(Icons.alternate_email_outlined),
const SizedBox(width: 18),
Text(L10n.of(context).mention),
],
), ),
), ),
PopupMenuItem( PopupMenuItem(
enabled: user.room.canChangePowerLevel && user.canChangeUserPowerLevel, enabled: user.room.canChangePowerLevel && user.canChangeUserPowerLevel,
value: _MemberActions.setRole, value: _MemberActions.setRole,
child: ListTile( child: Row(
leading: const Icon(Icons.admin_panel_settings_outlined), children: [
title: Text(L10n.of(context).chatPermissions), const Icon(Icons.admin_panel_settings_outlined),
subtitle: Text( const SizedBox(width: 18),
user.powerLevel < 50 Column(
? L10n.of(context).userLevel(user.powerLevel) mainAxisSize: MainAxisSize.min,
: user.powerLevel < 100 crossAxisAlignment: CrossAxisAlignment.start,
? L10n.of(context).moderatorLevel(user.powerLevel) children: [
: L10n.of(context).adminLevel(user.powerLevel), Text(L10n.of(context).chatPermissions),
style: const TextStyle(fontSize: 10), Text(
), user.powerLevel < 50
? L10n.of(context).userLevel(user.powerLevel)
: user.powerLevel < 100
? L10n.of(context).moderatorLevel(user.powerLevel)
: L10n.of(context).adminLevel(user.powerLevel),
style: const TextStyle(fontSize: 10),
),
],
),
],
), ),
), ),
if (user.canKick) if (user.canKick)
PopupMenuItem( PopupMenuItem(
value: _MemberActions.kick, value: _MemberActions.kick,
child: ListTile( child: Row(
leading: Icon( children: [
Icons.person_remove_outlined, Icon(
color: theme.colorScheme.onErrorContainer, Icons.person_remove_outlined,
), color: theme.colorScheme.onErrorContainer,
title: Text( ),
L10n.of(context).kickFromChat, const SizedBox(width: 18),
style: TextStyle(color: theme.colorScheme.onErrorContainer), Text(
), L10n.of(context).kickFromChat,
style: TextStyle(color: theme.colorScheme.onErrorContainer),
),
],
), ),
), ),
if (user.canBan) if (user.canBan)
PopupMenuItem( PopupMenuItem(
value: _MemberActions.ban, value: _MemberActions.ban,
child: ListTile( child: Row(
leading: Icon( children: [
Icons.block_outlined, Icon(
color: theme.colorScheme.onErrorContainer, Icons.block_outlined,
), color: theme.colorScheme.onErrorContainer,
title: Text( ),
L10n.of(context).banFromChat, const SizedBox(width: 18),
style: TextStyle(color: theme.colorScheme.onErrorContainer), Text(
), L10n.of(context).banFromChat,
), style: TextStyle(color: theme.colorScheme.onErrorContainer),
), ),
if (user.canBan && user.membership == Membership.ban) ],
PopupMenuItem(
value: _MemberActions.ban,
child: ListTile(
leading: const Icon(Icons.warning),
title: Text(
L10n.of(context).unbanFromChat,
),
), ),
), ),
if (user.canBan && user.membership == Membership.ban) if (user.canBan && user.membership == Membership.ban)
PopupMenuItem( PopupMenuItem(
value: _MemberActions.unban, value: _MemberActions.unban,
child: ListTile( child: Row(
leading: const Icon(Icons.warning_outlined), children: [
title: Text(L10n.of(context).unbanFromChat), const Icon(Icons.warning),
const SizedBox(width: 18),
Text(L10n.of(context).unbanFromChat),
],
), ),
), ),
if (!isMe) if (!isMe)
PopupMenuItem( PopupMenuItem(
value: _MemberActions.report, value: _MemberActions.report,
child: ListTile( child: Row(
leading: Icon( children: [
Icons.gavel_outlined, Icon(
color: theme.colorScheme.onErrorContainer, Icons.gavel_outlined,
), color: theme.colorScheme.onErrorContainer,
title: Text( ),
L10n.of(context).reportUser, const SizedBox(width: 18),
style: TextStyle(color: theme.colorScheme.onErrorContainer), Text(
), L10n.of(context).reportUser,
style: TextStyle(color: theme.colorScheme.onErrorContainer),
),
],
), ),
), ),
], ],
@ -219,32 +236,10 @@ void showMemberActionsPopupMenu({
} }
return; return;
case _MemberActions.report: case _MemberActions.report:
final score = await showModalActionPopup<int>(
context: context,
title: L10n.of(context).reportUser,
message: L10n.of(context).howOffensiveIsThisContent,
cancelLabel: L10n.of(context).cancel,
actions: [
AdaptiveModalAction(
value: -100,
label: L10n.of(context).extremeOffensive,
),
AdaptiveModalAction(
value: -50,
label: L10n.of(context).offensive,
),
AdaptiveModalAction(
value: 0,
label: L10n.of(context).inoffensive,
),
],
);
if (score == null) return;
final reason = await showTextInputDialog( final reason = await showTextInputDialog(
useRootNavigator: false,
context: context, context: context,
title: L10n.of(context).whyDoYouWantToReportThis, title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context).ok, okLabel: L10n.of(context).report,
cancelLabel: L10n.of(context).cancel, cancelLabel: L10n.of(context).cancel,
hintText: L10n.of(context).reason, hintText: L10n.of(context).reason,
); );
@ -252,11 +247,9 @@ void showMemberActionsPopupMenu({
final result = await showFutureLoadingDialog( final result = await showFutureLoadingDialog(
context: context, context: context,
future: () => user.room.client.reportEvent( future: () => user.room.client.reportUser(
user.room.id,
user.id, user.id,
reason: reason, reason,
score: score,
), ),
); );
if (result.error != null) return; if (result.error != null) return;

Loading…
Cancel
Save