Flutter reaction button plugin it is fully customizable widget such as Facebook reaction button

Overview

Flutter Reaction Button

pub package

Flutter button reaction it is fully customizable widget such as Facebook reaction button.

Preview

Demo

Usage

Include 'flutter_reaction_button' from Dart Pub.

# pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  flutter_reaction_button: 
   

Next, import 'flutter_reaction_button.dart' into your dart code.

import 'package:flutter_reaction_button/flutter_reaction_button.dart';

Parameters

parameter description default
OnReactionChanged triggered when reaction button value change
reactions reactions appear in reactions box when long pressed on ReactionnButtonToggle or click on ReactionButton
initialReaction Default reaction button widget first item in reactions list
boxPosition Position of reactions box according to the button Position.TOP
boxColor Reactions box color Colors.white
boxElevation Reactions box elevation 5
boxRadius Reactions box radius 50
boxPadding Reactions box padding const EdgeInsets.all(0)
boxDuration Reactions box show/hide duration 200 milliseconds
shouldChangeReaction Shold change initial reaction after selected one or not true
itemScale Scale ratio when item hovered 0.3
itemScaleDuration Scale duration while dragging const Duration(milliseconds: 100)

LICENSE

MIT License

Copyright (c) 2019 Abdelouahed Medjoudja

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • InitialReaction not updating as Expected/

    InitialReaction not updating as Expected/

    Hey guys, first of all thanks for this plugin and i am facing the issue while implementing it in one of my project, could you guys help me out of this. Thanks in advance.

    Version : flutter_reaction_button: ^1.0.2

    Here is my code:

                        FlutterReactionButtonCheck(
                             onReactionChanged: (reaction, isChecked) {
                             this.widget.post.isLike = !this.widget.post.isLike;
                            setState(() {});
                             print('reaction selected id: ${reaction.id}');
                               print('isChecked $isChecked');
                              },
                           reactions: Reactions.reactions,
                            initialReaction: this.widget.post.isLike
                              ? Reactions.reactions[0]
                            : Reactions.defaultInitialReaction,
                           selectedReaction: Reactions.reactions[0],
                            boxRadius: 26,
                            ),
                           ),
    

    if you see the above code i am changing the initial reaction dynamically according to my needs whenever its change its not updating its always renders the first what we give to it. I saw the code of the implementation there its setted in initstate does that is prob or any other? @GeekAbdelouahed @mostafaAbdelazim

    opened by sivaram16 6
  • Top Position isn't on top of ReactionButton

    Top Position isn't on top of ReactionButton

    Hello,

    I've got another issue. The reaction bar is not displayed on top of the reaction button, but there is little spacing between. image

    Can you add more custom positioning attributes? This would help me and maybe https://github.com/GeekAbdelouahed/flutter-reaction-button/issues/13.

    Thank you!

    opened by SchnMar 4
  • Add more styling options

    Add more styling options

    Hi! I extended the styling options a bit and fixed some minor issues:

    • When calling setState after an async call, it is important to check whether the widget is still mounted
    • Now, there is both a vertical and a horizontal positioning to offer a bit more control
    • I also added an offset parameter to move the box around (can be used to achieve the same positioning as what you had with TOP positioning before which seemed a bit arbitrary, fixes #20)
    • Users can now specify what spacing they want to add between their reactions
    • Updated dependencies, adapted something for Flutter 3 and removed an autogenerated local file from git (fixes #36)

    Please do let me know if I should change anything

    opened by felixgabler 3
  • [Request] Popup position align with the button

    [Request] Popup position align with the button

    Hi @GeekAbdelouahed ,

    The popup is always at the center, it is pretty weird to see if we have short reaction items. Can we have an option to align it next the the button?

    Thanks in advance.

    opened by jasonlaw 3
  • Flutter 3.0.0 is detecting issue with the library

    Flutter 3.0.0 is detecting issue with the library

    `../../../Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_reaction_button-2.0.0+2/lib/src/ui/w idget_size_render_object.dart:19:24: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.

    • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance?.addPostFrameCallback((_) {`
    opened by RoyalCoder88 2
  • Removal of ID is a breaking change

    Removal of ID is a breaking change

    Hello,

    first of all, thank you very much for this great package. Unfortunately, the removal of the ID was a breaking change for me which causes a lot of problems in my app. Can you please add an optional ID field again?

    Thank you!

    opened by SchnMar 2
  • [QUESTION] How to close popover menu programmatically?

    [QUESTION] How to close popover menu programmatically?

    Hi,

    I want to close the popover reaction menu manually without user clicking outside the box, is there any possible way to achieve this?

    Thanks in Advance

    opened by Mustahsan1 2
  • [Question] How to update selected reaction programmatically

    [Question] How to update selected reaction programmatically

    Assume I have 2 pages (Page A and B)

    Page A have list of posts that contain a single FlutterReactionButtonCheck. Page B have a single FlutterReactionButtonCheck

    My scenario is when I go to Page B and update reaction from index 1 to 2. When I come back to Page A. I wanted update a FlutterReactionButtonCheck reaction.

    What I have done is send callback function from Page A to Page B. Whenever the reaction changed i will call a callbackfunction to setState of a reaction in PageA. But it still not update.

    This is a call back function in Page A

    updateReaction(int newReaction) {
        print('update new reaction to: $newReaction');
        setState(() {
          this.userReaction = newReaction;
        });
    }
    

    This is a FlutterReactionButtonCheck setup in Page A.

    FlutterReactionButtonCheck(
                  onReactionChanged: (reaction, isChecked) async {
                 ....
      },
      reactions: this.reactions,
      isChecked: this.userReaction == null ? false : true,
      initialReaction: GurubookReaction.defaultInitialReaction,
      selectedReaction: this.userReaction != null
      ? this.reactions[this.userReaction - 1]
      : this.reactions[0],
    ),
    

    In page B whenever onReactionChanged called will trigger updateReaction(reactions.id)

    Thanks in advance.

    opened by petchgabriel 2
  • ReactionsBox keep showing when scroll

    ReactionsBox keep showing when scroll

    When you scroll App, ReactionsBox showing when scroll if scroll start from reaction button...

    I think ReactionsBox should called only with long press on screen, not when onPointerDown ...

    test2

    opened by AnasSafi 1
  • Reactions Are Never Turned Off

    Reactions Are Never Turned Off

    When I try to remove a reaction that I already selected it just sets it to the first reaction. Checking if isChecked always returns true.

     FlutterReactionButtonCheck(
              onReactionChanged: (reaction, index, isChecked) {
                print('click: $index');
                if (isChecked) {
                  print(isChecked);
                  if (!_likeExists(widget.post!.likeReactions)) {
                    setState(() {
                      selectedReation = reaction;
                      widget.streamClient!.reactions.add('like', widget.post!.id!,
                          userId: widget.streamClient!.currentUser!.userId,
                          data: {
                            'value': index,
                          });
                      widget.post!.likesCount = widget.post!.likesCount! + 1;
                      StreamAPI().sendLikeNotificationPost(
                          widget.streamClient!,
                          widget.streamClient!.currentUser!.userId,
                          widget.post!.owner,
                          widget.post!.id,
                          index);
                    });
                  } else if (_likeExists(widget.post!.likeReactions)) {
                    setState(() {
                      selectedReation = reaction;
                      widget.streamClient!.reactions.update(like.likeId!, data: {
                        'value': index,
                      });
                    });
                  }
                } else {
                  if (_likeExists(widget.post!.likeReactions)) {
                    setState(() {
                      selectedReation = reaction;
                      widget.streamClient!.reactions.delete(like.likeId!);
                      widget.post!.likesCount = widget.post!.likesCount! - 1;
                    });
                  }
                }
              },
              isChecked: selectedReation != null ? true : false,
              reactions: SNAB().reactions,
              initialReaction: _likeExists(widget.post!.likeReactions)
                  ? SNAB().reactions[like.value!]
                  : Reaction(
                      id: 7,
                      icon: Image.asset(
                        'assets/images/100.png',
                        height: 20,
                        color: Colors.grey[600],
                      )),
              selectedReaction: selectedReation,
            ),
    
    opened by rlee1990 1
  • FlutterReactionButtonCheck | buildWidgetPreview & buildWidget methods not provided

    FlutterReactionButtonCheck | buildWidgetPreview & buildWidget methods not provided

    Hi there,

    At the example of the FlutterReactionButtonCheck component, these methods don't exist. Also, they aren't mentioned in the documentation.

    I guess the "buildWidget" method should return a Icon or an Image but I'm not sure.

    Awesome component!!!!๐Ÿ’“๐Ÿ’“๐Ÿ’“๐Ÿ’“๐Ÿ’“๐Ÿ’“๐Ÿ’“

    opened by abelardolg 1
  • Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.

    Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.

    Showing this warning when running on Flutter 3

    : Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
    ../โ€ฆ/ui/widget_size_render_object.dart:36
    - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Development/flutter/packages/flutter/lib/src/widgets/binding.dart').
    package:flutter/โ€ฆ/widgets/binding.dart:1
            WidgetsBinding.instance?.addPostFrameCallback((_) {
    
    opened by denisviana 0
  • Reaction box size

    Reaction box size

    Hi friends,

    How can the reaction box size be increased, make it bigger? And does the gesture detect swiping on the larger size of the screen? box_size Thanks in advance!

    opened by RoyalCoder88 1
  • Reaction box is showing off the screen.

    Reaction box is showing off the screen.

    Great package.

    I have added this package as my reaction button but sometimes it starts from the left and goes off the screen. I have tested it multiple times. Not see any exception in the console as well. I am attaching an image below

    Take look.

    test_image

    opened by jigarfumakiya 10
  • Conflict with TextFormField autofocus: true, keyboard keep shown every set or dismiss reaction

    Conflict with TextFormField autofocus: true, keyboard keep shown every set or dismiss reaction

    The problem is when TextFormField has autofocus: true in same screen has ReactionButtonToggle, when select and reaction (or dismiss reaction box), keyboard shown

    opened by AnasSafi 0
Releases(v2.0.1)
  • v2.0.1(Jun 4, 2022)

  • v2.0.0(Oct 29, 2021)

    • Change FlutterReactionButton to ReactionButton.
    • Using generic value in the callback onReactionChanged.
    • Change FlutterReactionButtonCheck to ReactionButtonToggle.
    • Change Function(Reaction, int, bool) onReactionChanged to Function(T?, bool) onReactionChanged.
    • Change Function(Reaction, int) onReactionChanged to Function(T?) onReactionChanged.
    • Dynamic scale depending on the hover position.
    • Dynamic horizontal alignment.
    • Scrollable position.
    • Minor bugs fixed.
    Source code(tar.gz)
    Source code(zip)
Owner
Abdelouahed Medjoudja
Mobile Applications Developer
Abdelouahed Medjoudja
Flutter Duration Button - Create auto-click button likes Netflix's Skip Intro button in Flutter

Flutter Duration Button - Create auto-click button likes Netflix's Skip Intro button in Flutter

Kim Seung Hwan 7 Dec 7, 2022
PowerFileView - A powerful file view widget, support a variety of file types, such as Doc Eexcl PPT TXT PDF and so on, Android is implemented by Tencent X5, iOS is implemented by WKWebView.

PowerFileView - A powerful file view widget, support a variety of file types, such as Doc Eexcl PPT TXT PDF and so on, Android is implemented by Tencent X5, iOS is implemented by WKWebView.

Yao 8 Oct 22, 2022
๐Ÿ“ธ Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget.

?? Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.

Blue Fire 1.7k Jan 7, 2023
Flutter Triple Status Button can use toggle button but in three statuses.

triple_status_button Triple Status Button. Flutter Triple Status Button can use toggle button but in three statuses. Property Description height heigh

MahdiBagjani 2 Nov 13, 2021
A button that looks like a Cupertino text button

Cupertino Text Button A button that looks like a Cupertino text button! Text Button A simple text button can be created like this: CupertinoTextButton

Nick Sirovsky 0 Nov 24, 2022
A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier.

Draggable Home A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier! Based on the Scaffold and Sliver. Us

Devs On Flutter 106 Dec 12, 2022
An advanced switch widget, that can be fully customized with size, text, color, radius of corners.

flutter_advanced_switch An advanced switch widget, that can be fully customized with size, text, color, radius of corners. Switch Light Switch Dark Ge

Alex Melnyk 13 Dec 15, 2022
Customizable Flutter widget which syncronize ScrollView with PageView as tabs

scrollable_list_tab_scroller Customizable Flutter widget which syncronize ScrollView with PageView as tabs. Create a custom page view as tabs which sy

Railson Ferreira de Souza 4 Dec 21, 2022
Flutter widget form select a date in horizontal timeline with customizable styles.

Flutter widget form select a date in horizontal timeline with customizable styles. Getting Started You can use this package when you need to add a dat

Jose Manuel Mรกrquez 158 Dec 2, 2022
A Highly customizable Phone input Flutter widget that supports country code, validation and contact picker.

A Highly customizable Phone input Flutter widget that supports country code, validation and contact picker.

null 6 Jun 7, 2022
Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list presented as a dropdown in a dialog box or a menu.

searchable_dropdown Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list prese

Bobby Stenly Irawan 108 Sep 11, 2022
A highly customizable multiple selection widget with search functionality.

A highly customizable multiple selection widget with search functionality.

null 5 Dec 19, 2022
A Facebook & Twitter Like Card Loading Shimmer Skeleton Library.

PKSkeleton A Facebook & Twitter Like Card Loading Shimmer Skeleton Library. The source code is 100% Dart, and everything resides in the /lib folder. S

Pawan Kumar 283 Nov 26, 2022
A popup simple topModalSheet menu button widget with handsome design and easy to use

top_modal_sheet A popup simple topModalSheet menu button widget with handsome design and easy to use. Installations Add top_modal_sheet: ^1.0.0 in you

Baldemar Alejandres 5 Jul 29, 2022
AdvFAB - An Advanced floating action button that expands itself to reveal its hidden widget

AdvFAB (More Than Just A Floating Action Button) AdvFAB is An Advanced floating action button that expands itself to reveal its hidden widget. It can

null 19 Nov 4, 2022
RFlutter Alert is super customizable and easy-to-use alert/popup dialogs for Flutter.

RFlutter Alert is super customizable and easy-to-use alert/popup dialogs for Flutter. You may create reusable alert styles or add buttons as much as you want with ease.

Ratel 362 Jan 1, 2023
SKAlertDialog - A highly customizable, powerful and easy-to-use alert dialog for Flutter.

SKAlertDialog A highly customizable, powerful and easy-to-use alert dialog for Flutter. GIF Screenshots SKAlertDialog Basic Alert Alert with buttons A

Senthil_Kumar 7 May 18, 2022
Sliding card is a highly customizable flutter package that will help you create beautiful Cards with a sliding animation effect.

Sliding Card Introduction Sliding card is a highly customizable flutter package that will help you create beautiful Cards with a sliding animation eff

null 21 Nov 4, 2022
Animated, highly customizable, open-source Flutter gauge indicator widgets

Animated, highly customizable, open-source Flutter gauge indicator widgets. They use renderbox under the hood, thus ensuring high performance.

HTD Health 6 Jun 10, 2022