浏览代码
Merge branch 'zxw/1.17/material' of https://github.com/Unity-Technologies/com.unity.uiwidgets into siyaoH/1.17/material
/siyaoH-1.17-PlatformMessage
Merge branch 'zxw/1.17/material' of https://github.com/Unity-Technologies/com.unity.uiwidgets into siyaoH/1.17/material
/siyaoH-1.17-PlatformMessage
siyao
4 年前
当前提交
7f8c427a
共有 21 个文件被更改,包括 1712 次插入 和 60 次删除
-
292com.unity.uiwidgets/Runtime/material/button.cs
-
2com.unity.uiwidgets/Runtime/material/chip.cs
-
2com.unity.uiwidgets/Runtime/material/input_decorator.cs
-
2com.unity.uiwidgets/Runtime/material/list_tile.cs
-
159com.unity.uiwidgets/Runtime/material/toggleable.cs
-
2com.unity.uiwidgets/Runtime/painting/matrix_utils.cs
-
2com.unity.uiwidgets/Runtime/rendering/box.cs
-
2com.unity.uiwidgets/Runtime/rendering/editable.cs
-
2com.unity.uiwidgets/Runtime/rendering/flex.cs
-
2com.unity.uiwidgets/Runtime/rendering/list_body.cs
-
2com.unity.uiwidgets/Runtime/rendering/paragraph.cs
-
2com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
-
2com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.gen.cs
-
4com.unity.uiwidgets/Runtime/rendering/shifted_box.cs
-
2com.unity.uiwidgets/Runtime/rendering/stack.cs
-
2com.unity.uiwidgets/Runtime/rendering/table.cs
-
2com.unity.uiwidgets/Runtime/rendering/wrap.cs
-
34com.unity.uiwidgets/Runtime/ui2/geometry.cs
-
2com.unity.uiwidgets/Runtime/widgets/overlay.cs
-
1001com.unity.uiwidgets/Runtime/material/toggle_buttons.cs
-
252com.unity.uiwidgets/Runtime/material/toggle_buttons_theme.cs
1001
com.unity.uiwidgets/Runtime/material/toggle_buttons.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using System; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace Unity.UIWidgets.material { |
|||
public class ToggleButtonsThemeData : Diagnosticable,IEquatable<ToggleButtonsThemeData> { |
|||
public ToggleButtonsThemeData( |
|||
TextStyle textStyle = null, |
|||
BoxConstraints constraints = null, |
|||
Color color = null, |
|||
Color selectedColor = null, |
|||
Color disabledColor = null, |
|||
Color fillColor = null, |
|||
Color focusColor = null, |
|||
Color highlightColor = null, |
|||
Color hoverColor = null, |
|||
Color splashColor = null, |
|||
Color borderColor = null, |
|||
Color selectedBorderColor = null, |
|||
Color disabledBorderColor = null, |
|||
BorderRadius borderRadius = null, |
|||
float? borderWidth = null |
|||
) { |
|||
this.textStyle = textStyle; |
|||
this.constraints = constraints; |
|||
this.color = color; |
|||
this.selectedColor = selectedColor; |
|||
this.disabledColor = disabledColor; |
|||
this.fillColor = fillColor; |
|||
this.focusColor = focusColor; |
|||
this.highlightColor = highlightColor; |
|||
this.hoverColor = hoverColor; |
|||
this.splashColor = splashColor; |
|||
this.borderColor = borderColor; |
|||
this.selectedBorderColor = selectedBorderColor; |
|||
this.disabledBorderColor = disabledBorderColor; |
|||
this.borderRadius = borderRadius; |
|||
this.borderWidth = borderWidth; |
|||
} |
|||
|
|||
public readonly TextStyle textStyle; |
|||
|
|||
public readonly BoxConstraints constraints; |
|||
|
|||
public readonly Color color; |
|||
|
|||
public readonly Color selectedColor; |
|||
|
|||
public readonly Color disabledColor; |
|||
|
|||
public readonly Color fillColor; |
|||
|
|||
public readonly Color focusColor; |
|||
|
|||
public readonly Color highlightColor; |
|||
|
|||
public readonly Color splashColor; |
|||
|
|||
public readonly Color hoverColor; |
|||
|
|||
public readonly Color borderColor; |
|||
|
|||
public readonly Color selectedBorderColor; |
|||
|
|||
public readonly Color disabledBorderColor; |
|||
|
|||
public readonly float? borderWidth; |
|||
|
|||
public readonly BorderRadius borderRadius; |
|||
|
|||
public ToggleButtonsThemeData copyWith( |
|||
TextStyle textStyle = null, |
|||
BoxConstraints constraints = null, |
|||
Color color = null, |
|||
Color selectedColor = null, |
|||
Color disabledColor = null, |
|||
Color fillColor = null, |
|||
Color focusColor = null, |
|||
Color highlightColor = null, |
|||
Color splashColor = null, |
|||
Color hoverColor = null, |
|||
Color borderColor = null, |
|||
Color selectedBorderColor = null, |
|||
Color disabledBorderColor = null, |
|||
BorderRadius borderRadius = null, |
|||
float? borderWidth = null) { |
|||
|
|||
return new ToggleButtonsThemeData( |
|||
textStyle: textStyle ?? this.textStyle, |
|||
constraints: constraints ?? this.constraints, |
|||
color: color ?? this.color, |
|||
selectedColor: selectedColor ?? this.selectedColor, |
|||
disabledColor: disabledColor ?? this.disabledColor, |
|||
fillColor: fillColor ?? this.fillColor, |
|||
focusColor: focusColor ?? this.focusColor, |
|||
highlightColor: highlightColor ?? this.highlightColor, |
|||
hoverColor: hoverColor ?? this.hoverColor, |
|||
splashColor: splashColor ?? this.splashColor, |
|||
borderColor: borderColor ?? this.borderColor, |
|||
selectedBorderColor: selectedBorderColor ?? this.selectedBorderColor, |
|||
disabledBorderColor: disabledBorderColor ?? this.disabledBorderColor, |
|||
borderRadius: borderRadius ?? this.borderRadius, |
|||
borderWidth: borderWidth ?? this.borderWidth |
|||
); |
|||
} |
|||
public static ToggleButtonsThemeData lerp(ToggleButtonsThemeData a, ToggleButtonsThemeData b, float t) { |
|||
if (a == null && b == null) { |
|||
return null; |
|||
} |
|||
|
|||
return new ToggleButtonsThemeData( |
|||
textStyle: TextStyle.lerp(a?.textStyle, b?.textStyle, t), |
|||
constraints: BoxConstraints.lerp(a?.constraints, b?.constraints, t), |
|||
color: Color.lerp(a?.color, b?.color, t), |
|||
selectedColor: Color.lerp(a?.selectedColor, b?.selectedColor, t), |
|||
disabledColor: Color.lerp(a?.disabledColor, b?.disabledColor, t), |
|||
fillColor: Color.lerp(a?.fillColor, b?.fillColor, t), |
|||
focusColor: Color.lerp(a?.focusColor, b?.focusColor, t), |
|||
highlightColor: Color.lerp(a?.highlightColor, b?.highlightColor, t), |
|||
hoverColor: Color.lerp(a?.hoverColor, b?.hoverColor, t), |
|||
splashColor: Color.lerp(a?.splashColor, b?.splashColor, t), |
|||
borderColor: Color.lerp(a?.borderColor, b?.borderColor, t), |
|||
selectedBorderColor: Color.lerp(a?.selectedBorderColor, b?.selectedBorderColor, t), |
|||
disabledBorderColor: Color.lerp(a?.disabledBorderColor, b?.disabledBorderColor, t), |
|||
borderRadius: BorderRadius.lerp(a?.borderRadius, b?.borderRadius, t), |
|||
borderWidth: MathUtils.lerpNullableFloat(a?.borderWidth, b?.borderWidth, t) |
|||
); |
|||
} |
|||
public bool Equals(ToggleButtonsThemeData other) { |
|||
if (ReferenceEquals(null, other)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, other)) { |
|||
return true; |
|||
} |
|||
|
|||
return textStyle.Equals(other.textStyle) |
|||
&& constraints.Equals(other.constraints) |
|||
&& color.Equals(other.color) |
|||
&& selectedColor.Equals(other.selectedColor) |
|||
&& disabledColor.Equals(other.disabledColor) |
|||
&& fillColor.Equals(other.fillColor) |
|||
&& focusColor.Equals(other.focusColor) |
|||
&& highlightColor.Equals(other.highlightColor) |
|||
&& hoverColor.Equals(other.hoverColor) |
|||
&& splashColor.Equals(other.splashColor) |
|||
&& borderColor.Equals(other.borderColor) |
|||
&& selectedBorderColor.Equals(other.selectedBorderColor) |
|||
&& disabledBorderColor.Equals(other.disabledBorderColor) |
|||
&& borderRadius.Equals(other.borderRadius) |
|||
&& borderWidth.Equals(other.borderWidth); |
|||
} |
|||
|
|||
|
|||
public override bool Equals(object obj) { |
|||
if (ReferenceEquals(null, obj)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, obj)) { |
|||
return true; |
|||
} |
|||
|
|||
if (obj.GetType() != GetType()) { |
|||
return false; |
|||
} |
|||
|
|||
return Equals((ToggleButtonsThemeData) obj); |
|||
} |
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
var hashCode = (textStyle != null ? textStyle.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (constraints != null ? constraints.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (color != null ? color.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (selectedColor != null ? selectedColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (disabledColor != null ? disabledColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (fillColor != null ? fillColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (focusColor != null ? focusColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (highlightColor != null ? highlightColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (hoverColor != null ? hoverColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (splashColor != null ? splashColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (borderColor != null ? borderColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (selectedBorderColor != null ? selectedBorderColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (disabledBorderColor != null ? disabledBorderColor.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (borderRadius != null ? borderRadius.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ (borderWidth != null ? borderWidth.GetHashCode() : 0); |
|||
return hashCode; |
|||
} |
|||
|
|||
} |
|||
public static bool operator ==(ToggleButtonsThemeData left, ToggleButtonsThemeData right) { |
|||
return Equals(left, right); |
|||
} |
|||
|
|||
public static bool operator !=(ToggleButtonsThemeData left, ToggleButtonsThemeData right) { |
|||
return !Equals(left, right); |
|||
} |
|||
|
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
textStyle?.debugFillProperties(properties, prefix: "textStyle."); |
|||
properties.add( new DiagnosticsProperty<BoxConstraints>("constraints", constraints, defaultValue: null)); |
|||
properties.add( new ColorProperty("color", color, defaultValue: null)); |
|||
properties.add( new ColorProperty("selectedColor", selectedColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("disabledColor", disabledColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("fillColor", fillColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("focusColor", focusColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("highlightColor", highlightColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("hoverColor", hoverColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("splashColor", splashColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("borderColor", borderColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("selectedBorderColor", selectedBorderColor, defaultValue: null)); |
|||
properties.add( new ColorProperty("disabledBorderColor", disabledBorderColor, defaultValue: null)); |
|||
properties.add( new DiagnosticsProperty<BorderRadius>("borderRadius", borderRadius, defaultValue: null)); |
|||
properties.add( new FloatProperty("borderWidth", borderWidth, defaultValue: null)); |
|||
} |
|||
} |
|||
|
|||
public class ToggleButtonsTheme : InheritedTheme { |
|||
public ToggleButtonsTheme( |
|||
Key key = null, |
|||
ToggleButtonsThemeData data = null, |
|||
Widget child = null |
|||
) : base(key: key, child: child) { |
|||
D.assert(data != null); |
|||
this.data = data; |
|||
} |
|||
|
|||
public readonly ToggleButtonsThemeData data; |
|||
|
|||
public static ToggleButtonsThemeData of(BuildContext context) { |
|||
ToggleButtonsTheme toggleButtonsTheme = context.dependOnInheritedWidgetOfExactType<ToggleButtonsTheme>(); |
|||
return toggleButtonsTheme?.data ?? Theme.of(context).toggleButtonsTheme; |
|||
} |
|||
|
|||
public override Widget wrap(BuildContext context, Widget child) { |
|||
ToggleButtonsTheme ancestorTheme = context.findAncestorWidgetOfExactType<ToggleButtonsTheme>(); |
|||
return ReferenceEquals(this, ancestorTheme) ? child : new ToggleButtonsTheme(data: data, child: child); |
|||
} |
|||
|
|||
public override bool updateShouldNotify(InheritedWidget oldWidget) { |
|||
D.assert(oldWidget is ToggleButtonsTheme); |
|||
return data != ((ToggleButtonsTheme)oldWidget).data; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue