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

[BUG] Shimmer is being cut after resize window WEB #61

Open PcolBP opened 1 year ago

PcolBP commented 1 year ago

Hi. Thanks for plugin.

Shimmer.fromColors creates white space on the right side. It never happened before. Now it does after migrating flutter to 3.3.0 and later.

Bug occurs on Flutter 3.3.0 & 3.3.2

Chrome setup `Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125`

Removing Shimmer.fromColors resolve problem.

Image of skeletons with Shimmer.fromColors: image

Image of skeletons without Shimmer.fromColors: image

Flutter doctor ```console Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.3.0, on macOS 12.6 21G115 darwin-arm (Rosetta), locale pl-PL) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2) [✓] Xcode - develop for iOS and macOS (Xcode 14.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.66.2) [✓] VS Code (version 1.66.2) [✓] Connected device (4 available) [✓] HTTP Host Availability • No issues found! ```
PcolBP commented 1 year ago

Found out that inserting Shimmer.fromColors in AnimatedSwitcher and switching fast between shimmer and correct child creates that container - looks like shimmer can't handle fast switching?

EDIT: Also the bigger screen resolution the container is bigger. It doesn't appear on low res screens.

EDIT2: Problem occurs also when we will refresh page and increase window size. Than container appears - after refreshing again on increased window problem dissapears until we will increase size again -.-"

EDIT3: Forgot to say that its HTML engine.

Repro:

TwSkeletonWrapper ```dart class TwSkeletonWrapper extends StatelessWidget { const TwSkeletonWrapper({required this.child, Key? key}) : super(key: key); final Widget child; @override Widget build(BuildContext context) { return Shimmer.fromColors( key: ValueKey(child.hashCode), baseColor: Colors.black, // Colros simplified for testing highlightColor: Colors.white, child: child, ); } } ```

And wrap TwSkeletonWrapper inside:

TwSkeleton ```dart class TwSkeleton extends StatelessWidget { const TwSkeleton({ required this.skeleton, required this.loading, required this.child, Key? key, }) : super(key: key); final Widget skeleton; final Widget child; final bool loading; @override Widget build(BuildContext context) { return AnimatedSwitcher( duration: loading ? const Duration(milliseconds: 650) : Duration.zero, reverseDuration: loading ? const Duration(milliseconds: 10) : Duration.zero, child: loading ? skeleton : child, ); } } ```

When switching between childs than that weird container appears.

PcolBP commented 1 year ago

I've recorded sample of how to reproduce it. After entering page is enough to just increase size window to be able to see it. https://user-images.githubusercontent.com/67896443/196207869-2beb0a30-6ff0-4c40-aa10-d0a3c494465f.mov

LambGe commented 6 months ago

+1