merge method
Merges another style onto this one.
Attributes in other take precedence if they are not null or default.
Implementation
Style merge(Style other) {
var nextModifiers = modifiers | other.modifiers;
if ((other.modifiers & Modifier.underlineStyleMask) != 0) {
nextModifiers =
(nextModifiers & ~Modifier.underlineStyleMask) |
(other.modifiers & Modifier.underlineStyleMask);
}
// Clear transparent bit if merging with a style that is not transparent.
if (!Modifier.has(other.modifiers, Modifier.transparent)) {
nextModifiers &= ~Modifier.transparent;
}
return Style(
foreground: other.foreground ?? foreground,
background: other.background ?? background,
underlineColor: other.underlineColor ?? underlineColor,
uri: other.uri ?? uri,
modifiers: nextModifiers,
);
}