createBoxPainter method
Returns a BoxPainter that will paint this decoration.
The onChanged
argument configures BoxPainter.onChanged. It can be
omitted if there is no chance that the painter will change (for example,
if it is a BoxDecoration with definitely no DecorationImage).
Implementation
@override
BoxPainter createBoxPainter([VoidCallback? onChanged]) {
//print("createBoxPainter : ${style.depth}");
if (style.depth != null && style.depth! >= 0) {
return NeumorphicDecorationPainter(
style: style,
drawGradient: (isForeground && splitBackgroundForeground) ||
(!isForeground && !splitBackgroundForeground),
drawBackground: !isForeground,
//only box draw background
drawShadow: !isForeground,
//only box draw shadow
renderingByPath: this.renderingByPath,
onChanged: onChanged ?? () {},
shape: shape,
);
} else {
return NeumorphicEmbossDecorationPainter(
drawBackground: !isForeground,
style: style,
drawShadow: (isForeground && splitBackgroundForeground) ||
(!isForeground && !splitBackgroundForeground),
onChanged: onChanged ?? () {},
shape: shape,
);
}
}