likeus 1.0.1

SDKflutter
Platformandroidioswindowslinuxmacosweb

A Flutter package to create a Twitter-like heart animation button for likes, reactions, or favorites.

🎉 LikeUs

A customizable Flutter animation button — perfect for likes, reactions, and more.
Inspired by Twitter's heart animation — but you can use any icon you want.

preview


🚀 Features

  • Smooth animation on like/unlike
  • Use any icon — not just heart!
  • Toggle behavior with async callback
  • Customizable size, animation duration, and colors

📦 Installation

Add the package to your pubspec.yaml:

dependencies:
  likeus: ^1.0.0

Then run:

flutter pub get

🚀 How to Use

✅ Basic Usage (Default Heart Button)

By default, LikeButton() uses the heart icon (Icons.favorite) with a smooth animation:

LikeButton()

🎨 Custom Effects (Full Control)

You can customize the icon, animation colors, and like count using additional parameters:

LikeButton(
  size: 40,
  circleColor: CircleColor(
    start: Color(0xff00ddff),
    end: Color(0xff0099cc),
  ),
  bubblesColor: BubblesColor(
    dotPrimaryColor: Color(0xff33b5e5),
    dotSecondaryColor: Color(0xff0099cc),
  ),
  likeBuilder: (bool isLiked) {
    return Icon(
      Icons.home,
      color: isLiked ? Colors.deepPurpleAccent : Colors.grey,
      size: 40,
    );
  },
  likeCount: 665,
  countBuilder: (int count, bool isLiked, String text) {
    final color = isLiked ? Colors.deepPurpleAccent : Colors.grey;
    return Text(
      count == 0 ? "love" : text,
      style: TextStyle(color: color),
    );
  },
)

🔄 Handle Like Tap with Async Request

You can manage like state with a server/API call or local logic using onTap:

LikeButton(
  onTap: onLikeButtonTapped,
)

Future<bool> onLikeButtonTapped(bool isLiked) async {
  // Example of sending request to server
  // final success = await sendLikeStatusToServer();

  // return success ? !isLiked : isLiked;
  return !isLiked; // mock toggle
}

⚙️ Parameters

ParameterTypeDescriptionDefault
sizedoubleSize of the like widget30.0
animationDurationDurationDuration of the like animationDuration(milliseconds: 1000)
bubblesSizedoubleTotal size of the bubbles (animated dots)size * 2.0
bubblesColorBubblesColorCustomize the color of animated bubblesDefault colors
circleSizedoubleFinal size of the animated circlesize * 0.8
circleColorCircleColorStarting and ending colors of the circle animationDefault colors
onTapFuture<bool> FunctionCallback triggered on tap (supports async operations)null
isLikedboolCurrent liked state (if null, always shows animation)false
likeCountintLike count to display beside the buttonnull
likeBuilderWidgetBuilderBuilder to create the like iconnull
countBuilderWidgetBuilderBuilder to customize the like count text widgetnull
mainAxisAlignmentMainAxisAlignmentLayout alignment inside the containerMainAxisAlignment.center
likeCountAnimationDurationDurationDuration to animate like countDuration(milliseconds: 500)
likeCountAnimationTypeLikeCountAnimationTypeAnimation style for count (none, part, all)LikeCountAnimationType.part
likeCountPaddingEdgeInsetsPadding around the like count widgetEdgeInsets.only(left: 3.0)
countPositionCountPositionPosition of the count relative to the icon (top, right, bottom, left)CountPosition.right
countDecorationDecorationCustom decoration (background, border, etc.) for the count widgetnull
postFrameCallbackFunction(LikeButtonState)Called on first frame render, gives access to the internal LikeButtonStatenull

👨‍💻 Developer

Developed and maintained by Muhammad Abbas,
Senior Flutter Developer at MIT PROGRAMMER LTD
🔗 GitHub