Yuncong Zhang
6 年前
当前提交
4b30d427
共有 8 个文件被更改,包括 291 次插入 和 34 次删除
-
38Runtime/material/app_bar.cs
-
40Runtime/material/bottom_app_bar.cs
-
36Runtime/material/theme_data.cs
-
2Runtime/painting/notched_shapes.cs
-
113Runtime/material/app_bar_theme.cs
-
3Runtime/material/app_bar_theme.cs.meta
-
90Runtime/material/bottom_app_bar_theme.cs
-
3Runtime/material/bottom_app_bar_theme.cs.meta
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.material { |
|||
public class AppBarTheme : Diagnosticable { |
|||
public AppBarTheme( |
|||
Brightness? brightness = null, |
|||
Color color = null, |
|||
float? elevation = null, |
|||
IconThemeData iconTheme = null, |
|||
TextTheme textTheme = null |
|||
) { |
|||
this.brightness = brightness; |
|||
this.color = color; |
|||
this.elevation = elevation; |
|||
this.iconTheme = iconTheme; |
|||
this.textTheme = textTheme; |
|||
} |
|||
|
|||
public readonly Brightness? brightness; |
|||
|
|||
public readonly Color color; |
|||
|
|||
public readonly float? elevation; |
|||
|
|||
public readonly IconThemeData iconTheme; |
|||
|
|||
public readonly TextTheme textTheme; |
|||
|
|||
AppBarTheme copyWith( |
|||
Brightness? brightness = null, |
|||
Color color = null, |
|||
float? elevation = null, |
|||
IconThemeData iconTheme = null, |
|||
TextTheme textTheme = null |
|||
) { |
|||
return new AppBarTheme( |
|||
brightness: brightness ?? this.brightness, |
|||
color: color ?? this.color, |
|||
elevation: elevation ?? this.elevation, |
|||
iconTheme: iconTheme ?? this.iconTheme, |
|||
textTheme: textTheme ?? this.textTheme |
|||
); |
|||
} |
|||
|
|||
public static AppBarTheme of(BuildContext context) { |
|||
return Theme.of(context).appBarTheme; |
|||
} |
|||
|
|||
public static AppBarTheme lerp(AppBarTheme a, AppBarTheme b, float t) { |
|||
D.assert(t != null); |
|||
return new AppBarTheme( |
|||
brightness: t < 0.5f ? a?.brightness : b?.brightness, |
|||
color: Color.lerp(a?.color, b?.color, t), |
|||
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t), |
|||
iconTheme: IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t), |
|||
textTheme: TextTheme.lerp(a?.textTheme, b?.textTheme, t) |
|||
); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
var hashCode = this.brightness?.GetHashCode() ?? 0; |
|||
hashCode = (hashCode * 397) ^ this.color?.GetHashCode() ?? 0; |
|||
hashCode = (hashCode * 397) ^ this.elevation?.GetHashCode() ?? 0; |
|||
hashCode = (hashCode * 397) ^ this.iconTheme?.GetHashCode() ?? 0; |
|||
hashCode = (hashCode * 397) ^ this.textTheme?.GetHashCode() ?? 0; |
|||
return hashCode; |
|||
} |
|||
|
|||
public override bool Equals(object obj) { |
|||
if (ReferenceEquals(null, obj)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, obj)) { |
|||
return true; |
|||
} |
|||
|
|||
if (obj.GetType() != this.GetType()) { |
|||
return false; |
|||
} |
|||
|
|||
return this.Equals((AppBarTheme) obj); |
|||
} |
|||
|
|||
public static bool operator ==(AppBarTheme left, AppBarTheme right) { |
|||
return Equals(left, right); |
|||
} |
|||
|
|||
public static bool operator !=(AppBarTheme left, AppBarTheme right) { |
|||
return !Equals(left, right); |
|||
} |
|||
|
|||
public bool Equals(AppBarTheme other) { |
|||
return other.brightness == this.brightness |
|||
&& other.color == this.color |
|||
&& other.elevation == this.elevation |
|||
&& other.iconTheme == this.iconTheme |
|||
&& other.textTheme == this.textTheme; |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
properties.add(new DiagnosticsProperty<Brightness?>("brightness", this.brightness, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<IconThemeData>("iconTheme", this.iconTheme, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<TextTheme>("textTheme", this.textTheme, defaultValue: null)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0c0ee979ef6b4f32a092532c3bdae31e |
|||
timeCreated: 1556178331 |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.material { |
|||
public class BottomAppBarTheme : Diagnosticable { |
|||
public BottomAppBarTheme( |
|||
Color color = null, |
|||
float? elevation = null, |
|||
NotchedShape shape = null |
|||
) { |
|||
} |
|||
|
|||
public readonly Color color; |
|||
|
|||
public readonly float? elevation; |
|||
|
|||
public readonly NotchedShape shape; |
|||
|
|||
BottomAppBarTheme copyWith( |
|||
Color color = null, |
|||
float? elevation = null, |
|||
NotchedShape shape = null |
|||
) { |
|||
return new BottomAppBarTheme( |
|||
color: color ?? this.color, |
|||
elevation: elevation ?? this.elevation, |
|||
shape: shape ?? this.shape |
|||
); |
|||
} |
|||
|
|||
public static BottomAppBarTheme of(BuildContext context) { |
|||
return Theme.of(context).bottomAppBarTheme; |
|||
} |
|||
|
|||
public static BottomAppBarTheme lerp(BottomAppBarTheme a, BottomAppBarTheme b, float t) { |
|||
D.assert(t != null); |
|||
return new BottomAppBarTheme( |
|||
color: Color.lerp(a?.color, b?.color, t), |
|||
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t), |
|||
shape: t < 0.5f ? a?.shape : b?.shape |
|||
); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
var hashCode = this.color?.GetHashCode() ?? 0; |
|||
hashCode = (hashCode * 397) ^ this.elevation?.GetHashCode() ?? 0; |
|||
hashCode = (hashCode * 397) ^ this.shape?.GetHashCode() ?? 0; |
|||
return hashCode; |
|||
} |
|||
|
|||
public bool Equals(BottomAppBarTheme other) { |
|||
return other.color == this.color |
|||
&& other.elevation == this.elevation |
|||
&& other.shape == this.shape; |
|||
} |
|||
|
|||
public override bool Equals(object obj) { |
|||
if (ReferenceEquals(null, obj)) { |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, obj)) { |
|||
return true; |
|||
} |
|||
|
|||
if (obj.GetType() != this.GetType()) { |
|||
return false; |
|||
} |
|||
|
|||
return this.Equals((BottomAppBarTheme) obj); |
|||
} |
|||
|
|||
public static bool operator ==(BottomAppBarTheme left, BottomAppBarTheme right) { |
|||
return Equals(left, right); |
|||
} |
|||
|
|||
public static bool operator !=(BottomAppBarTheme left, BottomAppBarTheme right) { |
|||
return !Equals(left, right); |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation, defaultValue: null)); |
|||
properties.add(new DiagnosticsProperty<NotchedShape>("shape", this.shape, defaultValue: null)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9c88d19dd1254f4eb6c0c998084832ea |
|||
timeCreated: 1556185402 |
撰写
预览
正在加载...
取消
保存
Reference in new issue