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

Commit 906a84b

Browse files
authored
Merge pull request #293 from UnityTech/clean_warning
Clean warnings.
2 parents b39d79f + 972e6a5 commit 906a84b

File tree

10 files changed

+33
-16
lines changed

10 files changed

+33
-16
lines changed

Runtime/gestures/multitap.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ namespace Unity.UIWidgets.gestures {
1515

1616
public delegate void GestureMultiTapCancelCallback(int pointer);
1717

18-
public class _CountdownZoned {
19-
_CountdownZoned(TimeSpan duration) {
18+
class _CountdownZoned {
19+
public _CountdownZoned(TimeSpan duration) {
2020
D.assert(duration != null);
2121
this._timer = Window.instance.run(duration, this._onTimeout);
2222
}
@@ -49,6 +49,7 @@ internal _TapTracker(
4949
) {
5050
this.pointer = evt.pointer;
5151
this._initialPosition = evt.position;
52+
this._doubleTapMinTimeCountdown = new _CountdownZoned(duration: doubleTapMinTime);
5253
this.entry = entry;
5354
}
5455

@@ -320,17 +321,17 @@ public MultiTapGestureRecognizer(
320321
this.longTapDelay = longTapDelay ?? TimeSpan.Zero;
321322
}
322323

323-
GestureMultiTapDownCallback onTapDown;
324+
public GestureMultiTapDownCallback onTapDown;
324325

325-
GestureMultiTapUpCallback onTapUp;
326+
public GestureMultiTapUpCallback onTapUp;
326327

327-
GestureMultiTapCallback onTap;
328+
public GestureMultiTapCallback onTap;
328329

329-
GestureMultiTapCancelCallback onTapCancel;
330+
public GestureMultiTapCancelCallback onTapCancel;
330331

331-
TimeSpan longTapDelay;
332+
public TimeSpan longTapDelay;
332333

333-
GestureMultiTapDownCallback onLongTapDown;
334+
public GestureMultiTapDownCallback onLongTapDown;
334335

335336
readonly Dictionary<int, _TapGesture> _gestureMap = new Dictionary<int, _TapGesture>();
336337

Runtime/material/floatting_action_button_theme.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ ShapeBorder shape
5252

5353
public static FloatingActionButtonThemeData lerp(FloatingActionButtonThemeData a, FloatingActionButtonThemeData b,
5454
float t) {
55-
D.assert(t != null);
5655
if (a == null && b == null) {
5756
return null;
5857
}

Runtime/painting/text_painter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ void _computeCaretMetrics(TextPosition position, Rect caretPrototype) {
271271
this._caretMetrics = new _CaretMetrics(
272272
offset: rect != null ? new Offset(rect.left, rect.top) : this._emptyOffset,
273273
fullHeight: rect != null ? (float?) (rect.bottom - rect.top) : null);
274+
275+
// Cache the caret position. This was forgot in flutter until https://github.com/flutter/flutter/pull/38821
276+
this._previousCaretPosition = position;
277+
this._previousCaretPrototype = caretPrototype;
274278
}
275279

276280
public Paragraph.LineRange getLineRange(int lineNumber) {

Runtime/ui/painting/path.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,19 +1363,23 @@ internal static PathMetricIterator _(_PathMeasure _pathMeasure) {
13631363
return new PathMetricIterator(_pathMeasure);
13641364
}
13651365

1366-
PathMetric _pathMetric;
1366+
// PathMetric _pathMetric; // TODO
13671367
_PathMeasure _pathMeasure;
13681368

13691369
public void Reset() {
13701370
throw new NotImplementedException();
13711371
}
13721372

13731373
public PathMetric Current {
1374-
get { return this._pathMetric; }
1374+
get {
1375+
return null; // TODO : return this._pathMetric;
1376+
}
13751377
}
13761378

13771379
object IEnumerator.Current {
1378-
get { return this._pathMetric; }
1380+
get {
1381+
return null; // TODO : return this._pathMetric;
1382+
}
13791383
}
13801384

13811385
public bool MoveNext() {

Runtime/ui/painting/shadow_utils.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ float heightFunc(float x, float y) {
142142
static readonly Path _devSpacePath = new Path();
143143
public static void drawShadow(Canvas canvas, Path path, Vector3 zPlaneParams, Vector3 devLightPos,
144144
float lightRadius, uiColor ambientColor, uiColor spotColor, int flags) {
145+
#pragma warning disable CS0162
145146
if (kUseFastShadow) {
146147
drawShadowFast(canvas, path, zPlaneParams, devLightPos, lightRadius, ambientColor, spotColor, flags);
147148
}
148149
else {
149150
drawShadowFull(canvas, path, zPlaneParams, devLightPos, lightRadius, ambientColor, spotColor, flags);
150151
}
152+
#pragma warning restore CS0162
151153
}
152154

153155
//cached variables
@@ -209,6 +211,7 @@ static void drawShadowFast(Canvas canvas, Path path, Vector3 zPlaneParams, Vecto
209211
Matrix3 viewMatrix = canvas.getTotalMatrix();
210212

211213
//debug shadow
214+
#pragma warning disable CS0162
212215
if (debugShadow) {
213216
var isRRect = path.isNaiveRRect;
214217
if (isRRect) {
@@ -220,6 +223,7 @@ static void drawShadowFast(Canvas canvas, Path path, Vector3 zPlaneParams, Vecto
220223
spotColor = uiColor.fromColor(Colors.green);
221224
}
222225
}
226+
#pragma warning restore CS0162
223227

224228
//ambient light
225229
float devSpaceOutset = ambientBlurRadius(zPlaneParams.z);

Runtime/ui/renderer/allocator/debug.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public static void onFrameEnd() {
3333
return;
3434
}
3535

36+
#pragma warning disable CS0162
3637
allocCount++;
3738
if (allocCount >= 120) {
3839
allocCount = 0;
@@ -55,6 +56,7 @@ public static void onFrameEnd() {
5556

5657
Debug.Log(debugInfo);
5758
}
59+
#pragma warning restore CS0162
5860
}
5961

6062
public static void onAlloc(int objKey, string objName, int allocatedCount) {

Runtime/ui/renderer/allocator/pool_object.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ public static TObject alloc() {
3333
var ret = pool.Pop();
3434
ret.setup();
3535

36+
#pragma warning disable CS0162
3637
if (AllocDebugger.enableDebugging) {
3738
AllocDebugger.onAlloc(debugKey, debugName, allocatedCount);
3839
ret.activated_flag = true;
3940
}
41+
#pragma warning restore CS0162
4042

4143
return ret;
4244
}
@@ -46,6 +48,7 @@ public static void release(TObject obj) {
4648
return;
4749
}
4850

51+
#pragma warning disable CS0162
4952
if (AllocDebugger.enableDebugging) {
5053
if (!obj.activated_flag) {
5154
Debug.Assert(false, "an item has been recycled more than once !");
@@ -55,6 +58,7 @@ public static void release(TObject obj) {
5558

5659
AllocDebugger.onRelease(debugKey, debugName, allocatedCount);
5760
}
61+
#pragma warning restore CS0162
5862

5963
obj.clear();
6064
if (pool.Count > POOL_MAX_SIZE) {

Runtime/ui/renderer/common/geometry/matrix/ui_matrix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public bool _isFinite() {
316316
TypeMask mask = this._getType();
317317

318318
if (0 == (mask & ~(TypeMask.kScale_Mask | TypeMask.kTranslate_Mask))) {
319-
bool invertible = true;
319+
// bool invertible = true; // Fix warning: value is never used
320320

321321
if (!invertableCheck) {
322322
if ((mask & TypeMask.kScale_Mask) != 0) {

Runtime/widgets/editable_text.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ public _Editable(TextSpan textSpan = null,
10871087
this.hasFocus = hasFocus;
10881088
this.maxLines = maxLines;
10891089
this.minLines = minLines;
1090+
this.expands = expands;
10901091
this.strutStyle = strutStyle;
10911092
this.selectionColor = selectionColor;
10921093
this.textScaleFactor = textScaleFactor;

Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,16 @@ public override Widget build(BuildContext context) {
146146
},
147147
defaultTitle: "Colors"
148148
);
149-
break;
150149
case 1:
151150
return new CupertinoTabView(
152151
builder: (BuildContext _context2) => new CupertinoDemoTab2(),
153152
defaultTitle: "Support Chat"
154153
);
155-
break;
156154
case 2:
157155
return new CupertinoTabView(
158156
builder: (BuildContext _context3) => new CupertinoDemoTab3(),
159157
defaultTitle: "Account"
160158
);
161-
break;
162159
}
163160

164161
return null;
@@ -353,6 +350,7 @@ class Tab1ItemPageState : State<Tab1ItemPage> {
353350
public override void initState() {
354351
base.initState();
355352

353+
this.relatedColors = new List<Color>();
356354
for (int i = 0; i < 10; i++) {
357355
this.relatedColors.Add(
358356
Color.fromARGB(

0 commit comments

Comments
 (0)