resized method

SvgWrapper resized({
  1. double? width,
  2. double? height,
})

Returns a new svg resized

Implementation

SvgWrapper resized({double? width, double? height}) {
  String newContent = content;

  if (width != null) {
    newContent = newContent.replaceFirst(
        RegExp(r'width="[0-9\.\-]+"'), 'width="$width"');
  }
  if (height != null) {
    newContent = newContent.replaceFirst(
        RegExp(r'height="[0-9\.\-]+"'), 'height="$height"');
  }

  return SvgWrapper(name: name, content: newContent);
}