merge method

Creates a new MacosTypography where each text style from this object has been merged with the matching text style from the other object.

The merging is done by calling TextStyle.merge on each respective pair of text styles from this and the other typographies and is subject to the value of TextStyle.inherit flag. For more details, see the documentation on TextStyle.merge and TextStyle.inherit.

If this theme, or the other theme has members that are null, then the non-null one (if any) is used. If the other theme is itself null, then this MacosTypography is returned unchanged. If values in both are set, then the values are merged using TextStyle.merge.

This is particularly useful if one MacosTypography defines one set of properties and another defines a different set, e.g. having colors defined in one typography and font sizes in another, or when one MacosTypography has only some fields defined, and you want to define the rest by merging it with a default theme.

Implementation

MacosTypography merge(MacosTypography? other) {
  if (other == null) return this;
  return MacosTypography.raw(
    largeTitle: largeTitle.merge(other.largeTitle),
    title1: title1.merge(other.title1),
    title2: title2.merge(other.title2),
    title3: title3.merge(other.title3),
    headline: headline.merge(other.headline),
    subheadline: subheadline.merge(other.subheadline),
    body: body.merge(other.body),
    callout: callout.merge(other.callout),
    footnote: callout.merge(other.footnote),
    caption1: caption1.merge(other.caption1),
    caption2: caption2.merge(other.caption2),
  );
}