hnvn / flutter_shimmer

A package provides an easy way to add shimmer effect in Flutter project
BSD 3-Clause "New" or "Revised" License
1.77k stars 200 forks source link

ShimmerDirection not changing between different Widgets #33

Closed Ahmadre closed 3 years ago

Ahmadre commented 3 years ago

Demonstration (GIF)

ezgif com-video-to-gif

Code-Snippet

if (summonDirection == SummonDirection.forward)
  Positioned.fill(
    child: AnimatedOpacity(
      duration: const Duration(milliseconds: 500),
      opacity: summoning ? 1.0 : 0.0,
      child: Container(
        child: Shimmer.fromColors(
          direction: ShimmerDirection.ttb,
          baseColor: brightness == Brightness.light ? Colors.black54 : Colors.white54,
          highlightColor: Colors.white,
          child: Image.asset(
            'assets/images/summon_arrows.png',
          ),
        ),
      ),
    ),
  ),
if (summonDirection == SummonDirection.backward)
  Positioned.fill(
    child: AnimatedOpacity(
      duration: const Duration(milliseconds: 500),
      opacity: summoning ? 1.0 : 0.0,
      child: Container(
        child: Shimmer.fromColors(
          direction: ShimmerDirection.btt,
          baseColor: brightness == Brightness.light ? Colors.black54 : Colors.white54,
          highlightColor: Colors.white,
          child: RotatedBox(
            quarterTurns: 2,
            child: Image.asset(
              'assets/images/summon_arrows.png',
            ),
          ),
        ),
      ),
    ),
  ),

Actual behavior

When I set direction: ShimmerDirection.btt, and use another direction in another widget like: direction: ShimmerDirection.ttb,, only the first direction is applied.

Every other Shimmer widget in my StatefulWidget is ignored.

Expected behavior

direction is working for all Shimmers seperatly.

hnvn commented 3 years ago

I will have a look at it. Thanks for your report

Ahmadre commented 3 years ago

@hnvn thanks u rock!

Ahmadre commented 3 years ago

@hnvn any news?

Ahmadre commented 3 years ago

@hnvn it's been 1 month. I would appreciate it, if we can get any answer or something. thx

hnvn commented 3 years ago

ah, I'm so sorry, I am busy with my project this time. I will try to work on it this weekend.

hnvn commented 3 years ago

fixed in v1.1.2