siyao
4 年前
当前提交
6440673e
共有 9 个文件被更改,包括 609 次插入 和 9 次删除
-
2com.unity.uiwidgets/Runtime/material/ink_well.cs
-
64com.unity.uiwidgets/Runtime/material/material_button.cs
-
2com.unity.uiwidgets/Runtime/material/navigation_rail.cs
-
6com.unity.uiwidgets/Runtime/material/theme_data.cs
-
6com.unity.uiwidgets/Runtime/widgets/basic.cs
-
135com.unity.uiwidgets/Runtime/material/banner_theme.cs
-
123com.unity.uiwidgets/Runtime/material/button_sheet_theme.cs
-
144com.unity.uiwidgets/Runtime/material/divider_theme.cs
-
136com.unity.uiwidgets/Runtime/material/popup_menu_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; |
|||
} |
|||
} |
|
|||
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; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
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; |
|||
} |
|||
} |
|
|||
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; |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue