build method

  1. @override
Widget build(
  1. BuildContext context
)
override

ControlButton widget

Implementation

@override
Widget build(BuildContext context) {
  final sectionSize = 360 ~/ sections.length;

  return GestureDetector(
    onTapDown: (TapDownDetails tapDetails) {
      double position = Angles().fixedToDegrees(sectionOffset) +
          CoordinatesProcessing().getAngle(
            new Coordinates(
              posx: tapDetails.localPosition.dx,
              posy: tapDetails.localPosition.dy,
            ),
          );
      if (position > 360.0) position -= 360.0;
      position = sections[position ~/ sectionSize]();
    },
    child: Container(
      width: externalDiameter,
      height: externalDiameter,
      decoration: BoxDecoration(
        color: externalColor,
        shape: BoxShape.circle,
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.2),
            blurRadius: 1,
            spreadRadius: elevation,
            offset: shadowDirection,
          ),
        ],
      ),
      child: CustomPaint(
        painter: PainterClass(
          angle: sectionOffset,
          sections: sections.length,
          dividerColor: dividerColor,
          dividerThickness: dividerThickness,
        ),
        child: Center(
          child: GestureDetector(
            onTap: mainAction(),
            child: Container(
              width: internalDiameter,
              height: internalDiameter,
              decoration: BoxDecoration(
                color: internalColor,
                shape: BoxShape.circle,
                boxShadow: [
                  BoxShadow(
                    color: Colors.black.withOpacity(0.2),
                    blurRadius: 1,
                    spreadRadius: elevation,
                    offset: shadowDirection,
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    ),
  );
}