copyWith method

NumberTickerTheme copyWith({
  1. ValueGetter<Duration?>? duration,
  2. ValueGetter<Curve?>? curve,
  3. ValueGetter<TextStyle?>? style,
})

Creates a copy of this theme with the given values replaced.

Uses ValueGetter functions to allow conditional updates where null getters preserve the original value.

Parameters:

  • duration (ValueGetter<Duration?>?, optional): New duration value.
  • curve (ValueGetter<Curve?>?, optional): New curve value.
  • style (ValueGetter<TextStyle?>?, optional): New text style value.

Example:

final newTheme = originalTheme.copyWith(
  duration: () => Duration(seconds: 1),
  style: () => TextStyle(color: Colors.blue),
);

Implementation

NumberTickerTheme copyWith({
  ValueGetter<Duration?>? duration,
  ValueGetter<Curve?>? curve,
  ValueGetter<TextStyle?>? style,
}) {
  return NumberTickerTheme(
    duration: duration == null ? this.duration : duration(),
    curve: curve == null ? this.curve : curve(),
    style: style == null ? this.style : style(),
  );
}