Skip to content

Commit 0a61a38

Browse files
committed
fix:🐛Reaction widget gets cutOff when it width is greater then message width for the image message type.
1 parent 31eedc2 commit 0a61a38

File tree

7 files changed

+53
-21
lines changed

7 files changed

+53
-21
lines changed

CHANGELOG.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,76 @@
1+
## [1.4.0] (UnReleased)
2+
3+
* **Fix**: Reaction widget gets cutOff when it width is greater then message width for the Image
4+
message type.
5+
16
## [1.3.1]
27

3-
* **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user
4-
to get callback when image is picked so user can perform operation like crop. Allow user to pass
8+
* **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user
9+
to get callback when image is picked so user can perform operation like crop. Allow user to pass
510
configuration like height, width, image quality and preferredCameraDevice.
6-
* **Fix**: [95](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/95) Fix issue of
11+
* **Fix**: [95](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/95) Fix issue of
712
chat is added to bottom while `loadMoreData` callback.
8-
* **Fix**: [109](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/109) Added
9-
support for the hiding/Un-hiding gallery and camera buttons
10-
13+
* **Fix**: [109](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/109) Added
14+
support for the hiding/Un-hiding gallery and camera buttons
15+
1116
## [1.3.0]
1217

1318
* **Feat**: [71](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/71) Added Callback
1419
when a user starts/stops composing typing a message.
1520
* **Fix**: [78](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/78) Fix issue of
1621
unmodifiable list.
17-
* **Feat**: [76](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/76) Message Receipts.
22+
* **Feat**: [76](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/76) Message
23+
Receipts.
1824
* **Fix**: [81](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/81) Fix issue of
1925
TypingIndicator Rebuilding ChatView.
2026
* **Fix**: [94](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/94) Fixed deprecated
2127
`showRecentsTab` property with new `recentTabBehavior`.
2228
* Support for latest flutter version `3.10.5`.
23-
* Update dependencies `http` to version `1.1.0` and `image_picker` to version range `'>=0.8.9 <2.0.0'`.
24-
29+
* Update dependencies `http` to version `1.1.0` and `image_picker` to version
30+
range `'>=0.8.9 <2.0.0'`.
2531

2632
## [1.2.1]
2733

2834
* **Fix**: [60](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/60) Fix image from
2935
file is not loaded.
3036
* **Fix**: [61](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/61) Fix issue of
3137
audio message is not working.
32-
* **Feat**: [65](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/65) Add callback
38+
* **Feat**: [65](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/65) Add callback
3339
when user react on message.
3440

35-
3641
## [1.2.0+1]
3742

38-
* **Feat**: [42](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/42) Ability to
43+
* **Feat**: [42](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/42) Ability to
3944
get callback on tap of profile circle avatar.
4045
* **Breaking**: Add `messageType` in `onSendTap` callback for encountering messages.
4146
* **Breaking**: Remove `onRecordingComplete` and you can get Recorded audio in `onSendTap` callback
4247
with `messageType`.
4348
* **Breaking**: Remove `onImageSelected` from `ImagePickerIconsConfiguration` and can get selected
4449
image in `onSendTap` callback with `messageType`.
45-
* **Feat**: [49](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/49) Add `onUrlDetect`
50+
* **Feat**: [49](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/49)
51+
Add `onUrlDetect`
4652
callback for opening urls.
4753
* **Feat**: [51](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/51) Ability to
4854
get callback on long press of profile circle avatar.
4955

5056
## [1.1.0]
5157

52-
* **Feat**: [37](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/37) Ability to
58+
* **Feat**: [37](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/37) Ability to
5359
enable or disable specific features.
5460
* **Feat**: [34](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/34) Ability to
5561
add voice message.
5662
* **Breaking**: Remove `onEmojiTap` from `ReactionPopupConfiguration`, it can be handled internally.
57-
* **Breaking**: Remove `horizontalDragToShowMessageTime` from `ChatBackgroundConfiguration` and
63+
* **Breaking**: Remove `horizontalDragToShowMessageTime` from `ChatBackgroundConfiguration` and
5864
add `enableSwipeToSeeTime` parameter with same feature in `FeatureActiveConfig`.
5965
* **Breaking**: Remove `showReceiverProfileCircle` and add `enableOtherUserProfileAvatar` parameter
6066
with same feature in `FeatureActiveConfig`.
61-
* * **Breaking**: Move `enablePagination` parameter from `ChatView` to `FeatureActiveConfig`.
67+
* **Breaking**: Move `enablePagination` parameter from `ChatView` to `FeatureActiveConfig`.
6268

6369
## [1.0.1]
6470

65-
* **Fix**: [32](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/32) Fix issue of
71+
* **Fix**: [32](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/32) Fix issue of
6672
while replying to image it highlights the link instead of the image.
67-
* **Fix**: [35](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/35) Fix issue of
73+
* **Fix**: [35](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/35) Fix issue of
6874
removing reaction which is reacted accidentally.
6975

7076
## [1.0.0+1]

lib/src/models/message_reaction_configuration.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
* SOFTWARE.
2121
*/
22+
import 'package:chatview/src/utils/constants/constants.dart';
2223
import 'package:flutter/material.dart';
2324

2425
class MessageReactionConfiguration {
@@ -59,6 +60,10 @@ class MessageReactionConfiguration {
5960
/// Used for padding to reacted user profile circle.
6061
final EdgeInsets? profileCirclePadding;
6162

63+
/// Maximum number of reaction(emoji) to be visible on a message.
64+
/// Default value is 3.
65+
final int reactionCount;
66+
6267
const MessageReactionConfiguration({
6368
this.reactionsBottomSheetConfig,
6469
this.reactionCountTextStyle,
@@ -72,6 +77,7 @@ class MessageReactionConfiguration {
7277
this.borderWidth,
7378
this.profileCircleRadius,
7479
this.profileCirclePadding,
80+
this.reactionCount = messageReactionCount,
7581
});
7682
}
7783

lib/src/utils/constants/constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const double replyBorderRadius1 = 30;
5858
const double replyBorderRadius2 = 18;
5959
const double leftPadding3 = 12;
6060
const double textFieldBorderRadius = 27;
61+
const int messageReactionCount = 3;
6162

6263
applicationDateFormatter(DateTime inputTime) {
6364
if (DateTime.now().difference(inputTime).inDays <= 3) {

lib/src/utils/package_strings.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ class PackageStrings {
3434
static const String photo = "Photo";
3535
static const String send = "Send";
3636
static const String you = "You";
37+
static const String emptyString = ' ';
3738
}

lib/src/widgets/image_message_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class ImageMessageView extends StatelessWidget {
7474
children: [
7575
if (isMessageBySender) iconButton,
7676
Stack(
77+
clipBehavior: Clip.none,
7778
children: [
7879
GestureDetector(
7980
onTap: () => imageMessageConfig?.onTap != null

lib/src/widgets/reaction_widget.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
*/
2222
import 'package:chatview/src/extensions/extensions.dart';
2323
import 'package:chatview/src/utils/measure_size.dart';
24+
import 'package:chatview/src/utils/package_strings.dart';
2425
import 'package:chatview/src/widgets/reactions_bottomsheet.dart';
2526
import 'package:flutter/material.dart';
2627

2728
import '../../chatview.dart';
29+
import '../utils/constants/constants.dart';
2830

2931
class ReactionWidget extends StatefulWidget {
3032
const ReactionWidget({
@@ -65,8 +67,10 @@ class _ReactionWidgetState extends State<ReactionWidget> {
6567

6668
@override
6769
Widget build(BuildContext context) {
68-
//// Convert into set to remove reduntant values
70+
//// Convert into set to remove redundant values
6971
final reactionsSet = widget.reaction.reactions.toSet();
72+
final isGroupChat = widget.reaction.reactedUserIds.length > 2;
73+
7074
return Positioned(
7175
bottom: 0,
7276
right: widget.isMessageBySender && needToExtend ? 0 : null,
@@ -103,12 +107,21 @@ class _ReactionWidgetState extends State<ReactionWidget> {
103107
child: Row(
104108
children: [
105109
Text(
106-
reactionsSet.join(' '),
110+
isGroupChat
111+
? reactionsSet
112+
.take(messageReactionConfig?.reactionCount ??
113+
messageReactionCount)
114+
.join(PackageStrings.emptyString)
115+
: reactionsSet.join(PackageStrings.emptyString),
107116
style: TextStyle(
108117
fontSize: messageReactionConfig?.reactionSize ?? 13,
109118
),
110119
),
111120
if ((chatController?.chatUsers.length ?? 0) > 1) ...[
121+
/// when reaction user length is 3 or <3 && they all have
122+
/// reacted with the same reaction this condition will be
123+
/// true. Here we are showing reaction and user profile
124+
/// avatar.
112125
if (!(widget.reaction.reactedUserIds.length > 3) &&
113126
!(reactionsSet.length > 1))
114127
...List.generate(
@@ -124,6 +137,10 @@ class _ReactionWidgetState extends State<ReactionWidget> {
124137
messageReactionConfig?.profileCircleRadius,
125138
),
126139
),
140+
141+
/// Reaction user length is > 3 && all user have reacted
142+
/// with the same reaction then this condition will be
143+
/// executed
127144
if (widget.reaction.reactedUserIds.length > 3 &&
128145
!(reactionsSet.length > 1))
129146
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)