mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 12:25:11 +00:00
fix: Workaround for flutter cannot wait on navigator push
This commit is contained in:
parent
76ab8c6d1a
commit
73038ad5d1
1 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
|
|||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/widgets/permission_slider_dialog.dart';
|
||||
import '../../widgets/matrix.dart';
|
||||
import 'user_bottom_sheet_view.dart';
|
||||
|
@ -225,19 +226,24 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
}
|
||||
break;
|
||||
case UserBottomSheetAction.message:
|
||||
Navigator.of(context).pop();
|
||||
// Workaround for https://github.com/flutter/flutter/issues/27495
|
||||
await Future.delayed(FluffyThemes.animationDuration);
|
||||
|
||||
final roomIdResult = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
context: widget.outerContext,
|
||||
future: () => Matrix.of(widget.outerContext)
|
||||
.client
|
||||
.startDirectChat(user?.id ?? widget.profile!.userId),
|
||||
);
|
||||
final roomId = roomIdResult.result;
|
||||
if (roomId == null) return;
|
||||
Navigator.of(context).pop();
|
||||
widget.outerContext.go('/rooms/$roomId');
|
||||
break;
|
||||
case UserBottomSheetAction.ignore:
|
||||
Navigator.of(context).pop();
|
||||
// Workaround for https://github.com/flutter/flutter/issues/27495
|
||||
await Future.delayed(FluffyThemes.animationDuration);
|
||||
final userId = user?.id ?? widget.profile?.userId;
|
||||
widget.outerContext
|
||||
.go('/rooms/settings/security/ignorelist', extra: userId);
|
||||
|
|
Loading…
Reference in a new issue