GetShimmer

A small GetX-friendly Shimmer widget for Flutter.

GetShimmer OG image

Shimmer Preview

This package provides a lightweight Shimmer widget built using GetX for controller lifecycle and simple configuration. It uses a ShaderMask under the hood to render an animated gradient over a child widget.

Features

  • ✨ Shimmer effect using Flutter's native ShaderMask widget
  • 🎮 Uses Get.put for controller lifecycle, keeping widget code concise
  • 🔄 Supports multiple shimmer directions: ltr, rtl, ttb, btt
  • 🛡️ Stable & reliable - No layer composition conflicts
  • Performance optimized:
    • Uses GetSingleTickerProviderStateMixin for proper animation lifecycle
    • Zero overhead when enabled: false
  • 🎯 Multiple independent shimmer instances supported

Getting Started

Add get_shimmer to your pubspec.yaml:

dependencies:
  get_shimmer: ^0.0.8

Then import it:

import 'package:get_shimmer/get_shimmer.dart';

Usage

Basic Usage

GetShimmer.fromColors(
  baseColor: Colors.grey.shade300,
  highlightColor: Colors.grey.shade100,
  child: Container(
    height: 200,
    width: double.infinity,
    color: Colors.white,
  ),
);

Custom Gradient

GetShimmer(
  gradient: LinearGradient(
    colors: [Colors.grey.shade300, Colors.white, Colors.grey.shade300],
  ),
  child: YourWidget(),
);

Different Directions

GetShimmer.fromColors(
  direction: ShimmerDirection.ttb, // top to bottom
  child: YourWidget(),
);

Disable Shimmer

Set enabled: false to show the static placeholder without animation (useful in tests or when you want to conditionally disable shimmer):

GetShimmer.fromColors(
  enabled: isLoading, // false shows static child
  child: YourWidget(),
);

API Reference

Property Type Default Description
child Widget required The widget to apply shimmer to
gradient Gradient required The gradient for the shimmer effect
direction ShimmerDirection ltr Animation direction
period Duration 1500ms Animation cycle duration
loop int 0 Number of loops (0 = infinite)
enabled bool true Toggle shimmer on/off

Additional Information

Contributing

Contributions are welcome! Please open issues or PRs on the repository.

License

MIT License - see LICENSE for details.

Libraries

get_shimmer
Get Shimmer