using System; using Unity.UIWidgets.foundation; using Unity.UIWidgets.ui; namespace Unity.UIWidgets.widgets { public class IconThemeData : Diagnosticable, IEquatable { public IconThemeData( Color color = null, double? opacity = null, double? size = null) { this.color = color; this._opacity = opacity; this.size = size; } public static IconThemeData fallback() { return new IconThemeData( color: new Color(0xFF000000), opacity: 1.0, size: 24.0); } public IconThemeData copyWith( Color color = null, double? opacity = null, double? size = null) { return new IconThemeData( color: color ?? this.color, opacity: opacity ?? this.opacity, size: size ?? this.size ); } public IconThemeData merge(IconThemeData other) { if (other == null) { return this; } return this.copyWith( color: other.color, opacity: other.opacity, size: other.size ); } public bool isConcrete { get { return this.color != null && this.opacity != null && this.size != null; } } public readonly Color color; public double? opacity { get { return this._opacity == null ? (double?) null : this._opacity.Value.clamp(0.0, 1.0); } } readonly double? _opacity; public readonly double? size; public static IconThemeData lerp(IconThemeData a, IconThemeData b, double t) { return new IconThemeData( color: Color.lerp(a.color, b.color, t), opacity: MathUtils.lerpNullableDouble(a.opacity, b.opacity, t), size: MathUtils.lerpNullableDouble(a.size, b.size, t)); } public bool Equals(IconThemeData other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return Equals(this.color, other.color) && this._opacity.Equals(other._opacity) && this.size.Equals(other.size); } 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((IconThemeData) obj); } public override int GetHashCode() { unchecked { var hashCode = (this.color != null ? this.color.GetHashCode() : 0); hashCode = (hashCode * 397) ^ this._opacity.GetHashCode(); hashCode = (hashCode * 397) ^ this.size.GetHashCode(); return hashCode; } } public static bool operator ==(IconThemeData left, IconThemeData right) { return Equals(left, right); } public static bool operator !=(IconThemeData left, IconThemeData right) { return !Equals(left, right); } public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { base.debugFillProperties(properties); properties.add(new DiagnosticsProperty("color", this.color, defaultValue: Diagnostics.kNullDefaultValue)); properties.add(new DoubleProperty("opacity", this.opacity, defaultValue: Diagnostics.kNullDefaultValue)); properties.add(new DoubleProperty("size", this.size, defaultValue: Diagnostics.kNullDefaultValue)); } } }