apply method
Apply existing NikuButton's property to current style
Example usage:
final padding = NikuButton(null)
.px(40)
.py(20)
final blueBackground = NikuButton(null)
.bg(Colors.blue)
build(context) {
return (
NikuButton(Text("Applied Style"))
.apply(padding) // Will have padding
.apply(blueBackground) // Will have blue background
.rounded(8) // Will have border radius of 8px
)
}
Implementation
NikuButton apply(NikuButton instance) => set(
onPressed: instance._onPressed ?? _onPressed,
onLongPressed: instance._onLongPressed ?? _onLongPressed,
focusNode: instance._focusNode ?? _focusNode,
autofocus: instance._autofocus,
clipBehavior: instance._clipBehavior,
backgroundColor: instance._backgroundColor.init
? _backgroundColor
: instance._backgroundColor,
foregroundColor: instance._foregroundColor.init
? _foregroundColor
: instance._foregroundColor,
overlayColor: instance._overlayColor.init
? _overlayColor
: instance._overlayColor,
shadowColor:
instance._shadowColor.init ? _shadowColor : instance._shadowColor,
elevation: instance._elevation.init ? _elevation : instance._elevation,
pt: instance._pt == 0 ? _pt : instance._pt,
pb: instance._pb == 0 ? _pb : instance._pb,
pl: instance._pl == 0 ? _pl : instance._pl,
pr: instance._pr == 0 ? _pr : instance._pr,
mt: instance.getMt == 0 ? getMt : instance.getMt,
mb: instance.getMb == 0 ? getMb : instance.getMb,
ml: instance.getMl == 0 ? getMl : instance.getMl,
mr: instance.getMr == 0 ? getMr : instance.getMr,
minimumSize: instance.getMinimumSize.init
? getMinimumSize
: instance.getMinimumSize,
side: instance._side.init ? _side : instance._side,
shape: instance._shape.init ? _shape : instance._shape,
mouseCursor: instance.getMouseCursor.init
? getMouseCursor
: instance.getMouseCursor,
visualDensity: instance._visualDensity ?? _visualDensity,
tapTargetSize: instance._tapTargetSize ?? _tapTargetSize,
animationDuration: instance._animationDuration ?? _animationDuration,
enableFeedback: instance._enableFeedback,
alignment: instance._alignment ?? _alignment,
label: instance._label ?? _label,
text_color:
instance._text_color.init ? _text_color : instance._text_color,
text_backgroundColor:
instance._text_backgroundColor ?? instance._text_backgroundColor,
text_fontSize: instance._text_fontSize ?? instance._text_fontSize,
text_fontWeight: instance._text_fontWeight ?? instance._text_fontWeight,
text_fontStyle: instance._text_fontStyle ?? instance._text_fontStyle,
text_letterSpacing:
instance._text_letterSpacing ?? instance._text_letterSpacing,
text_wordSpacing:
instance._text_wordSpacing ?? instance._text_wordSpacing,
text_height: instance._text_height ?? instance._text_height,
text_foreground: instance._text_foreground ?? instance._text_foreground,
text_background: instance._text_background ?? instance._text_background,
text_shadows: instance._text_shadows ?? instance._text_shadows,
text_fontFeatures:
instance._text_fontFeatures ?? instance._text_fontFeatures,
text_textDecoration:
instance._text_textDecoration ?? instance._text_textDecoration,
text_textDecorationColor: instance._text_textDecorationColor ??
instance._text_textDecorationColor,
text_textDecorationThickness: instance._text_textDecorationThickness ??
instance._text_textDecorationThickness,
text_fontFamily: instance._text_fontFamily ?? instance._text_fontFamily,
text_fontFamilyFallback: instance._text_fontFamilyFallback ??
instance._text_fontFamilyFallback,
text_textBaseline:
instance._text_textBaseline ?? instance._text_textBaseline,
);