drawBackgroundArcOfSectors method
void
drawBackgroundArcOfSectors(
- Canvas canvas,
- Size canvasSize, {
- Color color = const Color.fromRGBO(128, 128, 128, 1),
- required List<
SectorAttributes> allSectorAttributes, - Offset centerOffset = const Offset(0, 0),
- double assemblyAngle = 175,
- required double angleArcDegrees,
- double angleOffset = 0,
- required double insideHole,
- required double rayonArc,
- double backgroundOpacity = 0.1,
- required Color widgetColorBackground,
Implementation
void drawBackgroundArcOfSectors(Canvas canvas, Size canvasSize,
{Color color = const Color.fromRGBO(128, 128, 128, 1),
required List<SectorAttributes> allSectorAttributes,
Offset centerOffset = const Offset(0, 0),
double assemblyAngle = 175,
required double angleArcDegrees,
double angleOffset = 0,
required double insideHole,
required double rayonArc,
double backgroundOpacity = 0.1,
required Color widgetColorBackground}) {
double angleDebut = ((-angleArcDegrees / 2) + angleOffset);
final paint = new Paint();
paint.color = color;
var center = Offset(canvasSize.width / 2, canvasSize.height / 2);
// print("&&&&& allSectorAttributes &&&&& " + allSectorAttributes.length.toString());
int allSectorsSize = 0;
for (SectorAttributes sector in allSectorAttributes) {
// print("* sectorSize = " + sector.size.toString());
allSectorsSize += sector.size;
}
// print("allSectorsSize = " + allSectorsSize.toString());
double arcOffset = 0;
for (SectorAttributes sector in allSectorAttributes) {
paint.color = sector.elementColor ?? backgroundColor;
double sweep = sector.size / allSectorsSize * angleArcDegrees;
drawAnArc(canvas, paint,
center: center,
centerOffset: centerOffset,
rayonArc: rayonArc,
startAngleInDegrees:
angleDebut.degreesToRadians + arcOffset.degreesToRadians,
sweepAngleInDegrees: sweep.degreesToRadians);
arcOffset += sweep;
}
final paintBackground = new Paint();
paintBackground.color =
widgetColorBackground.withOpacity(1 - backgroundOpacity);
drawAnArc(canvas, paintBackground,
center: center,
centerOffset: centerOffset,
rayonArc: insideHole,
startAngleInDegrees: angleDebut.degreesToRadians,
sweepAngleInDegrees: assemblyAngle.degreesToRadians);
}