Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ValeryPonomarenko/32e8360c92e71a066b208fd4c367cf91 to your computer and use it in GitHub Desktop.
Save ValeryPonomarenko/32e8360c92e71a066b208fd4c367cf91 to your computer and use it in GitHub Desktop.
class _DiagramPainter extends CustomPainter {
_DiagramPainter({
required this.dotRadius,
required this.startBarRadius,
required this.layers,
required this.layersSpacing,
required this.dotsSpacing,
required this.progress,
required Color dotColor,
required Color progressDotColor,
}) : _paint = Paint()
..color = dotColor
..style = PaintingStyle.fill,
_progressPaint = Paint()
..color = progressDotColor
..style = PaintingStyle.fill,
_dotDiameter = dotRadius * 2,
_dotsSizeWithSpacing = dotRadius * 2 + dotsSpacing;
final double dotRadius;
final double startBarRadius;
final int layers;
final double layersSpacing;
final double dotsSpacing;
final double progress;
final Paint _paint;
final Paint _progressPaint;
final double _dotDiameter;
final double _dotsSizeWithSpacing;
static const _startAngle = 270.0;
static const _circle = 360.0;
static const _halfCircle = 180.0;
@override
void paint(Canvas canvas, Size size) {
// implement this later
}
@override
bool shouldRepaint(covariant _DiagramPainter oldDelegate) =>
dotRadius != oldDelegate.dotRadius ||
startBarRadius != oldDelegate.startBarRadius ||
layers != oldDelegate.layers ||
layersSpacing != oldDelegate.layersSpacing ||
dotsSpacing != oldDelegate.dotsSpacing ||
progress != oldDelegate.progress;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment