| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import 'package:flutter/material.dart';
- class CirculoDiametro extends StatelessWidget{
- const CirculoDiametro({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return SizedBox(
- height: double.infinity,
- width: double.infinity,
- child: CustomPaint(
- painter: _CirculoDiametroPainter(),
- ),
- );
- }
- }
- class _CirculoDiametroPainter extends CustomPainter{
- @override
- void paint(Canvas canvas, Size size) {
- final paint = Paint();
- //Propiedades
- paint.color = const Color(0xFF000000);
- paint.style = PaintingStyle.stroke;
- paint.strokeWidth = 2.0;
- final path = Path();
- //Dibujar
- path.moveTo(0, size.height*0.5);
- path.lineTo(size.width, size.height*0.5);
- canvas.drawPath(path, paint);
- canvas.drawCircle(Offset(size.width*0.5, size.height*0.5), size.width*0.5, paint);
- }
- @override
- bool shouldRepaint(covariant CustomPainter oldDelegate) {
- return true;
- }
- }
|