apply method
Apply existing NikuSelectableText's property to current style
Example usage:
final style = NikuSelectableText(null)
.color(Colors.blue)
.fontSize(21)
final bold = NikuSelectableText(null)
.bold()
build(context) {
return (
NikuSelectableText("Applied Style")
.apply(style) // Will have blue color and font size of 21
.apply(bold) // Will have bold style
)
}
Implementation
NikuSelectableText apply(NikuSelectableText instance) => set(
color: instance._color ?? _color,
backgroundColor: instance._backgroundColor ?? _backgroundColor,
fontSize: instance._fontSize ?? _fontSize,
fontWeight: instance._fontWeight ?? _fontWeight,
letterSpacing: instance._letterSpacing ?? _letterSpacing,
wordSpacing: instance._wordSpacing ?? _wordSpacing,
height: instance._height ?? _height,
foreground: instance._foreground ?? _foreground,
background: instance._background ?? _background,
shadows: instance._shadows ?? _shadows,
fontFeatures: instance._fontFeatures ?? _fontFeatures,
textDecoration: instance._textDecoration ?? _textDecoration,
textDecorationColor:
instance._textDecorationColor ?? _textDecorationColor,
textDecorationThickness:
instance._textDecorationThickness ?? _textDecorationThickness,
fontFamily: instance._fontFamily ?? _fontFamily,
fontFamilyFallback: instance._fontFamilyFallback ?? _fontFamilyFallback,
textBaseline: instance._textBaseline ?? _textBaseline,
textDirection: instance._textDirection ?? _textDirection,
textAlign: instance._textAlign ?? _textAlign,
textScaleFactor: instance._textScaleFactor ?? _textScaleFactor,
maxLines: instance._maxLines ?? _maxLines,
textWidthBasis: instance._textWidthBasis ?? _textWidthBasis,
textHeightBehavior: instance._textHeightBehavior ?? _textHeightBehavior,
mt: instance.getMt != 0 ? instance.getMt : getMt,
mb: instance.getMb != 0 ? instance.getMb : getMb,
ml: instance.getMl != 0 ? instance.getMl : getMl,
mr: instance.getMr != 0 ? instance.getMr : getMr,
);