Open gmaggio opened 3 years ago
Looks good to me
@hnvn I wonder if you could review this and possibly merge it as I think it's a much needed feature. Cheers.
@hnvn can you please merge this?
In case someone else comes to this topic and wants an alternative solution to waiting for the feature, they could create the logic in a widget and use that as a shimmer wrapper:
import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
class CustomShimmer extends StatelessWidget {
final Widget child;
final bool loading;
final Color baseColor;
final Color highlightColor;
const CustomShimmer({
super.key,
required this.child,
this.loading = false,
this.baseColor = Colors.white,
this.highlightColor = Colors.white60,
});
@override
Widget build(BuildContext context) {
if (loading) {
return Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: child,
);
}
return child;
}
}
This is practically the same request as https://github.com/hnvn/flutter_shimmer/pull/12. I think it will come in handy for a lot of developers to have the ability to remove all gradient blending and just draw the child. A simple use case is to have a Card UI that shimmers while loading and reveals the text content once loaded.
How to: Set
hideOnDisabled
totrue
to hide the shimmer effect whenenabled
isfalse
.