flutter_chat_reactions 0.0.6 copy "flutter_chat_reactions: ^0.0.6" to clipboard
flutter_chat_reactions: ^0.0.6 copied to clipboard

A Flutter package to add reactions to your chat messages.

flutter_chat_reactions #

flutter_chat_reactions Enhance your Flutter chat with expressive reactions. Need a simple and powerful way to add customizable message reactions to your Flutter chat app? Look no further than flutter_chat_reactions!

Liked some of my work? Buy me a coffee. Thanks for your support ❤️

Buy Me A Coffee

[example/assets/images/demo_light.gif] [example/assets/images/demo_dark.gif]

Features #

  • Reaction Dialog: Upon long-pressing the chat widget, a user-friendly dialog appears, offering a range of expressive reactions.
  • Compact Layout: The reactions are presented in a clean column layout, with the first child being a row containing six default reactions. A convenient '+' sign allows users to access an extended emoji container for even more reaction options.
  • Context Menu: Below the message widget, users can access a context menu, adding depth to the interaction within the chat application.
  • customizable Widgets: Reactions and Context Menu can be customized.

Getting started #

Add dependency to pubspec.yaml

dependencies:
  flutter_chat_reactions: <latest-version>

In your dart file, import the library:

import 'package:flutter_chat_reactions/flutter_chat_reactions.dart';

Usage #

  1. First wrap your Widget with a Hero Widget:
    Hero(tag: message.id,
      child: MessageWidget(message: message),
),
  1. Wrap your Hero Widget with a GestureDetector or Inkwell Widget:
    GestureDetector(
                      // wrap your message widget with a [GestureDectector] or [InkWell]
                      onLongPress: () {
                        // navigate with a custom [HeroDialogRoute] to [ReactionsDialogWidget]
                      },
                      // wrap message with [Hero] widget
                      child: Hero(
                        tag: message.id,
                        child: MessageWidget(message: message),
                      ),
                    );
  1. OnLonPress navigate with HeroDialogRoute to ReactionsDialogWidget See example for more:
    GestureDetector(
                      // wrap your message widget with a [GestureDectector] or [InkWell]
                      onLongPress: () {
                        // navigate with a custom [HeroDialogRoute] to [ReactionsDialogWidget]
                        Navigator.of(context).push(
                          HeroDialogRoute(
                            builder: (context) {
                              return ReactionsDialogWidget(
                                id: message.id, // unique id for message
                                messageWidget: MyMessage(message: message), // message widget
                                onReactionTap: (reaction) {
                                  print('reaction: $reaction');

                                  if (reaction == '➕') {
                                    // show emoji picker container
                                  } else {
                                    // add reaction to message
                                  }
                                },
                                onContextMenuTap: (menuItem) {
                                  print('menu item: $menuItem');
                                  // handle context menu item
                                },
                              );
                            },
                          ),
                        );
                      },
                      // wrap message with [Hero] widget
                      child: Hero(
                        tag: message.id,
                        child: MessageWidget(message: message),
                      ),
                    );

Parameters: #

Name Description Required Default value
id Unique id for message and Hero Widget required -
messageWidget The message widget to be displayed in the dialog required -
onReactionTap The callback function to be called when a reaction is tapped required -
onContextMenuTap The callback function to be called when a context menu item is tapped required -
reactions The list of reactions to be displayed no like, love, haha, wow, sad, angry and plus for more
menuItems The list of menu items to be displayed in the context menu no Reply, Copy and Delete
widgetAlignment The alignment of the widget no aligned to center right
menuItemsWidth The width of the menu items no 45% of the screen width

Contributions #

All contributions are welcome!

45
likes
0
points
1.44k
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to add reactions to your chat messages.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

animate_do, flutter

More

Packages that depend on flutter_chat_reactions