2
2
using Unity . UIWidgets . foundation ;
3
3
using Unity . UIWidgets . ui ;
4
4
5
- namespace Unity . UIWidgets . widgets
6
- {
7
- internal class _Placeholderpainter : AbstractCustomPainter
8
- {
5
+ namespace Unity . UIWidgets . widgets {
6
+ class _Placeholderpainter : AbstractCustomPainter {
9
7
public _Placeholderpainter (
10
8
Color color ,
11
9
float strokeWidth = 0f
12
- )
13
- {
10
+ ) {
14
11
this . color = color ;
15
12
this . strokeWidth = strokeWidth ;
16
13
}
@@ -19,12 +16,11 @@ public _Placeholderpainter(
19
16
public readonly Color color ;
20
17
public readonly float strokeWidth ;
21
18
22
- public override void paint ( Canvas canvas , Size size )
23
- {
19
+ public override void paint ( Canvas canvas , Size size ) {
24
20
Paint paint = new Paint ( ) ;
25
- paint . color = color ;
21
+ paint . color = this . color ;
26
22
paint . style = PaintingStyle . stroke ;
27
- paint . strokeWidth = strokeWidth ;
23
+ paint . strokeWidth = this . strokeWidth ;
28
24
29
25
Rect rect = Offset . zero & size ;
30
26
Path path = new Path ( ) ;
@@ -36,28 +32,24 @@ public override void paint(Canvas canvas, Size size)
36
32
return ;
37
33
}
38
34
39
- public override bool shouldRepaint ( CustomPainter oldPainter )
40
- {
41
- return ( ( _Placeholderpainter ) oldPainter ) . color != color ||
42
- ( ( _Placeholderpainter ) oldPainter ) . strokeWidth != strokeWidth ;
35
+ public override bool shouldRepaint ( CustomPainter oldPainter ) {
36
+ return ( ( _Placeholderpainter ) oldPainter ) . color != this . color ||
37
+ ( ( _Placeholderpainter ) oldPainter ) . strokeWidth != this . strokeWidth ;
43
38
}
44
39
45
- public override bool ? hitTest ( Offset position )
46
- {
40
+ public override bool ? hitTest ( Offset position ) {
47
41
return false ;
48
42
}
49
43
}
50
44
51
- public class Placeholder : StatelessWidget
52
- {
45
+ public class Placeholder : StatelessWidget {
53
46
public Placeholder (
54
47
Key key = null ,
55
48
Color color = null ,
56
49
float strokeWidth = 2.0f ,
57
50
float fallbackWidth = 400.0f ,
58
51
float fallbackHeight = 400.0f
59
- ) : base ( key )
60
- {
52
+ ) : base ( key ) {
61
53
this . color = color ?? new Color ( 0xFF455A64 ) ;
62
54
this . strokeWidth = strokeWidth ;
63
55
this . fallbackWidth = fallbackWidth ;
@@ -69,16 +61,15 @@ public Placeholder(
69
61
public readonly float fallbackWidth ;
70
62
public readonly float fallbackHeight ;
71
63
72
- public override Widget build ( BuildContext context )
73
- {
64
+ public override Widget build ( BuildContext context ) {
74
65
return new LimitedBox (
75
- maxWidth : fallbackWidth ,
76
- maxHeight : fallbackHeight ,
66
+ maxWidth : this . fallbackWidth ,
67
+ maxHeight : this . fallbackHeight ,
77
68
child : new CustomPaint (
78
69
size : Size . infinite ,
79
70
foregroundPainter : new _Placeholderpainter (
80
- color : color ,
81
- strokeWidth : strokeWidth
71
+ color : this . color ,
72
+ strokeWidth : this . strokeWidth
82
73
)
83
74
)
84
75
) ;
0 commit comments