浏览代码
Merge branch 'siyaoH/1.17/material' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/1.17/material
/siyaoH-1.17-PlatformMessage
Merge branch 'siyaoH/1.17/material' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/1.17/material
/siyaoH-1.17-PlatformMessage
xingweizhu
4 年前
当前提交
e272b714
共有 39 个文件被更改,包括 711 次插入 和 234 次删除
-
5com.unity.uiwidgets/Runtime/animation/animation_controller.cs
-
4com.unity.uiwidgets/Runtime/cupertino/route.cs
-
8com.unity.uiwidgets/Runtime/cupertino/slider.cs
-
4com.unity.uiwidgets/Runtime/cupertino/switch.cs
-
4com.unity.uiwidgets/Runtime/material/about.cs
-
4com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons.cs
-
4com.unity.uiwidgets/Runtime/material/app_bar_theme.cs
-
4com.unity.uiwidgets/Runtime/material/arc.cs
-
5com.unity.uiwidgets/Runtime/material/bottom_app_bar_theme.cs
-
254com.unity.uiwidgets/Runtime/material/button_bar.cs
-
4com.unity.uiwidgets/Runtime/material/button_theme.cs
-
4com.unity.uiwidgets/Runtime/material/card_theme.cs
-
6com.unity.uiwidgets/Runtime/material/chip_theme.cs
-
6com.unity.uiwidgets/Runtime/material/dialog.cs
-
5com.unity.uiwidgets/Runtime/material/dialog_theme.cs
-
9com.unity.uiwidgets/Runtime/material/floatting_action_button_theme.cs
-
2com.unity.uiwidgets/Runtime/material/input_border.cs
-
4com.unity.uiwidgets/Runtime/material/input_decorator.cs
-
5com.unity.uiwidgets/Runtime/material/mergeable_material.cs
-
2com.unity.uiwidgets/Runtime/material/slider_theme.cs
-
261com.unity.uiwidgets/Runtime/material/text_theme.cs
-
2com.unity.uiwidgets/Runtime/material/theme_data.cs
-
16com.unity.uiwidgets/Runtime/painting/alignment.cs
-
2com.unity.uiwidgets/Runtime/painting/borders.cs
-
4com.unity.uiwidgets/Runtime/painting/box_shadow.cs
-
30com.unity.uiwidgets/Runtime/painting/edge_insets.cs
-
8com.unity.uiwidgets/Runtime/painting/fractional_offset.cs
-
6com.unity.uiwidgets/Runtime/painting/gradient.cs
-
7com.unity.uiwidgets/Runtime/painting/rounded_rectangle_border.cs
-
11com.unity.uiwidgets/Runtime/painting/stadium_border.cs
-
5com.unity.uiwidgets/Runtime/painting/text_style.cs
-
8com.unity.uiwidgets/Runtime/rendering/box.cs
-
4com.unity.uiwidgets/Runtime/rendering/editable.cs
-
8com.unity.uiwidgets/Runtime/rendering/stack.cs
-
28com.unity.uiwidgets/Runtime/ui2/geometry.cs
-
8com.unity.uiwidgets/Runtime/ui2/painting.cs
-
4com.unity.uiwidgets/Runtime/widgets/editable_text.cs
-
8com.unity.uiwidgets/Runtime/material/animated_icons.meta
-
182com.unity.uiwidgets/Runtime/material/button_bar_theme.cs
|
|||
fileFormatVersion: 2 |
|||
guid: fe9d2309a41964cba855171391dab665 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace Unity.UIWidgets.material { |
|||
public class ButtonBarThemeData : Diagnosticable, IEquatable<ButtonBarThemeData> { |
|||
public ButtonBarThemeData( |
|||
MainAxisAlignment? alignment = null, |
|||
MainAxisSize? mainAxisSize = null, |
|||
ButtonTextTheme? buttonTextTheme = null, |
|||
float? buttonMinWidth = null, |
|||
float? buttonHeight = null, |
|||
EdgeInsetsGeometry buttonPadding = null, |
|||
bool? buttonAlignedDropdown = null, |
|||
ButtonBarLayoutBehavior? layoutBehavior = null, |
|||
VerticalDirection? overflowDirection = null |
|||
) { |
|||
D.assert(buttonMinWidth >= 0.0f); |
|||
D.assert(buttonHeight >= 0.0f); |
|||
this.alignment = alignment; |
|||
this.mainAxisSize = mainAxisSize; |
|||
this.buttonTextTheme = buttonTextTheme; |
|||
this.buttonMinWidth = buttonMinWidth; |
|||
this.buttonHeight = buttonHeight; |
|||
this.buttonPadding = buttonPadding; |
|||
this.buttonAlignedDropdown = buttonAlignedDropdown; |
|||
this.layoutBehavior = layoutBehavior; |
|||
this.overflowDirection = overflowDirection; |
|||
} |
|||
|
|||
public readonly MainAxisAlignment? alignment; |
|||
|
|||
public readonly MainAxisSize? mainAxisSize; |
|||
|
|||
public readonly ButtonTextTheme? buttonTextTheme; |
|||
|
|||
public readonly float? buttonMinWidth; |
|||
|
|||
public readonly float? buttonHeight; |
|||
|
|||
public readonly EdgeInsetsGeometry buttonPadding; |
|||
|
|||
public readonly bool? buttonAlignedDropdown; |
|||
|
|||
public readonly ButtonBarLayoutBehavior? layoutBehavior; |
|||
|
|||
public readonly VerticalDirection? overflowDirection; |
|||
|
|||
public ButtonBarThemeData copyWith( |
|||
MainAxisAlignment? alignment, |
|||
MainAxisSize? mainAxisSize, |
|||
ButtonTextTheme? buttonTextTheme, |
|||
float? buttonMinWidth, |
|||
float? buttonHeight, |
|||
EdgeInsetsGeometry buttonPadding, |
|||
bool? buttonAlignedDropdown, |
|||
ButtonBarLayoutBehavior? layoutBehavior, |
|||
VerticalDirection? overflowDirection |
|||
) { |
|||
return new ButtonBarThemeData( |
|||
alignment: alignment ?? this.alignment, |
|||
mainAxisSize: mainAxisSize ?? this.mainAxisSize, |
|||
buttonTextTheme: buttonTextTheme ?? this.buttonTextTheme, |
|||
buttonMinWidth: buttonMinWidth ?? this.buttonMinWidth, |
|||
buttonHeight: buttonHeight ?? this.buttonHeight, |
|||
buttonPadding: buttonPadding ?? this.buttonPadding, |
|||
buttonAlignedDropdown: buttonAlignedDropdown ?? this.buttonAlignedDropdown, |
|||
layoutBehavior: layoutBehavior ?? this.layoutBehavior, |
|||
overflowDirection: overflowDirection ?? this.overflowDirection |
|||
); |
|||
} |
|||
|
|||
public static ButtonBarThemeData lerp(ButtonBarThemeData a, ButtonBarThemeData b, float t) { |
|||
if (a == null && b == null) |
|||
return null; |
|||
return new ButtonBarThemeData( |
|||
alignment: t < 0.5 ? a.alignment : b.alignment, |
|||
mainAxisSize: t < 0.5 ? a.mainAxisSize : b.mainAxisSize, |
|||
buttonTextTheme: t < 0.5 ? a.buttonTextTheme : b.buttonTextTheme, |
|||
buttonMinWidth: Mathf.Lerp(a?.buttonMinWidth ?? 0, b?.buttonMinWidth ?? 0, t), |
|||
buttonHeight: Mathf.Lerp(a?.buttonHeight ?? 0, b?.buttonHeight ?? 0, t), |
|||
buttonPadding: EdgeInsetsGeometry.lerp(a?.buttonPadding, b?.buttonPadding, t), |
|||
buttonAlignedDropdown: t < 0.5 ? a.buttonAlignedDropdown : b.buttonAlignedDropdown, |
|||
layoutBehavior: t < 0.5 ? a.layoutBehavior : b.layoutBehavior, |
|||
overflowDirection: t < 0.5 ? a.overflowDirection : b.overflowDirection |
|||
); |
|||
} |
|||
|
|||
public bool Equals(ButtonBarThemeData other) { |
|||
if (ReferenceEquals(null, other)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, other)) { |
|||
return true; |
|||
} |
|||
|
|||
return alignment == other.alignment && mainAxisSize == other.mainAxisSize && |
|||
buttonTextTheme == other.buttonTextTheme && buttonMinWidth.Equals(other.buttonMinWidth) && |
|||
buttonHeight.Equals(other.buttonHeight) && Equals(buttonPadding, other.buttonPadding) && |
|||
buttonAlignedDropdown == other.buttonAlignedDropdown && layoutBehavior == other.layoutBehavior && |
|||
overflowDirection == other.overflowDirection; |
|||
} |
|||
|
|||
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((ButtonBarThemeData) obj); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
var hashCode = (int) alignment; |
|||
hashCode = (hashCode * 397) ^ (int) mainAxisSize; |
|||
hashCode = (hashCode * 397) ^ (int) buttonTextTheme; |
|||
hashCode = (hashCode * 397) ^ buttonMinWidth.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ buttonHeight.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ (buttonPadding != null ? buttonPadding.GetHashCode() : 0); |
|||
hashCode = (hashCode * 397) ^ buttonAlignedDropdown.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ (int) layoutBehavior; |
|||
hashCode = (hashCode * 397) ^ (int) overflowDirection; |
|||
return hashCode; |
|||
} |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
properties.add(new DiagnosticsProperty<MainAxisAlignment?>("alignment", alignment, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<MainAxisSize?>("mainAxisSize", mainAxisSize, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", buttonTextTheme, defaultValue: null)); |
|||
properties.add(new FloatProperty("minWidth", buttonMinWidth, defaultValue: null)); |
|||
properties.add(new FloatProperty("height", buttonHeight, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", buttonPadding, defaultValue: null)); |
|||
properties.add(new FlagProperty( |
|||
"buttonAlignedDropdown", |
|||
value: buttonAlignedDropdown, |
|||
ifTrue: "dropdown width matches button", |
|||
defaultValue: null)); |
|||
properties.add( |
|||
new DiagnosticsProperty<ButtonBarLayoutBehavior?>("layoutBehavior", layoutBehavior, |
|||
defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<VerticalDirection?>("overflowDirection", overflowDirection, |
|||
defaultValue: null)); |
|||
} |
|||
} |
|||
|
|||
public class ButtonBarTheme : InheritedWidget { |
|||
public ButtonBarTheme( |
|||
Key key = null, |
|||
ButtonBarThemeData data = null, |
|||
Widget child = null |
|||
) : base(key: key, child: child) { |
|||
D.assert(data != null); |
|||
this.data = data; |
|||
} |
|||
|
|||
public readonly ButtonBarThemeData data; |
|||
|
|||
public static ButtonBarThemeData of(BuildContext context) { |
|||
ButtonBarTheme buttonBarTheme = context.dependOnInheritedWidgetOfExactType<ButtonBarTheme>(); |
|||
return buttonBarTheme?.data ?? Theme.of(context).buttonBarTheme; |
|||
} |
|||
|
|||
public override bool updateShouldNotify(InheritedWidget oldWidget) { |
|||
return oldWidget is ButtonBarTheme buttonBarTheme && !data.Equals(buttonBarTheme.data); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue