mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 12:25:11 +00:00
fix: Userbottomsheet crash on some edge cases
This commit is contained in:
parent
c6007a3c3d
commit
efb26622ac
5 changed files with 21 additions and 26 deletions
|
@ -2563,5 +2563,6 @@
|
|||
"groupName": "Group name",
|
||||
"createGroupAndInviteUsers": "Create a group and invite users",
|
||||
"groupCanBeFoundViaSearch": "Group can be found via search",
|
||||
"wrongRecoveryKey": "Sorry... this does not seem to be the correct recovery key."
|
||||
"wrongRecoveryKey": "Sorry... this does not seem to be the correct recovery key.",
|
||||
"startConversation": "Start conversation"
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
break;
|
||||
case UserBottomSheetAction.mention:
|
||||
if (user == null) throw ('User must not be null for this action!');
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
Navigator.of(context).pop();
|
||||
widget.onMention!();
|
||||
break;
|
||||
case UserBottomSheetAction.ban:
|
||||
|
@ -161,7 +161,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
context: context,
|
||||
future: () => user.ban(),
|
||||
);
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
break;
|
||||
case UserBottomSheetAction.unban:
|
||||
|
@ -179,7 +179,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
context: context,
|
||||
future: () => user.unban(),
|
||||
);
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
break;
|
||||
case UserBottomSheetAction.kick:
|
||||
|
@ -197,7 +197,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
context: context,
|
||||
future: () => user.kick(),
|
||||
);
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
break;
|
||||
case UserBottomSheetAction.permission:
|
||||
|
@ -221,7 +221,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
context: context,
|
||||
future: () => user.setPower(newPermission),
|
||||
);
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
break;
|
||||
case UserBottomSheetAction.message:
|
||||
|
@ -231,12 +231,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
.client
|
||||
.startDirectChat(user?.id ?? widget.profile!.userId),
|
||||
);
|
||||
if (roomIdResult.error != null) return;
|
||||
widget.outerContext.go('/rooms/${roomIdResult.result!}');
|
||||
Navigator.of(context, rootNavigator: false)
|
||||
..pop()
|
||||
..pop();
|
||||
widget.outerContext.go('/rooms/${roomIdResult.result!}');
|
||||
final roomId = roomIdResult.result;
|
||||
if (roomId == null) return;
|
||||
Navigator.of(context).pop();
|
||||
widget.outerContext.go('/rooms/$roomId');
|
||||
break;
|
||||
case UserBottomSheetAction.ignore:
|
||||
context.go('/rooms/settings/security/ignorelist');
|
||||
|
|
|
@ -90,18 +90,9 @@ class UserBottomSheetView extends StatelessWidget {
|
|||
if (userId != client.userID &&
|
||||
!client.ignoredUsers.contains(userId))
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: OutlinedButton.icon(
|
||||
label: Text(
|
||||
L10n.of(context)!.ignore,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
icon: Icon(
|
||||
Icons.shield_outlined,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.block_outlined),
|
||||
onPressed: () => controller
|
||||
.participantAction(UserBottomSheetAction.ignore),
|
||||
),
|
||||
|
@ -196,7 +187,11 @@ class UserBottomSheetView extends StatelessWidget {
|
|||
onPressed: () => controller
|
||||
.participantAction(UserBottomSheetAction.message),
|
||||
icon: const Icon(Icons.forum_outlined),
|
||||
label: Text(L10n.of(context)!.sendAMessage),
|
||||
label: Text(
|
||||
controller.widget.user == null
|
||||
? L10n.of(context)!.startConversation
|
||||
: L10n.of(context)!.sendAMessage,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (controller.widget.onMention != null)
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:io';
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:desktop_notifications/desktop_notifications.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
|
Loading…
Reference in a new issue