浏览代码

update

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
6440673e
共有 9 个文件被更改,包括 609 次插入9 次删除
  1. 2
      com.unity.uiwidgets/Runtime/material/ink_well.cs
  2. 64
      com.unity.uiwidgets/Runtime/material/material_button.cs
  3. 2
      com.unity.uiwidgets/Runtime/material/navigation_rail.cs
  4. 6
      com.unity.uiwidgets/Runtime/material/theme_data.cs
  5. 6
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  6. 135
      com.unity.uiwidgets/Runtime/material/banner_theme.cs
  7. 123
      com.unity.uiwidgets/Runtime/material/button_sheet_theme.cs
  8. 144
      com.unity.uiwidgets/Runtime/material/divider_theme.cs
  9. 136
      com.unity.uiwidgets/Runtime/material/popup_menu_theme.cs

2
com.unity.uiwidgets/Runtime/material/ink_well.cs


}
void _updateFocusHighlights() {
bool showFocus;
bool showFocus = false;
switch (FocusManager.instance.highlightMode) {
case FocusHighlightMode.touch: {
showFocus = false;

64
com.unity.uiwidgets/Runtime/material/material_button.cs


public MaterialButton(
Key key = null,
VoidCallback onPressed = null,
VoidCallback onLongPress = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme? textTheme = null,
Color textColor = null,

Color focusColor = null,
Color hoverColor = null,
float? focusElevation = null,
float? hoverElevation = null,
VisualDensity visualDensity = null,
FocusNode focusNode = null,
bool? autofocus = false,
bool? enableFeedback = true,
D.assert(clipBehavior != null);
D.assert(autofocus != null);
D.assert(elevation == null || elevation >= 0.0f);
D.assert(focusElevation == null || focusElevation >= 0.0f);
D.assert(hoverElevation == null || hoverElevation >= 0.0f);
D.assert(highlightElevation == null || highlightElevation >= 0.0f);
D.assert(disabledElevation == null || disabledElevation >= 0.0f);
this.onLongPress = onLongPress;
this.onHighlightChanged = onHighlightChanged;
this.textTheme = textTheme;
this.textColor = textColor;

this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.focusElevation = focusElevation;
this.hoverElevation = hoverElevation;
this.visualDensity = visualDensity;
this.focusNode = focusNode;
this.enableFeedback = enableFeedback;
public readonly VoidCallback onLongPress;
public readonly ValueChanged<bool> onHighlightChanged;

public readonly Color focusColor;
public readonly Color hoverColor;
public readonly Color highlightColor;
public readonly float? elevation;

public readonly float? focusElevation;
public readonly float? highlightElevation;
public readonly float? disabledElevation;

}
public readonly EdgeInsets padding;
public readonly VisualDensity visualDensity;
public readonly ShapeBorder shape;

public readonly FocusNode focusNode;
public readonly bool? autofocus;
public readonly TimeSpan? animationDuration;
public readonly MaterialTapTargetSize? materialTapTargetSize;

public readonly float? height;
public readonly bool? enableFeedback;
public override Widget build(BuildContext context) {
ThemeData theme = Theme.of(context);
ButtonThemeData buttonTheme = ButtonTheme.of(context);

onLongPress:() => onLongPress(),
enableFeedback: enableFeedback?? true,
focusColor: focusColor ?? buttonTheme.getFocusColor(this) ?? theme.focusColor,
hoverColor: hoverColor ?? buttonTheme.getHoverColor(this) ?? theme.hoverColor,
focusElevation: buttonTheme.getFocusElevation(this),
hoverElevation: buttonTheme.getHoverElevation(this),
visualDensity: visualDensity ?? theme.visualDensity,
focusNode: focusNode,
autofocus: autofocus ?? false,
animationDuration: buttonTheme.getAnimationDuration(this),
child: child,
materialTapTargetSize: materialTapTargetSize ?? theme.materialTapTargetSize);

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FlagProperty("enabled", value: enabled, ifFalse: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", textTheme, defaultValue: null));
properties.add(new ColorProperty("textColor", textColor, defaultValue: null));
properties.add(new ColorProperty("disabledTextColor", disabledTextColor, defaultValue: null));
properties.add(new ColorProperty("color", color, defaultValue: null));
properties.add(new ColorProperty("disabledColor", disabledColor, defaultValue: null));
properties.add(new ColorProperty("focusColor", focusColor, defaultValue: null));
properties.add(new ColorProperty("hoverColor", hoverColor, defaultValue: null));
properties.add(new ColorProperty("highlightColor", highlightColor, defaultValue: null));
properties.add(new ColorProperty("splashColor", splashColor, defaultValue: null));
properties.add(
new DiagnosticsProperty<Brightness?>("colorBrightness", colorBrightness, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<VisualDensity>("visualDensity", visualDensity, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<FocusNode>("focusNode", focusNode, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
materialTapTargetSize, defaultValue: null));
}
}

2
com.unity.uiwidgets/Runtime/material/navigation_rail.cs


type: MaterialType.transparency,
clipBehavior: Clip.none,
child: new InkResponse(
onTap: onTap,
onTap: () => onTap(),
onHover: (_) => { },
highlightShape:
BoxShape.rectangle,

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


public readonly Brightness brightness;
public readonly VisualDensity visualDensity;
public readonly Color primaryColor;

public readonly Color cardColor;
public readonly Color dividerColor;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly Color highlightColor;

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


public class Align : SingleChildRenderObjectWidget {
public Align(
Key key = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
float? widthFactor = null,
float? heightFactor = null,
Widget child = null

this.alignment = alignment ?? Alignment.center;
//TODO: update to AlignmentGeometry
this.alignment = (Alignment) alignment ?? Alignment.center;
this.widthFactor = widthFactor;
this.heightFactor = heightFactor;
}

135
com.unity.uiwidgets/Runtime/material/banner_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class MaterialBannerThemeData : Diagnosticable, IEquatable<MaterialBannerThemeData> {
public MaterialBannerThemeData(
Color backgroundColor = null,
TextStyle contentTextStyle = null,
EdgeInsetsGeometry padding = null,
EdgeInsetsGeometry leadingPadding = null
) {
this.backgroundColor = backgroundColor;
this.contentTextStyle = contentTextStyle;
this.padding = padding;
this.leadingPadding = leadingPadding;
}
public readonly Color backgroundColor;
public readonly TextStyle contentTextStyle;
public readonly EdgeInsetsGeometry padding;
public readonly EdgeInsetsGeometry leadingPadding;
public MaterialBannerThemeData copyWith(
Color backgroundColor = null,
TextStyle contentTextStyle = null,
EdgeInsetsGeometry padding = null,
EdgeInsetsGeometry leadingPadding = null
) {
return new MaterialBannerThemeData(
backgroundColor: backgroundColor ?? this.backgroundColor,
contentTextStyle: contentTextStyle ?? this.contentTextStyle,
padding: padding ?? this.padding,
leadingPadding: leadingPadding ?? this.leadingPadding
);
}
public static MaterialBannerThemeData lerp(MaterialBannerThemeData a, MaterialBannerThemeData b, float t) {
return new MaterialBannerThemeData(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t),
padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
leadingPadding: EdgeInsetsGeometry.lerp(a?.leadingPadding, b?.leadingPadding, t)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new ColorProperty("backgroundColor", backgroundColor, defaultValue: null));
properties.add(
new DiagnosticsProperty<TextStyle>("contentTextStyle", contentTextStyle, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding, defaultValue: null));
properties.add(
new DiagnosticsProperty<EdgeInsetsGeometry>("leadingPadding", leadingPadding, defaultValue: null));
}
public static bool operator ==(MaterialBannerThemeData self, MaterialBannerThemeData other) {
return Equals(self, other);
}
public static bool operator !=(MaterialBannerThemeData self, MaterialBannerThemeData other) {
return !Equals(self, other);
}
public bool Equals(MaterialBannerThemeData other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(backgroundColor, other.backgroundColor) && Equals(contentTextStyle, other.contentTextStyle) &&
Equals(padding, other.padding) && Equals(leadingPadding, other.leadingPadding);
}
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((MaterialBannerThemeData) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (backgroundColor != null ? backgroundColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (contentTextStyle != null ? contentTextStyle.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (padding != null ? padding.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (leadingPadding != null ? leadingPadding.GetHashCode() : 0);
return hashCode;
}
}
}
public class MaterialBannerTheme : InheritedTheme {
public MaterialBannerTheme(
Key key = null,
MaterialBannerThemeData data = null,
Widget child = null
) : base(key: key, child: child) {
this.data = data;
}
public readonly MaterialBannerThemeData data;
static MaterialBannerThemeData of(BuildContext context) {
MaterialBannerTheme bannerTheme = context.dependOnInheritedWidgetOfExactType<MaterialBannerTheme>();
return bannerTheme?.data ?? Theme.of(context).bannerTheme;
}
public override Widget wrap(BuildContext context, Widget child) {
MaterialBannerTheme ancestorTheme = context.findAncestorWidgetOfExactType<MaterialBannerTheme>();
return ReferenceEquals(this, ancestorTheme) ? child : new MaterialBannerTheme(data: data, child: child);
}
public override bool updateShouldNotify(InheritedWidget oldWidget) =>
oldWidget is MaterialBannerTheme materialBannerTheme && data != materialBannerTheme.data;
}
}

123
com.unity.uiwidgets/Runtime/material/button_sheet_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
public class BottomSheetThemeData : Diagnosticable, IEquatable<BottomSheetThemeData> {
public BottomSheetThemeData(
Color backgroundColor = null,
float? elevation = null,
Color modalBackgroundColor = null,
float? modalElevation = null,
ShapeBorder shape = null,
Clip? clipBehavior = null
) {
this.backgroundColor = backgroundColor;
this.elevation = elevation;
this.modalBackgroundColor = modalBackgroundColor;
this.modalElevation = modalElevation;
this.shape = shape;
this.clipBehavior = clipBehavior;
}
public readonly Color backgroundColor;
public readonly float? elevation;
public readonly Color modalBackgroundColor;
public readonly float? modalElevation;
public readonly ShapeBorder shape;
public readonly Clip? clipBehavior;
public BottomSheetThemeData copyWith(
Color backgroundColor = null,
float? elevation = null,
Color modalBackgroundColor = null,
float? modalElevation = null,
ShapeBorder shape = null,
Clip? clipBehavior = null
) {
return new BottomSheetThemeData(
backgroundColor: backgroundColor ?? this.backgroundColor,
elevation: elevation ?? this.elevation,
modalBackgroundColor: modalBackgroundColor ?? this.modalBackgroundColor,
modalElevation: modalElevation ?? this.modalElevation,
shape: shape ?? this.shape,
clipBehavior: clipBehavior ?? this.clipBehavior
);
}
public static BottomSheetThemeData lerp(BottomSheetThemeData a, BottomSheetThemeData b, float t) {
D.assert(t != null);
if (a == null && b == null)
return null;
return new BottomSheetThemeData(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
modalBackgroundColor: Color.lerp(a?.modalBackgroundColor, b?.modalBackgroundColor, t),
modalElevation: Mathf.Lerp(a?.modalElevation ?? 0, b?.modalElevation ?? 0, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
clipBehavior: t < 0.5 ? a?.clipBehavior : b?.clipBehavior
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new ColorProperty("backgroundColor", backgroundColor, defaultValue: null));
properties.add(new FloatProperty("elevation", elevation, defaultValue: null));
properties.add(new ColorProperty("modalBackgroundColor", modalBackgroundColor, defaultValue: null));
properties.add(new FloatProperty("modalElevation", modalElevation, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<Clip?>("clipBehavior", clipBehavior, defaultValue: null));
}
public bool Equals(BottomSheetThemeData other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(backgroundColor, other.backgroundColor) && Nullable.Equals(elevation, other.elevation) &&
Equals(modalBackgroundColor, other.modalBackgroundColor) &&
Nullable.Equals(modalElevation, other.modalElevation) && Equals(shape, other.shape) &&
clipBehavior == other.clipBehavior;
}
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((BottomSheetThemeData) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (backgroundColor != null ? backgroundColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ elevation.GetHashCode();
hashCode = (hashCode * 397) ^ (modalBackgroundColor != null ? modalBackgroundColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ modalElevation.GetHashCode();
hashCode = (hashCode * 397) ^ (shape != null ? shape.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ clipBehavior.GetHashCode();
return hashCode;
}
}
}
}

144
com.unity.uiwidgets/Runtime/material/divider_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
public class DividerThemeData : Diagnosticable, IEquatable<DividerThemeData> {
public DividerThemeData(
Color color = null,
float? space = null,
float? thickness = null,
float? indent = null,
float? endIndent = null
) {
this.color = color;
this.space = space;
this.thickness = thickness;
this.indent = indent;
this.endIndent = endIndent;
}
public readonly Color color;
public readonly float? space;
public readonly float? thickness;
public readonly float? indent;
public readonly float? endIndent;
public DividerThemeData copyWith(
Color color = null,
float? space = null,
float? thickness = null,
float? indent = null,
float? endIndent = null
) {
return new DividerThemeData(
color: color ?? this.color,
space: space ?? this.space,
thickness: thickness ?? this.thickness,
indent: indent ?? this.indent,
endIndent: endIndent ?? this.endIndent
);
}
public static DividerThemeData lerp(DividerThemeData a, DividerThemeData b, float t) {
return new DividerThemeData(
color: Color.lerp(a?.color, b?.color, t),
space: Mathf.Lerp(a?.space ?? 0, b?.space ?? 0, t),
thickness: Mathf.Lerp(a?.thickness ?? 0, b?.thickness ?? 0, t),
indent: Mathf.Lerp(a?.indent ?? 0, b?.indent ?? 0, t),
endIndent: Mathf.Lerp(a?.endIndent ?? 0, b?.endIndent ?? 0, t)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new ColorProperty("color", color, defaultValue: null));
properties.add(new FloatProperty("space", space, defaultValue: null));
properties.add(new FloatProperty("thickness", thickness, defaultValue: null));
properties.add(new FloatProperty("indent", indent, defaultValue: null));
properties.add(new FloatProperty("endIndent", endIndent, defaultValue: null));
}
public static bool operator ==(DividerThemeData self, DividerThemeData other) {
return Equals(self, other);
}
public static bool operator !=(DividerThemeData self, DividerThemeData other) {
return !Equals(self, other);
}
public bool Equals(DividerThemeData other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(color, other.color) && Nullable.Equals(space, other.space) &&
Nullable.Equals(thickness, other.thickness) && Nullable.Equals(indent, other.indent) &&
Nullable.Equals(endIndent, other.endIndent);
}
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((DividerThemeData) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (color != null ? color.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ space.GetHashCode();
hashCode = (hashCode * 397) ^ thickness.GetHashCode();
hashCode = (hashCode * 397) ^ indent.GetHashCode();
hashCode = (hashCode * 397) ^ endIndent.GetHashCode();
return hashCode;
}
}
}
public class DividerTheme : InheritedTheme {
public DividerTheme(
Key key = null,
DividerThemeData data = null,
Widget child = null
) : base(key: key, child: child) {
D.assert(data != null);
this.data = data;
}
public readonly DividerThemeData data;
public static DividerThemeData of(BuildContext context) {
DividerTheme dividerTheme = context.dependOnInheritedWidgetOfExactType<DividerTheme>();
return dividerTheme?.data ?? Theme.of(context).dividerTheme;
}
public override Widget wrap(BuildContext context, Widget child) {
DividerTheme ancestorTheme = context.findAncestorWidgetOfExactType<DividerTheme>();
return ReferenceEquals(this, ancestorTheme) ? child : new DividerTheme(data: data, child: child);
}
public override bool updateShouldNotify(InheritedWidget oldWidget) =>
oldWidget is DividerTheme dividerTheme && data != dividerTheme.data;
}
}

136
com.unity.uiwidgets/Runtime/material/popup_menu_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
public class PopupMenuThemeData : Diagnosticable, IEquatable<PopupMenuThemeData> {
public PopupMenuThemeData(
Color color = null,
ShapeBorder shape = null,
float? elevation = null,
TextStyle textStyle = null
) {
this.color = color;
this.shape = shape;
this.elevation = elevation;
this.textStyle = textStyle;
}
public readonly Color color;
public readonly ShapeBorder shape;
public readonly float? elevation;
public readonly TextStyle textStyle;
PopupMenuThemeData copyWith(
Color color = null,
ShapeBorder shape = null,
float? elevation = null,
TextStyle textStyle = null
) {
return new PopupMenuThemeData(
color: color ?? this.color,
shape: shape ?? this.shape,
elevation: elevation ?? this.elevation,
textStyle: textStyle ?? this.textStyle
);
}
public static PopupMenuThemeData lerp(PopupMenuThemeData a, PopupMenuThemeData b, float t) {
if (a == null && b == null)
return null;
return new PopupMenuThemeData(
color: Color.lerp(a?.color, b?.color, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
textStyle: TextStyle.lerp(a?.textStyle, b?.textStyle, t)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new ColorProperty("color", color, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new FloatProperty("elevation", elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<TextStyle>("text style", textStyle, defaultValue: null));
}
public static bool operator ==(PopupMenuThemeData self, PopupMenuThemeData other) {
return Equals(self, other);
}
public static bool operator !=(PopupMenuThemeData self, PopupMenuThemeData other) {
return Equals(self, other);
}
public bool Equals(PopupMenuThemeData other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(color, other.color) && Equals(shape, other.shape) &&
Nullable.Equals(elevation, other.elevation) && Equals(textStyle, other.textStyle);
}
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((PopupMenuThemeData) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (color != null ? color.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (shape != null ? shape.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ elevation.GetHashCode();
hashCode = (hashCode * 397) ^ (textStyle != null ? textStyle.GetHashCode() : 0);
return hashCode;
}
}
}
public class PopupMenuTheme : InheritedTheme {
public PopupMenuTheme(
Key key = null,
PopupMenuThemeData data = null,
Widget child = null
) : base(key: key, child: child) {
D.assert(data != null);
}
public readonly PopupMenuThemeData data;
static PopupMenuThemeData of(BuildContext context) {
PopupMenuTheme popupMenuTheme = context.dependOnInheritedWidgetOfExactType<PopupMenuTheme>();
return popupMenuTheme?.data ?? Theme.of(context).popupMenuTheme;
}
public override Widget wrap(BuildContext context, Widget child) {
PopupMenuTheme ancestorTheme = context.findAncestorWidgetOfExactType<PopupMenuTheme>();
return ReferenceEquals(this, ancestorTheme) ? child : new PopupMenuTheme(data: data, child: child);
}
public override bool updateShouldNotify(InheritedWidget oldWidget) =>
oldWidget is PopupMenuTheme popupMenuTheme && data != popupMenuTheme.data;
}
}
正在加载...
取消
保存