Skip to content

fix(ui): added scrolling to reactions #2045

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

Open
wants to merge 3 commits into
base: master
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
6 changes: 6 additions & 0 deletions packages/stream_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Upcoming

🐞 Fixed

- Reactions now scroll if count is too high.

## 8.2.0

✅ Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,69 +57,72 @@
horizontal: 16,
vertical: 8,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: reactionIcons
.map<Widget>((reactionIcon) {
final ownReactionIndex =
widget.message.ownReactions?.indexWhere(
(reaction) => reaction.type == reactionIcon.type,
) ??
-1;
final index = reactionIcons.indexOf(reactionIcon);

final child = reactionIcon.builder(
context,
ownReactionIndex != -1,
24,
);

return ConstrainedBox(
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
child: RawMaterialButton(
elevation: 0,
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: reactionIcons
.map<Widget>((reactionIcon) {
final ownReactionIndex =
widget.message.ownReactions?.indexWhere(
(reaction) => reaction.type == reactionIcon.type,

Check warning on line 70 in packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart

View check run for this annotation

Codecov / codecov/patch

packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart#L70

Added line #L70 was not covered by tests
) ??
-1;
final index = reactionIcons.indexOf(reactionIcon);

final child = reactionIcon.builder(
context,
ownReactionIndex != -1,
24,
);

return ConstrainedBox(
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
onPressed: () {
if (ownReactionIndex != -1) {
removeReaction(
context,
widget.message.ownReactions![ownReactionIndex],
);
} else {
sendReaction(
context,
reactionIcon.type,
);
}
},
child: AnimatedBuilder(
animation: animations[index],
builder: (context, child) => Transform.scale(
scale: animations[index].value,
child: RawMaterialButton(
elevation: 0,
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
onPressed: () {
if (ownReactionIndex != -1) {
removeReaction(

Check warning on line 97 in packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart

View check run for this annotation

Codecov / codecov/patch

packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart#L95-L97

Added lines #L95 - L97 were not covered by tests
context,
widget.message.ownReactions![ownReactionIndex],

Check warning on line 99 in packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart

View check run for this annotation

Codecov / codecov/patch

packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart#L99

Added line #L99 was not covered by tests
);
} else {
sendReaction(

Check warning on line 102 in packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart

View check run for this annotation

Codecov / codecov/patch

packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart#L102

Added line #L102 was not covered by tests
context,
reactionIcon.type,

Check warning on line 104 in packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart

View check run for this annotation

Codecov / codecov/patch

packages/stream_chat_flutter/lib/src/message_widget/reactions/reaction_picker.dart#L104

Added line #L104 was not covered by tests
);
}
},
child: AnimatedBuilder(
animation: animations[index],
builder: (context, child) => Transform.scale(
scale: animations[index].value,
child: child,
),
child: child,
),
child: child,
),
);
})
.insertBetween(
const SizedBox(
width: 16,
),
);
})
.insertBetween(
const SizedBox(
width: 16,
),
)
.toList(),
)
.toList(),
),
),
),
);
Expand Down
Loading