chore: Follow up user viewer

This commit is contained in:
Christian Kußowski 2026-03-09 17:44:11 +01:00
parent 1e763f05f5
commit a2857ef36a
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 44 additions and 38 deletions

View file

@ -85,7 +85,7 @@ class AdaptiveDialogAction extends StatelessWidget {
class AdaptiveDialogInkWell extends StatelessWidget {
final Widget child;
final VoidCallback onTap;
final VoidCallback? onTap;
final EdgeInsets padding;
const AdaptiveDialogInkWell({
@ -125,7 +125,7 @@ class AdaptiveDialogInkWell extends StatelessWidget {
class AdaptiveIconTextButton extends StatelessWidget {
final String label;
final IconData icon;
final VoidCallback onTap;
final VoidCallback? onTap;
const AdaptiveIconTextButton({
super.key,
required this.label,

View file

@ -195,35 +195,39 @@ class UserDialog extends StatelessWidget {
AdaptiveIconTextButton(
label: L10n.of(context).block,
icon: Icons.block_outlined,
onTap: () {
final router = GoRouter.of(context);
Navigator.of(context).pop();
router.go(
'/rooms/settings/security/ignorelist',
extra: profile.userId,
);
},
onTap: client.userID == profile.userId
? null
: () {
final router = GoRouter.of(context);
Navigator.of(context).pop();
router.go(
'/rooms/settings/security/ignorelist',
extra: profile.userId,
);
},
),
AdaptiveIconTextButton(
label: L10n.of(context).report,
icon: Icons.gavel_outlined,
onTap: () async {
Navigator.of(context).pop();
final reason = await showTextInputDialog(
context: context,
title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context).report,
cancelLabel: L10n.of(context).cancel,
hintText: L10n.of(context).reason,
);
if (reason == null || reason.isEmpty) return;
await showFutureLoadingDialog(
context: context,
future: () => Matrix.of(
context,
).client.reportUser(profile.userId, reason),
);
},
onTap: client.userID == profile.userId
? null
: () async {
Navigator.of(context).pop();
final reason = await showTextInputDialog(
context: context,
title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context).report,
cancelLabel: L10n.of(context).cancel,
hintText: L10n.of(context).reason,
);
if (reason == null || reason.isEmpty) return;
await showFutureLoadingDialog(
context: context,
future: () => Matrix.of(
context,
).client.reportUser(profile.userId, reason),
);
},
),
AdaptiveIconTextButton(
label: L10n.of(context).share,
@ -236,17 +240,19 @@ class UserDialog extends StatelessWidget {
],
),
AdaptiveDialogInkWell(
onTap: () async {
final router = GoRouter.of(context);
final roomIdResult = await showFutureLoadingDialog(
context: context,
future: () => client.startDirectChat(profile.userId),
);
final roomId = roomIdResult.result;
if (roomId == null) return;
if (context.mounted) Navigator.of(context).pop();
router.go('/rooms/$roomId');
},
onTap: client.userID == profile.userId
? null
: () async {
final router = GoRouter.of(context);
final roomIdResult = await showFutureLoadingDialog(
context: context,
future: () => client.startDirectChat(profile.userId),
);
final roomId = roomIdResult.result;
if (roomId == null) return;
if (context.mounted) Navigator.of(context).pop();
router.go('/rooms/$roomId');
},
child: Text(
directChatRoomId == null
? L10n.of(context).createNewChat