copyWith method

SkeletonTheme copyWith({
  1. ValueGetter<Duration?>? duration,
  2. ValueGetter<Color?>? fromColor,
  3. ValueGetter<Color?>? toColor,
  4. ValueGetter<bool?>? enableSwitchAnimation,
})

Returns a copy of this theme with the given fields replaced.

Implementation

SkeletonTheme copyWith({
  ValueGetter<Duration?>? duration,
  ValueGetter<Color?>? fromColor,
  ValueGetter<Color?>? toColor,
  ValueGetter<bool?>? enableSwitchAnimation,
}) {
  return SkeletonTheme(
    duration: duration == null ? this.duration : duration(),
    fromColor: fromColor == null ? this.fromColor : fromColor(),
    toColor: toColor == null ? this.toColor : toColor(),
    enableSwitchAnimation: enableSwitchAnimation == null
        ? this.enableSwitchAnimation
        : enableSwitchAnimation(),
  );
}