toSvgElement method
Converts this muscle helper into an SvgElement for a specific position.
Implementation
SvgElement toSvgElement(
MusclePosition? position, {
Color fillColor = Colors.transparent,
double fillOpacity = 0,
Color strokeColor = Colors.black,
double strokeWidth = 1,
String? idSuffix,
}) {
final suffix = null == idSuffix || idSuffix.isEmpty ? '' : '_$idSuffix';
String id = switch (position) {
MusclePosition.left => 'left_$_name$suffix',
MusclePosition.right => 'right_$_name$suffix',
_ => '$_name$suffix',
};
final elmt = SvgGroup(id: id);
final paths = getSvgPath(position)
.asMap()
.map(
(idx, path) => MapEntry(
idx,
SvgPath(id: '${id}_$idx', d: path)
..fill(fillColor, opacity: fillOpacity)
..stroke(strokeColor, width: strokeWidth),
),
)
.values;
elmt.addChildren(paths);
return elmt;
}