skeleton method

Widget skeleton({
  1. required bool isLoading,
  2. SkeletonConfig? config,
  3. Widget? customSkeleton,
})

Wraps this widget with skeleton loading capability.

Example:

ProductCard(product: product).skeleton(isLoading: true)

Implementation

Widget skeleton({
  required bool isLoading,
  SkeletonConfig? config,
  Widget? customSkeleton,
}) {
  if (!isLoading) return this;

  return customSkeleton ??
      Skeleton.from(this, config: config ?? SkeletonConfig.defaultConfig);
}