Skip to content

Commit

Permalink
fix broken invitiation ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Airyzz committed Jun 28, 2024
1 parent 4a0b79e commit 391b3a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion commet/lib/ui/molecules/profile/mini_profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class MiniProfileView extends StatefulWidget {
{required this.client,
required this.userId,
this.initialProfile,
this.onTap,
super.key});
final Client client;
final String userId;
final Profile? initialProfile;
final void Function()? onTap;

@override
State<MiniProfileView> createState() => _MiniProfileViewState();
Expand Down Expand Up @@ -48,7 +50,7 @@ class _MiniProfileViewState extends State<MiniProfileView> {
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {},
onTap: widget.onTap,
child: Shimmer(
linearGradient: Shimmer.harshGradient,
child: ShimmerLoading(
Expand Down
16 changes: 10 additions & 6 deletions commet/lib/ui/organisms/invitation_view/send_invitation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class _SendInvitationWidgetState extends State<SendInvitationWidget> {
client: widget.component.client,
userId: searchResults![index].identifier,
initialProfile: searchResults![index],
onTap: () =>
invitePeer(searchResults![index].identifier),
);
},
)),
Expand All @@ -83,10 +85,12 @@ class _SendInvitationWidgetState extends State<SendInvitationWidget> {
itemCount: recommended.length,
itemBuilder: (context, index) {
var room = recommended[index];
var userId =
dmComponent!.getDirectMessagePartnerId(room)!;
return MiniProfileView(
client: room.client,
userId:
dmComponent!.getDirectMessagePartnerId(room)!);
onTap: () => invitePeer(userId),
userId: userId);
},
),
],
Expand Down Expand Up @@ -116,17 +120,17 @@ class _SendInvitationWidgetState extends State<SendInvitationWidget> {
});
}

void invitePeer(Peer peer) async {
void invitePeer(String userId) async {
final confirm = await AdaptiveDialog.confirmation(context,
prompt:
"Are you sure you want to Invite ${peer.identifier} to the room ${widget.room.displayName}?",
"Are you sure you want to Invite $userId to the room ${widget.room.displayName}?",
title: "Invitation");
if (confirm != true) {
return;
}

widget.component.inviteUserToRoom(
userId: peer.identifier, roomId: widget.room.identifier);
widget.component
.inviteUserToRoom(userId: userId, roomId: widget.room.identifier);

if (mounted) Navigator.pop(context);
}
Expand Down

0 comments on commit 391b3a6

Please sign in to comment.