File tree 6 files changed +84
-0
lines changed
6 files changed +84
-0
lines changed Original file line number Diff line number Diff line change @@ -25,3 +25,5 @@ doc/api/
25
25
26
26
.flutter-plugins
27
27
.flutter-plugins-dependencies
28
+
29
+ .DS_Store
Original file line number Diff line number Diff line change @@ -247,6 +247,10 @@ part 'models/geometry.dart';
247
247
248
248
part 'my_service/my_service.dart' ;
249
249
250
+ // shapes
251
+
252
+ part 'shapes/circle.dart' ;
253
+
250
254
// test_data
251
255
252
256
part 'test_data/test_data.dart' ;
Original file line number Diff line number Diff line change @@ -31,9 +31,11 @@ class DimensionsThemeData {
31
31
this .lineThicknessS = 0.5 ,
32
32
this .lineThicknessM = 1.0 ,
33
33
this .lineThicknessL = 2.0 ,
34
+ this .borderThicknessXS = 1.0 ,
34
35
this .borderThicknessS = 2.0 ,
35
36
this .borderThicknessM = 3.0 ,
36
37
this .borderThicknessL = 5.0 ,
38
+ this .borderThicknessXL = 8.0 ,
37
39
this .iconSizeXS = 13.0 ,
38
40
this .iconSizeS = 21.0 ,
39
41
this .iconSizeM = 34.0 ,
@@ -73,9 +75,11 @@ class DimensionsThemeData {
73
75
final double barHeightL;
74
76
final double barHeightXL;
75
77
78
+ final double borderThicknessXS;
76
79
final double borderThicknessS;
77
80
final double borderThicknessM;
78
81
final double borderThicknessL;
82
+ final double borderThicknessXL;
79
83
80
84
final double lineThicknessS;
81
85
final double lineThicknessM;
Original file line number Diff line number Diff line change
1
+ part of devspace;
2
+
3
+
4
+ class Circle extends StatelessWidget
5
+ {
6
+ final double ? strokeWidth;
7
+ final Color ? color;
8
+ final Widget ? child;
9
+
10
+ const Circle ({
11
+ super .key,
12
+ this .color,
13
+ // setting strokeWith to 0.0 will fill the circle entirely
14
+ this .strokeWidth,
15
+ this .child,
16
+ });
17
+
18
+ @override
19
+ Widget build (BuildContext context)
20
+ {
21
+ Color col = color ?? context.colors.primary;
22
+ double width = strokeWidth ?? context.dimensions.borderThicknessM;
23
+
24
+ return CustomPaint (
25
+ painter: CirclePainter (
26
+ color: col,
27
+ strokeWidth: width,
28
+ ),
29
+ child: child,
30
+ );
31
+ }
32
+ }
33
+
34
+ class CirclePainter extends CustomPainter {
35
+
36
+ final Color color;
37
+ final double strokeWidth;
38
+
39
+ CirclePainter ({
40
+ required this .color,
41
+ required this .strokeWidth,
42
+ });
43
+
44
+ @override
45
+ void paint (Canvas canvas, Size size)
46
+ {
47
+ Dev .log ('CirclePainter.paint' , 'size' , size);
48
+ final paint = Paint ()
49
+ ..color = color
50
+ ..strokeWidth = strokeWidth
51
+ ..style = strokeWidth == 0.0 ? PaintingStyle .fill : PaintingStyle .stroke;
52
+
53
+ final center = Offset (size.width / 2 , size.height / 2 );
54
+
55
+ final radius = size.width / 2 ;
56
+
57
+ canvas.drawCircle (center, radius, paint);
58
+ }
59
+
60
+ @override
61
+ bool shouldRepaint (covariant CustomPainter oldDelegate)
62
+ {
63
+ return false ;
64
+ }
65
+ }
Original file line number Diff line number Diff line change @@ -15,11 +15,13 @@ extension DoubleExtension on double {
15
15
return math.Random ().nextDouble () < this ;
16
16
}
17
17
18
+ /// Converts the double from degrees to radians.
18
19
double toRadian ()
19
20
{
20
21
return this / 180 * math.pi;
21
22
}
22
23
24
+ /// Converts the double from radians to degrees.
23
25
double toDegree ()
24
26
{
25
27
return this / math.pi * 180 ;
Original file line number Diff line number Diff line change @@ -28,4 +28,11 @@ extension IntExtension on int {
28
28
{
29
29
return List .generate (this , generator);
30
30
}
31
+
32
+
33
+ /// Converts the int from degrees to radians.
34
+ double toRadian ()
35
+ {
36
+ return toDouble ().toRadian ();
37
+ }
31
38
}
You can’t perform that action at this time.
0 commit comments