Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 7636644

Browse files
authored
Merge pull request #244 from IIzzaya/iizzaya
Code Format in placeholder
2 parents 1da4988 + 9530539 commit 7636644

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

Runtime/widgets/placeholder.cs

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
using Unity.UIWidgets.foundation;
33
using Unity.UIWidgets.ui;
44

5-
namespace Unity.UIWidgets.widgets
6-
{
7-
internal class _Placeholderpainter : AbstractCustomPainter
8-
{
5+
namespace Unity.UIWidgets.widgets {
6+
class _Placeholderpainter : AbstractCustomPainter {
97
public _Placeholderpainter(
108
Color color,
119
float strokeWidth = 0f
12-
)
13-
{
10+
) {
1411
this.color = color;
1512
this.strokeWidth = strokeWidth;
1613
}
@@ -19,12 +16,11 @@ public _Placeholderpainter(
1916
public readonly Color color;
2017
public readonly float strokeWidth;
2118

22-
public override void paint(Canvas canvas, Size size)
23-
{
19+
public override void paint(Canvas canvas, Size size) {
2420
Paint paint = new Paint();
25-
paint.color = color;
21+
paint.color = this.color;
2622
paint.style = PaintingStyle.stroke;
27-
paint.strokeWidth = strokeWidth;
23+
paint.strokeWidth = this.strokeWidth;
2824

2925
Rect rect = Offset.zero & size;
3026
Path path = new Path();
@@ -36,28 +32,24 @@ public override void paint(Canvas canvas, Size size)
3632
return;
3733
}
3834

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;
4338
}
4439

45-
public override bool? hitTest(Offset position)
46-
{
40+
public override bool? hitTest(Offset position) {
4741
return false;
4842
}
4943
}
5044

51-
public class Placeholder : StatelessWidget
52-
{
45+
public class Placeholder : StatelessWidget {
5346
public Placeholder(
5447
Key key = null,
5548
Color color = null,
5649
float strokeWidth = 2.0f,
5750
float fallbackWidth = 400.0f,
5851
float fallbackHeight = 400.0f
59-
) : base(key)
60-
{
52+
) : base(key) {
6153
this.color = color ?? new Color(0xFF455A64);
6254
this.strokeWidth = strokeWidth;
6355
this.fallbackWidth = fallbackWidth;
@@ -69,16 +61,15 @@ public Placeholder(
6961
public readonly float fallbackWidth;
7062
public readonly float fallbackHeight;
7163

72-
public override Widget build(BuildContext context)
73-
{
64+
public override Widget build(BuildContext context) {
7465
return new LimitedBox(
75-
maxWidth: fallbackWidth,
76-
maxHeight: fallbackHeight,
66+
maxWidth: this.fallbackWidth,
67+
maxHeight: this.fallbackHeight,
7768
child: new CustomPaint(
7869
size: Size.infinite,
7970
foregroundPainter: new _Placeholderpainter(
80-
color: color,
81-
strokeWidth: strokeWidth
71+
color: this.color,
72+
strokeWidth: this.strokeWidth
8273
)
8374
)
8475
);

0 commit comments

Comments
 (0)