Skip to content

Commit 54da4c1

Browse files
Added modal bottom sheet that shows list of users and their reactions on long pressing reactions
1 parent efcf201 commit 54da4c1

File tree

3 files changed

+1115
-1
lines changed

3 files changed

+1115
-1
lines changed

lib/widgets/emoji_reaction.dart

+25-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'color.dart';
1010
import 'dialog.dart';
1111
import 'emoji.dart';
1212
import 'inset_shadow.dart';
13+
import 'reaction_users_sheet.dart';
1314
import 'store.dart';
1415
import 'text.dart';
1516
import 'theme.dart';
@@ -120,6 +121,22 @@ class ReactionChipsList extends StatelessWidget {
120121
final int messageId;
121122
final Reactions reactions;
122123

124+
void showReactedUsers(BuildContext context, ReactionWithVotes selectedReaction) {
125+
final store = PerAccountStoreWidget.of(context);
126+
127+
showModalBottomSheet<void>(
128+
context: context,
129+
builder: (BuildContext context) => PerAccountStoreWidget(
130+
accountId: store.accountId,
131+
child: ReactionUsersSheet(
132+
reactions: reactions,
133+
initialSelectedReaction: selectedReaction,
134+
store: store,
135+
),
136+
),
137+
);
138+
}
139+
123140
@override
124141
Widget build(BuildContext context) {
125142
final store = PerAccountStoreWidget.of(context);
@@ -129,7 +146,9 @@ class ReactionChipsList extends StatelessWidget {
129146
return Wrap(spacing: 4, runSpacing: 4, crossAxisAlignment: WrapCrossAlignment.center,
130147
children: reactions.aggregated.map((reactionVotes) => ReactionChip(
131148
showName: showNames,
132-
messageId: messageId, reactionWithVotes: reactionVotes),
149+
messageId: messageId, reactionWithVotes: reactionVotes,
150+
showReactedUsers: showReactedUsers,
151+
),
133152
).toList());
134153
}
135154
}
@@ -138,12 +157,14 @@ class ReactionChip extends StatelessWidget {
138157
final bool showName;
139158
final int messageId;
140159
final ReactionWithVotes reactionWithVotes;
160+
final void Function(BuildContext, ReactionWithVotes) showReactedUsers;
141161

142162
const ReactionChip({
143163
super.key,
144164
required this.showName,
145165
required this.messageId,
146166
required this.reactionWithVotes,
167+
required this.showReactedUsers,
147168
});
148169

149170
@override
@@ -214,6 +235,9 @@ class ReactionChip extends StatelessWidget {
214235
emojiName: emojiName,
215236
);
216237
},
238+
onLongPress: () {
239+
showReactedUsers(context, reactionWithVotes);
240+
},
217241
child: Padding(
218242
// 1px of this padding accounts for the border, which Flutter
219243
// just paints without changing size.

0 commit comments

Comments
 (0)