Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added modal bottom sheet that shows list of users and their reaction #1283

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion lib/widgets/emoji_reaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'color.dart';
import 'dialog.dart';
import 'emoji.dart';
import 'inset_shadow.dart';
import 'reaction_users_sheet.dart';
import 'store.dart';
import 'text.dart';
import 'theme.dart';
Expand Down Expand Up @@ -120,6 +121,22 @@ class ReactionChipsList extends StatelessWidget {
final int messageId;
final Reactions reactions;

void showReactedUsers(BuildContext context, ReactionWithVotes selectedReaction) {
final store = PerAccountStoreWidget.of(context);

showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) => PerAccountStoreWidget(
accountId: store.accountId,
child: ReactionUsersSheet(
reactions: reactions,
initialSelectedReaction: selectedReaction,
store: store,
),
),
);
}

@override
Widget build(BuildContext context) {
final store = PerAccountStoreWidget.of(context);
Expand All @@ -129,7 +146,9 @@ class ReactionChipsList extends StatelessWidget {
return Wrap(spacing: 4, runSpacing: 4, crossAxisAlignment: WrapCrossAlignment.center,
children: reactions.aggregated.map((reactionVotes) => ReactionChip(
showName: showNames,
messageId: messageId, reactionWithVotes: reactionVotes),
messageId: messageId, reactionWithVotes: reactionVotes,
showReactedUsers: showReactedUsers,
),
).toList());
}
}
Expand All @@ -138,12 +157,14 @@ class ReactionChip extends StatelessWidget {
final bool showName;
final int messageId;
final ReactionWithVotes reactionWithVotes;
final void Function(BuildContext, ReactionWithVotes) showReactedUsers;

const ReactionChip({
super.key,
required this.showName,
required this.messageId,
required this.reactionWithVotes,
required this.showReactedUsers,
});

@override
Expand Down Expand Up @@ -214,6 +235,9 @@ class ReactionChip extends StatelessWidget {
emojiName: emojiName,
);
},
onLongPress: () {
showReactedUsers(context, reactionWithVotes);
},
child: Padding(
// 1px of this padding accounts for the border, which Flutter
// just paints without changing size.
Expand Down
Loading