combineWith method

TextStyle combineWith(
  1. TextStyle? other
)

Combines this text style with another text style. other is the style that takes precedence.

Implementation

TextStyle combineWith(TextStyle? other) {
  other ??= this;
  return TextStyle(
    truncate: other.truncate,
    softWrap: other.softWrap,
    selectable: other.selectable,
    display: other.display ?? display,
    color: other.color ?? color,
    fontSize: other.fontSize ?? fontSize,
    backgroundColor: other.backgroundColor ?? backgroundColor,
    gradient: other.gradient ?? gradient,
    fontWeight: other.fontWeight ?? fontWeight,
    fontStyle: other.fontStyle ?? fontStyle,
    fontFamily: other.fontFamily ?? fontFamily,
    letterSpacing: other.letterSpacing ?? letterSpacing,
    wordSpacing: other.wordSpacing ?? wordSpacing,
    lineHeight: other.lineHeight ?? lineHeight,
    decorationLine: other.decorationLine ?? decorationLine,
    decorationLineColor: other.decorationLineColor ?? decorationLineColor,
    decorationStyle: other.decorationStyle ?? decorationStyle,
    decorationThickness: other.decorationThickness ?? decorationThickness,
    width: other.width ?? width,
    textAlign: other.textAlign ?? textAlign,
    maxLines: other.maxLines ?? maxLines,
    padding: other.padding ?? padding,
    margin: other.margin ?? margin,
    selectionBackgroundColor:
        other.selectionBackgroundColor ?? selectionBackgroundColor,
    selectionTextColor: other.selectionTextColor ?? selectionTextColor,
    overflow: other.overflow ?? overflow,
    extra: (extra ?? {}).combine(other.extra ?? {}),
  );
}