Skip to content

Commit

Permalink
fix: šŸ› added report button and update report and more button callbacks ā€¦
Browse files Browse the repository at this point in the history
ā€¦#130

- Update more and report button callbacks
- Added report button for receiver's message and provides its callback
  • Loading branch information
apurva010 committed May 20, 2024
1 parent 179c769 commit 600341e
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## [1.3.2] (Unreleased)

* **Fix**: [130](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/130) Added
report button for receiver message and update onMoreTap, onReportTap callback.
* **Fix**: [126](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/126) Added
flag to hide user name in chat.
* **Feat**: [161](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/161) Added
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,23 @@ ChatView(
)
```

20. Added report button for receiver message and update `onMoreTap` and `onReportTap` callbacks.

```dart
ChatView(
...
replyPopupConfig: ReplyPopupConfiguration(
onReportTap: (Message message) {
debugPrint('Message: $message');
},
onMoreTap: (Message message, bool sendByCurrentUser) {
debugPrint('Message : $message');
},
),
...
)
```



## How to use
Expand Down
4 changes: 2 additions & 2 deletions lib/src/models/reply_popup_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class ReplyPopupConfiguration {
final MessageCallBack? onReplyTap;

/// Provides callback on onReport button.
final VoidCallBack? onReportTap;
final MessageCallBack? onReportTap;

/// Provides callback on onMore button.
final VoidCallBack? onMoreTap;
final MoreTapCallBack? onMoreTap;

/// Used to give text style of button text.
final TextStyle? buttonTextStyle;
Expand Down
1 change: 1 addition & 0 deletions lib/src/utils/package_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ class PackageStrings {
static const String photo = "Photo";
static const String send = "Send";
static const String you = "You";
static const String report = "Report";
}
1 change: 1 addition & 0 deletions lib/src/values/typedefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ typedef VoidCallBackWithFuture = Future<void> Function();
typedef StringsCallBack = void Function(String emoji, String messageId);
typedef StringWithReturnWidget = Widget Function(String separator);
typedef DragUpdateDetailsCallback = void Function(DragUpdateDetails);
typedef MoreTapCallBack = void Function(Message message, bool sendByCurrentUser);
19 changes: 10 additions & 9 deletions lib/src/widgets/chat_list_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,21 +271,22 @@ class _ChatListWidgetState extends State<ChatListWidget>
topBorderColor: replyPopup?.topBorderColor,
onMoreTap: () {
_onChatListTap();
if (replyPopup?.onMoreTap != null) {
replyPopup?.onMoreTap!();
}
replyPopup?.onMoreTap?.call(
message,
sendByCurrentUser,
);
},
onReportTap: () {
_onChatListTap();
if (replyPopup?.onReportTap != null) {
replyPopup?.onReportTap!();
}
replyPopup?.onReportTap?.call(
message,
);
},
onUnsendTap: () {
_onChatListTap();
if (replyPopup?.onUnsendTap != null) {
replyPopup?.onUnsendTap!(message);
}
replyPopup?.onUnsendTap?.call(
message,
);
},
onReplyTap: () {
widget.assignReplyMessage(message);
Expand Down
8 changes: 8 additions & 0 deletions lib/src/widgets/reply_popup_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ class ReplyPopupWidget extends StatelessWidget {
style: textStyle,
),
),
if (!sendByCurrentUser)
InkWell(
onTap: onReportTap,
child: Text(
PackageStrings.report,
style: textStyle,
),
),
InkWell(
onTap: onMoreTap,
child: Text(
Expand Down

0 comments on commit 600341e

Please sign in to comment.