copyOnlyInherited method

CSS3 copyOnlyInherited(
  1. CSS3 child
)

Implementation

CSS3 copyOnlyInherited(CSS3 child) {
  FontSize? finalFontSize = FontSize.inherit(fontSize, child.fontSize);

  LineHeight? finalLineHeight = child.lineHeight != null
      ? child.lineHeight?.units == "length"
          ? LineHeight(
              child.lineHeight!.size! / (finalFontSize == null ? 14 : finalFontSize.value) * 1.2)
          : child.lineHeight
      : lineHeight;

  return child.copyWith(
    backgroundColor:
        child.backgroundColor != Colors.transparent ? child.backgroundColor : backgroundColor,
    color: child.color ?? color,
    direction: child.direction ?? direction,
    display: display == Display.none ? display : child.display,
    fontFamily: child.fontFamily ?? fontFamily,
    fontFamilyFallback: child.fontFamilyFallback ?? fontFamilyFallback,
    fontFeatureSettings: child.fontFeatureSettings ?? fontFeatureSettings,
    fontSize: finalFontSize,
    fontStyle: child.fontStyle ?? fontStyle,
    fontWeight: child.fontWeight ?? fontWeight,
    lineHeight: finalLineHeight,
    letterSpacing: child.letterSpacing ?? letterSpacing,
    listStyleImage: child.listStyleImage ?? listStyleImage,
    listStyleType: child.listStyleType ?? listStyleType,
    listStylePosition: child.listStylePosition ?? listStylePosition,
    textAlign: child.textAlign ?? textAlign,
    textDecoration: TextDecoration.combine([
      child.textDecoration ?? TextDecoration.none,
      textDecoration ?? TextDecoration.none,
    ]),
    textShadow: child.textShadow ?? textShadow,
    whiteSpace: child.whiteSpace ?? whiteSpace,
    wordSpacing: child.wordSpacing ?? wordSpacing,
    maxLines: child.maxLines ?? maxLines,
    textOverflow: child.textOverflow ?? textOverflow,
    textTransform: child.textTransform ?? textTransform,
  );
}