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(
backgroundColor: autofocus
? theme.colorScheme.primary
: theme.colorScheme.primaryContainer,
: theme.colorScheme.surfaceBright,
foregroundColor: autofocus
? theme.colorScheme.onPrimary
: theme.colorScheme.onPrimaryContainer,
: theme.colorScheme.primary,
),
onPressed: onPressed,
autofocus: autofocus,

@ -41,6 +41,8 @@ void showMemberActionsPopupMenu({
items: <PopupMenuEntry<_MemberActions>>[
PopupMenuItem(
value: _MemberActions.info,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
@ -70,22 +72,32 @@ void showMemberActionsPopupMenu({
),
),
),
),
const PopupMenuDivider(),
if (onMention != null)
PopupMenuItem(
value: _MemberActions.mention,
child: ListTile(
leading: const Icon(Icons.alternate_email_outlined),
title: Text(L10n.of(context).mention),
child: Row(
children: [
const Icon(Icons.alternate_email_outlined),
const SizedBox(width: 18),
Text(L10n.of(context).mention),
],
),
),
PopupMenuItem(
enabled: user.room.canChangePowerLevel && user.canChangeUserPowerLevel,
value: _MemberActions.setRole,
child: ListTile(
leading: const Icon(Icons.admin_panel_settings_outlined),
title: Text(L10n.of(context).chatPermissions),
subtitle: Text(
child: Row(
children: [
const Icon(Icons.admin_panel_settings_outlined),
const SizedBox(width: 18),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(L10n.of(context).chatPermissions),
Text(
user.powerLevel < 50
? L10n.of(context).userLevel(user.powerLevel)
: user.powerLevel < 100
@ -93,66 +105,71 @@ void showMemberActionsPopupMenu({
: L10n.of(context).adminLevel(user.powerLevel),
style: const TextStyle(fontSize: 10),
),
],
),
],
),
),
if (user.canKick)
PopupMenuItem(
value: _MemberActions.kick,
child: ListTile(
leading: Icon(
child: Row(
children: [
Icon(
Icons.person_remove_outlined,
color: theme.colorScheme.onErrorContainer,
),
title: Text(
const SizedBox(width: 18),
Text(
L10n.of(context).kickFromChat,
style: TextStyle(color: theme.colorScheme.onErrorContainer),
),
],
),
),
if (user.canBan)
PopupMenuItem(
value: _MemberActions.ban,
child: ListTile(
leading: Icon(
child: Row(
children: [
Icon(
Icons.block_outlined,
color: theme.colorScheme.onErrorContainer,
),
title: Text(
const SizedBox(width: 18),
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)
PopupMenuItem(
value: _MemberActions.unban,
child: ListTile(
leading: const Icon(Icons.warning_outlined),
title: Text(L10n.of(context).unbanFromChat),
child: Row(
children: [
const Icon(Icons.warning),
const SizedBox(width: 18),
Text(L10n.of(context).unbanFromChat),
],
),
),
if (!isMe)
PopupMenuItem(
value: _MemberActions.report,
child: ListTile(
leading: Icon(
child: Row(
children: [
Icon(
Icons.gavel_outlined,
color: theme.colorScheme.onErrorContainer,
),
title: Text(
const SizedBox(width: 18),
Text(
L10n.of(context).reportUser,
style: TextStyle(color: theme.colorScheme.onErrorContainer),
),
],
),
),
],
@ -219,32 +236,10 @@ void showMemberActionsPopupMenu({
}
return;
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(
useRootNavigator: false,
context: context,
title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context).ok,
okLabel: L10n.of(context).report,
cancelLabel: L10n.of(context).cancel,
hintText: L10n.of(context).reason,
);
@ -252,11 +247,9 @@ void showMemberActionsPopupMenu({
final result = await showFutureLoadingDialog(
context: context,
future: () => user.room.client.reportEvent(
user.room.id,
future: () => user.room.client.reportUser(
user.id,
reason: reason,
score: score,
reason,
),
);
if (result.error != null) return;

Loading…
Cancel
Save