Skip to content

Commit e83e1a9

Browse files
committed
fix:🐛Reaction widget gets cutOff when it width is greater then message width.
1 parent 31eedc2 commit e83e1a9

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.4.0] (UnReleased)
2+
3+
* **Fix**: Reaction widget gets cutOff when it width is greater then message width/Screen width.
4+
15
## [1.3.1]
26

37
* **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user

lib/src/models/message_reaction_configuration.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import 'package:flutter/material.dart';
2323

2424
class MessageReactionConfiguration {
2525
/// Used for giving size of reaction on message.
26+
/// Will apply only for one-one chat.
2627
final double? reactionSize;
2728

2829
/// Used for giving margin of reaction on message.

lib/src/widgets/reaction_widget.dart

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ class _ReactionWidgetState extends State<ReactionWidget> {
6565

6666
@override
6767
Widget build(BuildContext context) {
68-
//// Convert into set to remove reduntant values
68+
//// Convert into set to remove redundant values
6969
final reactionsSet = widget.reaction.reactions.toSet();
70+
final isGroupChat = widget.reaction.reactedUserIds.length > 2;
71+
7072
return Positioned(
7173
bottom: 0,
7274
right: widget.isMessageBySender && needToExtend ? 0 : null,
@@ -103,12 +105,18 @@ class _ReactionWidgetState extends State<ReactionWidget> {
103105
child: Row(
104106
children: [
105107
Text(
106-
reactionsSet.join(' '),
108+
isGroupChat
109+
? reactionsSet.take(3).join(' ')
110+
: reactionsSet.join(' '),
107111
style: TextStyle(
108-
fontSize: messageReactionConfig?.reactionSize ?? 13,
112+
fontSize: isGroupChat
113+
? messageReactionConfig?.reactionSize ?? 13
114+
: 13,
109115
),
110116
),
111117
if ((chatController?.chatUsers.length ?? 0) > 1) ...[
118+
/// when reaction user length is 3 or <3 && they all have
119+
/// reacted with the same reaction this condition will be true
112120
if (!(widget.reaction.reactedUserIds.length > 3) &&
113121
!(reactionsSet.length > 1))
114122
...List.generate(
@@ -124,6 +132,9 @@ class _ReactionWidgetState extends State<ReactionWidget> {
124132
messageReactionConfig?.profileCircleRadius,
125133
),
126134
),
135+
136+
/// ReactionUser length > 3 && all have reacted with the same
137+
/// reaction then this condition will be executed
127138
if (widget.reaction.reactedUserIds.length > 3 &&
128139
!(reactionsSet.length > 1))
129140
Padding(

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: chatview
22
description: A Flutter package that allows you to integrate Chat View with highly customization options.
3-
version: 1.3.1
3+
version: 1.4.0
44
issue_tracker: https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues
55
repository: https://github.com/SimformSolutionsPvtLtd/flutter_chatview
66

0 commit comments

Comments
 (0)