mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
implemented topbar shape
This commit is contained in:
parent
15e187384e
commit
c70fd29cfc
1 changed files with 48 additions and 0 deletions
48
lib/screens/metering/components/topbar/topbar_shape.dart
Normal file
48
lib/screens/metering/components/topbar/topbar_shape.dart
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class TopBarShape extends CustomPainter {
|
||||||
|
final Color color;
|
||||||
|
final Size appendixSize;
|
||||||
|
final double radius;
|
||||||
|
|
||||||
|
TopBarShape({
|
||||||
|
required this.color,
|
||||||
|
required this.appendixSize,
|
||||||
|
required this.radius,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
final paint = Paint()..color = color;
|
||||||
|
final path = Path();
|
||||||
|
final circularRadius = Radius.circular(radius);
|
||||||
|
path.moveTo(size.width, 0);
|
||||||
|
path.lineTo(size.width, size.height - radius);
|
||||||
|
path.arcToPoint(
|
||||||
|
Offset(size.width - radius, size.height),
|
||||||
|
radius: circularRadius,
|
||||||
|
);
|
||||||
|
path.lineTo(size.width - appendixSize.width + radius, size.height);
|
||||||
|
path.arcToPoint(
|
||||||
|
Offset(size.width - appendixSize.width, size.height - radius),
|
||||||
|
radius: circularRadius,
|
||||||
|
);
|
||||||
|
path.lineTo(size.width - appendixSize.width, size.height - appendixSize.height + radius);
|
||||||
|
path.arcToPoint(
|
||||||
|
Offset(size.width - appendixSize.width - radius, size.height - appendixSize.height),
|
||||||
|
radius: circularRadius,
|
||||||
|
clockwise: false,
|
||||||
|
);
|
||||||
|
path.lineTo(radius, size.height - appendixSize.height);
|
||||||
|
path.arcToPoint(
|
||||||
|
Offset(0, size.height - appendixSize.height - radius),
|
||||||
|
radius: circularRadius,
|
||||||
|
);
|
||||||
|
path.lineTo(0, 0);
|
||||||
|
path.close();
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
||||||
|
}
|
Loading…
Reference in a new issue