chore: Follow up user viewer
This commit is contained in:
parent
1e763f05f5
commit
a2857ef36a
2 changed files with 44 additions and 38 deletions
|
|
@ -85,7 +85,7 @@ class AdaptiveDialogAction extends StatelessWidget {
|
||||||
|
|
||||||
class AdaptiveDialogInkWell extends StatelessWidget {
|
class AdaptiveDialogInkWell extends StatelessWidget {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final VoidCallback onTap;
|
final VoidCallback? onTap;
|
||||||
final EdgeInsets padding;
|
final EdgeInsets padding;
|
||||||
|
|
||||||
const AdaptiveDialogInkWell({
|
const AdaptiveDialogInkWell({
|
||||||
|
|
@ -125,7 +125,7 @@ class AdaptiveDialogInkWell extends StatelessWidget {
|
||||||
class AdaptiveIconTextButton extends StatelessWidget {
|
class AdaptiveIconTextButton extends StatelessWidget {
|
||||||
final String label;
|
final String label;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final VoidCallback onTap;
|
final VoidCallback? onTap;
|
||||||
const AdaptiveIconTextButton({
|
const AdaptiveIconTextButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.label,
|
required this.label,
|
||||||
|
|
|
||||||
|
|
@ -195,35 +195,39 @@ class UserDialog extends StatelessWidget {
|
||||||
AdaptiveIconTextButton(
|
AdaptiveIconTextButton(
|
||||||
label: L10n.of(context).block,
|
label: L10n.of(context).block,
|
||||||
icon: Icons.block_outlined,
|
icon: Icons.block_outlined,
|
||||||
onTap: () {
|
onTap: client.userID == profile.userId
|
||||||
final router = GoRouter.of(context);
|
? null
|
||||||
Navigator.of(context).pop();
|
: () {
|
||||||
router.go(
|
final router = GoRouter.of(context);
|
||||||
'/rooms/settings/security/ignorelist',
|
Navigator.of(context).pop();
|
||||||
extra: profile.userId,
|
router.go(
|
||||||
);
|
'/rooms/settings/security/ignorelist',
|
||||||
},
|
extra: profile.userId,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
AdaptiveIconTextButton(
|
AdaptiveIconTextButton(
|
||||||
label: L10n.of(context).report,
|
label: L10n.of(context).report,
|
||||||
icon: Icons.gavel_outlined,
|
icon: Icons.gavel_outlined,
|
||||||
onTap: () async {
|
onTap: client.userID == profile.userId
|
||||||
Navigator.of(context).pop();
|
? null
|
||||||
final reason = await showTextInputDialog(
|
: () async {
|
||||||
context: context,
|
Navigator.of(context).pop();
|
||||||
title: L10n.of(context).whyDoYouWantToReportThis,
|
final reason = await showTextInputDialog(
|
||||||
okLabel: L10n.of(context).report,
|
context: context,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
title: L10n.of(context).whyDoYouWantToReportThis,
|
||||||
hintText: L10n.of(context).reason,
|
okLabel: L10n.of(context).report,
|
||||||
);
|
cancelLabel: L10n.of(context).cancel,
|
||||||
if (reason == null || reason.isEmpty) return;
|
hintText: L10n.of(context).reason,
|
||||||
await showFutureLoadingDialog(
|
);
|
||||||
context: context,
|
if (reason == null || reason.isEmpty) return;
|
||||||
future: () => Matrix.of(
|
await showFutureLoadingDialog(
|
||||||
context,
|
context: context,
|
||||||
).client.reportUser(profile.userId, reason),
|
future: () => Matrix.of(
|
||||||
);
|
context,
|
||||||
},
|
).client.reportUser(profile.userId, reason),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
AdaptiveIconTextButton(
|
AdaptiveIconTextButton(
|
||||||
label: L10n.of(context).share,
|
label: L10n.of(context).share,
|
||||||
|
|
@ -236,17 +240,19 @@ class UserDialog extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
AdaptiveDialogInkWell(
|
AdaptiveDialogInkWell(
|
||||||
onTap: () async {
|
onTap: client.userID == profile.userId
|
||||||
final router = GoRouter.of(context);
|
? null
|
||||||
final roomIdResult = await showFutureLoadingDialog(
|
: () async {
|
||||||
context: context,
|
final router = GoRouter.of(context);
|
||||||
future: () => client.startDirectChat(profile.userId),
|
final roomIdResult = await showFutureLoadingDialog(
|
||||||
);
|
context: context,
|
||||||
final roomId = roomIdResult.result;
|
future: () => client.startDirectChat(profile.userId),
|
||||||
if (roomId == null) return;
|
);
|
||||||
if (context.mounted) Navigator.of(context).pop();
|
final roomId = roomIdResult.result;
|
||||||
router.go('/rooms/$roomId');
|
if (roomId == null) return;
|
||||||
},
|
if (context.mounted) Navigator.of(context).pop();
|
||||||
|
router.go('/rooms/$roomId');
|
||||||
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
directChatRoomId == null
|
directChatRoomId == null
|
||||||
? L10n.of(context).createNewChat
|
? L10n.of(context).createNewChat
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue