copyWith method

TimelineTheme copyWith({
  1. ValueGetter<BoxConstraints?>? timeConstraints,
  2. ValueGetter<double?>? spacing,
  3. ValueGetter<double?>? dotSize,
  4. ValueGetter<double?>? connectorThickness,
  5. ValueGetter<Color?>? color,
  6. ValueGetter<double?>? rowGap,
})

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.

Example:

final newTheme = originalTheme.copyWith(
  spacing: () => 24.0,
  color: () => Colors.green,
);

Implementation

TimelineTheme copyWith({
  ValueGetter<BoxConstraints?>? timeConstraints,
  ValueGetter<double?>? spacing,
  ValueGetter<double?>? dotSize,
  ValueGetter<double?>? connectorThickness,
  ValueGetter<Color?>? color,
  ValueGetter<double?>? rowGap,
}) {
  return TimelineTheme(
    timeConstraints:
        timeConstraints == null ? this.timeConstraints : timeConstraints(),
    spacing: spacing == null ? this.spacing : spacing(),
    dotSize: dotSize == null ? this.dotSize : dotSize(),
    connectorThickness: connectorThickness == null
        ? this.connectorThickness
        : connectorThickness(),
    color: color == null ? this.color : color(),
    rowGap: rowGap == null ? this.rowGap : rowGap(),
  );
}