fix: UserBottomSheet

This commit is contained in:
Christian Pauly 2021-05-01 10:04:44 +02:00
parent 642db67709
commit dbb0464a2a
4 changed files with 9 additions and 2 deletions

View File

@ -81,6 +81,7 @@ class ChatUI extends StatelessWidget {
builder: (c) => UserBottomSheet( builder: (c) => UserBottomSheet(
user: controller.room.getUserByMXIDSync( user: controller.room.getUserByMXIDSync(
controller.room.directChatMatrixID), controller.room.directChatMatrixID),
outerContext: context,
onMention: () => controller onMention: () => controller
.sendController.text += .sendController.text +=
'${controller.room.directChatMatrixID} ', '${controller.room.directChatMatrixID} ',
@ -379,6 +380,7 @@ class ChatUI extends StatelessWidget {
builder: (c) => builder: (c) =>
UserBottomSheet( UserBottomSheet(
user: event.sender, user: event.sender,
outerContext: context,
onMention: () => controller onMention: () => controller
.sendController .sendController
.text += .text +=

View File

@ -110,7 +110,8 @@ class UserBottomSheetUI extends StatelessWidget {
title: Text(L10n.of(context).username), title: Text(L10n.of(context).username),
subtitle: Text(user.id), subtitle: Text(user.id),
trailing: Icon(Icons.share_outlined), trailing: Icon(Icons.share_outlined),
onTap: () => FluffyShare.share(user.id, context), onTap: () => FluffyShare.share(
user.id, controller.widget.outerContext),
), ),
if (presence != null) if (presence != null)
ListTile( ListTile(

View File

@ -12,10 +12,12 @@ import 'ui/user_bottom_sheet_ui.dart';
class UserBottomSheet extends StatefulWidget { class UserBottomSheet extends StatefulWidget {
final User user; final User user;
final Function onMention; final Function onMention;
final BuildContext outerContext;
const UserBottomSheet({ const UserBottomSheet({
Key key, Key key,
@required this.user, @required this.user,
@required this.outerContext,
this.onMention, this.onMention,
}) : super(key: key); }) : super(key: key);
@ -81,8 +83,9 @@ class UserBottomSheetController extends State<UserBottomSheet> {
break; break;
case 'message': case 'message':
final roomId = await widget.user.startDirectChat(); final roomId = await widget.user.startDirectChat();
await AdaptivePageLayout.of(context) await AdaptivePageLayout.of(widget.outerContext)
.pushNamedAndRemoveUntilIsFirst('/rooms/$roomId'); .pushNamedAndRemoveUntilIsFirst('/rooms/$roomId');
Navigator.of(context, rootNavigator: false).pop();
break; break;
} }
} }

View File

@ -29,6 +29,7 @@ class ParticipantListItem extends StatelessWidget {
context: context, context: context,
builder: (c) => UserBottomSheet( builder: (c) => UserBottomSheet(
user: user, user: user,
outerContext: context,
), ),
), ),
title: Row( title: Row(