mergeStyle method

  1. @override
DrawableGroup mergeStyle(
  1. DrawableStyle newStyle
)
override

Creates an instance with merged style information.

Implementation

@override
DrawableGroup mergeStyle(DrawableStyle newStyle) {
  assert(newStyle != null); // ignore: unnecessary_null_comparison
  final DrawableStyle mergedStyle = DrawableStyle.mergeAndBlend(
    style,
    fill: newStyle.fill,
    stroke: newStyle.stroke,
    clipPath: newStyle.clipPath,
    dashArray: newStyle.dashArray,
    dashOffset: newStyle.dashOffset,
    pathFillType: newStyle.pathFillType,
    textStyle: newStyle.textStyle,
  );

  final List<Drawable> mergedChildren =
      children!.map<Drawable>((Drawable child) {
    if (child is DrawableStyleable) {
      return child.mergeStyle(mergedStyle);
    }
    return child;
  }).toList();

  return DrawableGroup(
    id,
    mergedChildren,
    mergedStyle,
    transform: transform,
  );
}