浏览代码

more fixes

/zxw-refine_codegen
Xingwei Zhu 3 年前
当前提交
7c2f26fc
共有 7 个文件被更改,包括 25 次插入32 次删除
  1. 12
      com.unity.uiwidgets/Runtime/cupertino/refresh.cs
  2. 20
      com.unity.uiwidgets/Runtime/material/material_state.cs
  3. 10
      com.unity.uiwidgets/Runtime/material/theme_data.cs
  4. 8
      com.unity.uiwidgets/Runtime/rendering/sliver.cs
  5. 4
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  6. 1
      com.unity.uiwidgets/Runtime/widgets/dismissible.cs
  7. 2
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs

12
com.unity.uiwidgets/Runtime/cupertino/refresh.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;

using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
float refreshIndicatorLayoutExtent = 0.0f,
bool hasLayoutExtent = false,
float? refreshIndicatorLayoutExtent = 0.0f,
bool? hasLayoutExtent = false,
this.refreshIndicatorLayoutExtent = refreshIndicatorLayoutExtent;
this.hasLayoutExtent = hasLayoutExtent;
this.refreshIndicatorLayoutExtent = refreshIndicatorLayoutExtent.Value;
this.hasLayoutExtent = hasLayoutExtent.Value;
}
public readonly float refreshIndicatorLayoutExtent;
public readonly bool hasLayoutExtent;

public float refreshIndicatorLayoutExtent {
get { return _refreshIndicatorExtent; }
set {
D.assert(value != null);
D.assert(value >= 0.0);
if (value == _refreshIndicatorExtent)
return;

public bool hasLayoutExtent {
get { return _hasLayoutExtent; }
set {
D.assert(value != null);
if (value == _hasLayoutExtent)
return;
_hasLayoutExtent = value;

20
com.unity.uiwidgets/Runtime/material/material_state.cs


abstract class MaterialStateProperty<T> : IMaterialStateProperty<T> {
public abstract T resolve(HashSet<MaterialState> states);
public static T resolveAs<T>(T value, HashSet<MaterialState> states) {
if (value is MaterialStateProperty<T> materialStateProperty) {
MaterialStateProperty<T> property = materialStateProperty;
public static S resolveAs<S>(S value, HashSet<MaterialState> states) {
if (value is MaterialStateProperty<S> materialStateProperty) {
MaterialStateProperty<S> property = materialStateProperty;
return property.resolve(states);
}

public static MaterialStateProperty<T> resolveWith<T>(material_.MaterialPropertyResolver<T> callback) =>
new _MaterialStateProperty<T>(callback);
public static MaterialStateProperty<S> resolveWith<S>(material_.MaterialPropertyResolver<S> callback) =>
new _MaterialStateProperty<S>(callback);
}

public override T resolve(HashSet<MaterialState> states) => _resolve(states);
public static T resolveAs<T>(T value, HashSet<MaterialState> states) {
if (value is MaterialStateProperty<T> materialStateProperty) {
MaterialStateProperty<T> property = materialStateProperty;
public static S resolveAs<S>(S value, HashSet<MaterialState> states) {
if (value is MaterialStateProperty<S> materialStateProperty) {
MaterialStateProperty<S> property = materialStateProperty;
return property.resolve(states);
}

public static MaterialStateProperty<T> resolveWith<T>(material_.MaterialPropertyResolver<T> callback) =>
new _MaterialStateProperty<T>(callback);
public static MaterialStateProperty<S> resolveWith<S>(material_.MaterialPropertyResolver<S> callback) =>
new _MaterialStateProperty<S>(callback);
}
}

10
com.unity.uiwidgets/Runtime/material/theme_data.cs


public class VisualDensity : Diagnosticable, IEquatable<VisualDensity> {
public VisualDensity(
float horizontal = 0.0f,
float vertical = 0.0f
float? horizontal = 0.0f,
float? vertical = 0.0f
) {
D.assert(horizontal != null);
D.assert(vertical != null);

D.assert(horizontal >= minimumDensity);
this.horizontal = horizontal;
this.vertical = vertical;
this.horizontal = horizontal.Value;
this.vertical = vertical.Value;
}
public static readonly float minimumDensity = -4.0f;

public static readonly VisualDensity standard = new VisualDensity();
public static readonly VisualDensity standard = new VisualDensity(0.0f, 0.0f);
public static readonly VisualDensity comfortable = new VisualDensity(horizontal: -1.0f, vertical: -1.0f);

8
com.unity.uiwidgets/Runtime/rendering/sliver.cs


hasErrors = true;
errorMessage.AppendLine($" {message}");
});
void verifyFloat(float property, string name, bool mustBePositive = false, bool mustBeNegative = false) {
void verifyFloat(float? property, string name, bool mustBePositive = false, bool mustBeNegative = false) {
if (property.isNaN()) {
if (property.Value.isNaN()) {
string additional = ".";
if (mustBePositive) {
additional = ", expected greater than or equal to zero.";

verify(false, $"The \"{name}\" is NaN" + $"{additional}");
} else if (mustBePositive) {
verify(property >= 0.0, $"The \"{name}\" is negative.");
verify(property >= 0.0f, $"The \"{name}\" is negative.");
verify(property <= 0.0, $"The \"{name}\" is positive.");
verify(property <= 0.0f, $"The \"{name}\" is positive.");
}
}
verify(axis != null, "The \"axis\" is null.");

4
com.unity.uiwidgets/Runtime/widgets/basic.cs


PointerUpEventListener onPointerUp = null,
PointerCancelEventListener onPointerCancel = null,
PointerSignalEventListener onPointerSignal = null,
HitTestBehavior behavior = HitTestBehavior.deferToChild,
HitTestBehavior? behavior = HitTestBehavior.deferToChild,
Widget child = null
) :
base(key: key, child: child) {

this.onPointerUp = onPointerUp;
this.onPointerCancel = onPointerCancel;
this.onPointerSignal = onPointerSignal;
this.behavior = behavior;
this.behavior = behavior.Value;
}
public readonly PointerDownEventListener onPointerDown;

1
com.unity.uiwidgets/Runtime/widgets/dismissible.cs


}
_FlingGestureKind _describeFlingGesture(Velocity velocity) {
D.assert(widget.direction != null);
if (_dragExtent == 0.0f) {
return _FlingGestureKind.none;
}

2
com.unity.uiwidgets/Runtime/widgets/focus_manager.cs


bool skipTraversal = false,
bool canRequestFocus = true
) {
D.assert(skipTraversal != null);
D.assert(canRequestFocus != null);
_skipTraversal = skipTraversal;
_canRequestFocus = canRequestFocus;
_onKey = onKey;

正在加载...
取消
保存