Shimmer.fromColors constructor

Shimmer.fromColors({
  1. Key? key,
  2. required Widget child,
  3. required Color baseColor,
  4. required Color highlightColor,
  5. Duration period = const Duration(milliseconds: 1500),
  6. ShimmerDirection direction = ShimmerDirection.ltr,
  7. int loop = 0,
  8. bool enabled = true,
})

A convenient constructor provides an easy and convenient way to create a Shimmer which gradient is LinearGradient made up of baseColor and highlightColor.

Implementation

Shimmer.fromColors({
  Key? key,
  required this.child,
  required Color baseColor,
  required Color highlightColor,
  this.period = const Duration(milliseconds: 1500),
  this.direction = ShimmerDirection.ltr,
  this.loop = 0,
  this.enabled = true,
})  : gradient = LinearGradient(begin: Alignment.topLeft, end: Alignment.centerRight, colors: <Color>[baseColor, baseColor, highlightColor, baseColor, baseColor], stops: const <double>[0.0, 0.35, 0.5, 0.65, 1.0]),
      super(key: key);