You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/painters/as_numberic_painter.dart

38 lines
1.0 KiB

import 'package:flutter/material.dart';
3 years ago
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASNUmericPainter extends CustomPainter {
final bool plus;
ASNUmericPainter.minus() : this.plus = false;
ASNUmericPainter.plus() : this.plus = true;
@override
void paint(Canvas canvas, Size size) {
double halfWidth = size.width / 2;
double halfHeight = size.height / 2;
Paint paint = Paint()
..color = Colors.black
..style = PaintingStyle.stroke
..strokeWidth = 1.w;
canvas.drawCircle(Offset(halfWidth, halfHeight), 16.w / 2, paint);
canvas.drawLine(
Offset(halfWidth - 3, halfHeight),
Offset(halfWidth + 3, halfHeight),
paint,
);
if (plus) {
canvas.drawLine(
Offset(halfWidth, halfHeight - 3),
Offset(halfWidth, halfHeight + 3),
paint,
);
}
}
@override
bool shouldRepaint(ASNUmericPainter oldDelegate) => false;
@override
bool shouldRebuildSemantics(ASNUmericPainter oldDelegate) => false;
}