浏览代码

upgrade input_decorator and material_localizations

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
5a7c2731
共有 2 个文件被更改,包括 402 次插入24 次删除
  1. 360
      com.unity.uiwidgets/Runtime/material/input_decorator.cs
  2. 66
      com.unity.uiwidgets/Runtime/material/material_localizations.cs

360
com.unity.uiwidgets/Runtime/material/input_decorator.cs


return empty;
}
}
enum FloatingLabelBehavior {
public enum FloatingLabelBehavior {
never,
auto,
always,

InputDecoration decoration = null,
TextStyle baseStyle = null,
TextAlign? textAlign = null,
TextAlignVertical textAlignVertical = null,
bool isHovering = false,
bool expands = false,
bool isEmpty = false,
Widget child = null

this.textAlign = textAlign;
this.textAlignVertical = textAlignVertical;
this.isHovering = isHovering;
this.expands = expands;
this.isEmpty = isEmpty;
this.child = child;

public readonly TextStyle baseStyle;
public readonly TextAlign? textAlign;
public readonly TextAlignVertical textAlignVertical;
public readonly bool isHovering;
public readonly bool expands;
public readonly bool isEmpty;

}
internal static RenderBox containerOf(BuildContext context) {
_RenderDecoration result =
(_RenderDecoration) context.ancestorRenderObjectOfType(new TypeMatcher<_RenderDecoration>());
_RenderDecoration result = context.findAncestorRenderObjectOfType<_RenderDecoration>();
return result?.container;
}

public override void initState() {
base.initState();
bool labelIsInitiallyFloating = widget.decoration.floatingLabelBehavior == FloatingLabelBehavior.always ||
(widget.decoration.hasFloatingPlaceholder == true && widget._labelShouldWithdraw);
value: (widget.decoration.hasFloatingPlaceholder == true && widget._labelShouldWithdraw)
? 1.0f
: 0.0f
value: labelIsInitiallyFloating ? 1.0f : 0.0f
);
_floatingLabelController.addListener(_handleChange);

get { return widget.textAlign; }
}
bool isFocused {
get { return widget.isFocused; }
bool isFocused => widget.isFocused && decoration.enabled == true;
bool isHovering => widget.isHovering && decoration.enabled == true;
bool _floatingLabelEnabled {
get {
return decoration.hasFloatingPlaceholder == true && decoration.floatingLabelBehavior != FloatingLabelBehavior.never;
}
}
bool isEmpty {

if (widget.decoration != old.decoration) {
_effectiveDecoration = null;
}
bool floatBehaviourChanged = widget.decoration.floatingLabelBehavior != old.decoration.floatingLabelBehavior ||
widget.decoration.hasFloatingPlaceholder != old.decoration.hasFloatingPlaceholder;
if (widget._labelShouldWithdraw != old._labelShouldWithdraw &&
widget.decoration.hasFloatingPlaceholder == true) {
if (widget._labelShouldWithdraw) {
if (widget._labelShouldWithdraw != old._labelShouldWithdraw || floatBehaviourChanged) {
if (_floatingLabelEnabled && (widget._labelShouldWithdraw || widget.decoration.floatingLabelBehavior == FloatingLabelBehavior.always)){
_floatingLabelController.forward();
}
else {

return themeData.hintColor;
}
Color _getDefaultBorderColor(ThemeData themeData) {
if (isFocused) {
switch (themeData.brightness) {
case Brightness.dark:
return themeData.accentColor;
case Brightness.light:
return themeData.primaryColor;
}
}
if (decoration.filled == true) {
return themeData.hintColor;
}
Color enabledColor = themeData.colorScheme.onSurface.withOpacity(0.38f);
if (isHovering) {
Color hoverColor = decoration.hoverColor ?? themeData.inputDecorationTheme?.hoverColor ?? themeData.hoverColor;
return Color.alphaBlend(hoverColor.withOpacity(0.12f), enabledColor);
}
return enabledColor;
}
Color _getFillColor(ThemeData themeData) {
if (decoration.filled != true) {

return lightEnabled;
}
Color _getHoverColor(ThemeData themeData) {
if (decoration.filled == null || !decoration.filled.Value || isFocused || decoration.enabled != true) {
return Colors.transparent;
}
return decoration.hoverColor ?? themeData.inputDecorationTheme?.hoverColor ?? themeData.hoverColor;
}
Color _getDefaultIconColor(ThemeData themeData) {
if (!decoration.enabled == true) {

}
bool _shouldShowLabel {
get { return _hasInlineLabel || decoration.hasFloatingPlaceholder == true; }
get { return _hasInlineLabel || _floatingLabelEnabled; }
return themeData.textTheme.subhead.merge(widget.baseStyle)
return themeData.textTheme.subtitle1.merge(widget.baseStyle)
.copyWith(color: decoration.enabled == true ? themeData.hintColor : themeData.disabledColor);
}

: _getActiveColor(themeData);
TextStyle style = themeData.textTheme.subhead.merge(widget.baseStyle);
TextStyle style = themeData.textTheme.subtitle1.merge(widget.baseStyle);
return style
.copyWith(color: decoration.enabled == true ? color : themeData.disabledColor)
.merge(decoration.labelStyle);

Color borderColor;
if (decoration.enabled == true) {
borderColor = decoration.errorText == null
? _getActiveColor(themeData)
? _getDefaultBorderColor(themeData)
: themeData.errorColor;
}
else {

border: border,
gap: _borderGap,
gapAnimation: _floatingLabelController.view,
fillColor: _getFillColor(themeData)
fillColor: _getFillColor(themeData),
hoverColor: _getHoverColor(themeData),
isHovering: isHovering
);
TextStyle inlineLabelStyle = inlineStyle.merge(decoration.labelStyle);

widthFactor: 1.0f,
heightFactor: 1.0f,
child: new ConstrainedBox(
constraints: new BoxConstraints(minWidth: 48.0f, minHeight: 48.0f),
constraints: decoration.prefixIconConstraints ?? themeData.visualDensity.effectiveConstraints(
new BoxConstraints(
minWidth: Constants.kMinInteractiveDimension,
minHeight: Constants.kMinInteractiveDimension
)),
child: IconTheme.merge(
data: new IconThemeData(
color: iconColor,

widthFactor: 1.0f,
heightFactor: 1.0f,
child: new ConstrainedBox(
constraints: new BoxConstraints(minWidth: 48.0f, minHeight: 48.0f),
constraints: decoration.suffixIconConstraints ?? themeData.visualDensity.effectiveConstraints(
new BoxConstraints(
minWidth: Constants.kMinInteractiveDimension,
minHeight: Constants.kMinInteractiveDimension
)),
child: IconTheme.merge(
data: new IconThemeData(
color: iconColor,

textAlign: textAlign,
helperText: decoration.helperText,
helperStyle: _getHelperStyle(themeData),
helperMaxLines: decoration.helperMaxLines,
errorText: decoration.errorText,
errorStyle: _getErrorStyle(themeData),
errorMaxLines: decoration.errorMaxLines

);
}
TextDirection textDirection = Directionality.of(context);
EdgeInsets decorationContentPadding = decoration.contentPadding;
EdgeInsets contentPadding;
float? floatingLabelHeight;

floatingLabelProgress: _floatingLabelController.value,
border: border,
borderGap: _borderGap,
alignLabelWithHint: decoration.alignLabelWithHint,
isDense: decoration.isDense,
visualDensity: themeData.visualDensity,
alignLabelWithHint: decoration.alignLabelWithHint,
hint: hint,
prefix: prefix,
suffix: suffix,

counter: counter,
container: container
),
textDirection: textDirection,
textAlignVertical: widget.textAlignVertical,
isFocused: isFocused,
expands: widget.expands
);

TextStyle labelStyle = null,
string helperText = null,
TextStyle helperStyle = null,
int? helperMaxLines = null,
string hintText = null,
TextStyle hintStyle = null,
int? hintMaxLines = null,

bool? hasFloatingPlaceholder = true,
FloatingLabelBehavior? floatingLabelBehavior = FloatingLabelBehavior.auto,
BoxConstraints prefixIconConstraints = null,
BoxConstraints suffixIconConstraints = null,
Widget suffix = null,
string suffixText = null,
TextStyle suffixStyle = null,

bool? filled = null,
Color fillColor = null,
Color focusColor = null,
Color hoverColor = null,
InputBorder errorBorder = null,
InputBorder focusedBorder = null,
InputBorder focusedErrorBorder = null,

this.labelStyle = labelStyle;
this.helperText = helperText;
this.helperStyle = helperStyle;
this.helperMaxLines = helperMaxLines;
this.hintText = hintText;
this.hintStyle = hintStyle;
this.hintMaxLines = hintMaxLines;

this.hasFloatingPlaceholder = hasFloatingPlaceholder;
this.floatingLabelBehavior = floatingLabelBehavior;
this.prefixIconConstraints = prefixIconConstraints;
this.suffixIconConstraints = suffixIconConstraints;
this.suffixStyle = suffixStyle;
this.counter = counter;
this.counterText = counterText;

this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.errorBorder = errorBorder;
this.focusedBorder = focusedBorder;
this.focusedErrorBorder = focusedErrorBorder;

public static InputDecoration collapsed(
string hintText = null,
bool hasFloatingPlaceholder = true,
FloatingLabelBehavior? floatingLabelBehavior = FloatingLabelBehavior.auto,
Color focusColor = null,
Color hoverColor = null,
D.assert(!(!hasFloatingPlaceholder && floatingLabelBehavior == FloatingLabelBehavior.always),
() => "hasFloatingPlaceholder=false conflicts with FloatingLabelBehavior.always");
InputDecoration decoration = new InputDecoration(
icon: null,
labelText: null,

helperMaxLines: null,
hintMaxLines: null,
errorText: null,
errorStyle: null,

prefix: null,
prefixText: null,
prefixStyle: null,
prefixIconConstraints: null,
suffixIconConstraints: null,
counter: null,
counterText: null,
counterStyle: null,

enabledBorder: null,
hintText: hintText,
hasFloatingPlaceholder: hasFloatingPlaceholder,
floatingLabelBehavior: floatingLabelBehavior,
focusColor: focusColor,
hoverColor: hoverColor,
border: border,
enabled: enabled,
alignLabelWithHint: false

public readonly TextStyle helperStyle;
public readonly int? helperMaxLines;
public readonly string hintText;
public readonly TextStyle hintStyle;

public readonly int? errorMaxLines;
public readonly bool? hasFloatingPlaceholder;
public readonly FloatingLabelBehavior? floatingLabelBehavior;
public readonly bool? isDense;

public readonly Widget prefixIcon;
public readonly BoxConstraints prefixIconConstraints;
public readonly Widget prefix;

public readonly Widget suffixIcon;
public readonly BoxConstraints suffixIconConstraints;
public readonly Widget suffix;

public readonly bool? filled;
public readonly Color fillColor;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly InputBorder errorBorder;

TextStyle labelStyle = null,
string helperText = null,
TextStyle helperStyle = null,
int? helperMaxLines = null,
string hintText = null,
TextStyle hintStyle = null,
int? hintMaxLines = null,

bool? hasFloatingPlaceholder = null,
FloatingLabelBehavior? floatingLabelBehavior = null,
BoxConstraints prefixIconConstraints = null,
BoxConstraints suffixIconConstraints = null,
Color focusColor = null,
Color hoverColor = null,
InputBorder errorBorder = null,
InputBorder focusedBorder = null,
InputBorder focusedErrorBorder = null,

labelStyle: labelStyle ?? this.labelStyle,
helperText: helperText ?? this.helperText,
helperStyle: helperStyle ?? this.helperStyle,
helperMaxLines : helperMaxLines ?? this.helperMaxLines,
hintText: hintText ?? this.hintText,
hintStyle: hintStyle ?? this.hintStyle,
hintMaxLines: hintMaxLines ?? this.hintMaxLines,

hasFloatingPlaceholder: hasFloatingPlaceholder ?? this.hasFloatingPlaceholder,
floatingLabelBehavior: floatingLabelBehavior ?? this.floatingLabelBehavior,
isDense: isDense ?? this.isDense,
contentPadding: contentPadding ?? this.contentPadding,
prefixIcon: prefixIcon ?? this.prefixIcon,

prefixIconConstraints: prefixIconConstraints ?? this.prefixIconConstraints,
suffixIconConstraints: suffixIconConstraints ?? this.suffixIconConstraints,
focusColor: focusColor ?? this.focusColor,
hoverColor: hoverColor ?? this.hoverColor,
errorBorder: errorBorder ?? this.errorBorder,
focusedBorder: focusedBorder ?? this.focusedBorder,
focusedErrorBorder: focusedErrorBorder ?? this.focusedErrorBorder,

labelStyle: labelStyle ?? theme.labelStyle,
helperStyle: helperStyle ?? theme.helperStyle,
hintStyle: hintStyle ?? theme.hintStyle,
helperMaxLines : helperMaxLines ?? theme.helperMaxLines,
floatingLabelBehavior: floatingLabelBehavior ?? theme.floatingLabelBehavior,
isDense: isDense ?? theme.isDense,
contentPadding: contentPadding ?? theme.contentPadding,
prefixStyle: prefixStyle ?? theme.prefixStyle,

fillColor: fillColor ?? theme.fillColor,
focusColor: focusColor ?? theme.focusColor,
hoverColor: hoverColor ?? theme.hoverColor,
errorBorder: errorBorder ?? theme.errorBorder,
focusedBorder: focusedBorder ?? theme.focusedBorder,
focusedErrorBorder: focusedErrorBorder ?? theme.focusedErrorBorder,

&& Equals(other.helperStyle, helperStyle)
&& Equals(other.hintText, hintText)
&& Equals(other.hintStyle, hintStyle)
&& Equals(other.helperMaxLines, helperMaxLines)
&& Equals(other.floatingLabelBehavior, floatingLabelBehavior)
&& Equals(other.isDense, isDense)
&& Equals(other.contentPadding, contentPadding)
&& Equals(other.isCollapsed, isCollapsed)

&& Equals(other.prefixStyle, prefixStyle)
&& Equals(other.prefixIconConstraints, prefixIconConstraints)
&& Equals(other.suffixIconConstraints, suffixIconConstraints)
&& Equals(other.focusColor, focusColor)
&& Equals(other.hoverColor, hoverColor)
&& Equals(other.errorBorder, errorBorder)
&& Equals(other.focusedBorder, focusedBorder)
&& Equals(other.focusedErrorBorder, focusedErrorBorder)

hashCode = (hashCode * 397) ^ labelStyle.GetHashCode();
hashCode = (hashCode * 397) ^ helperText.GetHashCode();
hashCode = (hashCode * 397) ^ helperStyle.GetHashCode();
hashCode = (hashCode * 397) ^ helperMaxLines.GetHashCode();
hashCode = (hashCode * 397) ^ hintText.GetHashCode();
hashCode = (hashCode * 397) ^ hintStyle.GetHashCode();
hashCode = (hashCode * 397) ^ hintMaxLines.GetHashCode();

hashCode = (hashCode * 397) ^ hasFloatingPlaceholder.GetHashCode();
hashCode = (hashCode * 397) ^ floatingLabelBehavior.GetHashCode();
hashCode = (hashCode * 397) ^ focusColor.GetHashCode();
hashCode = (hashCode * 397) ^ hoverColor.GetHashCode();
hashCode = (hashCode * 397) ^ border.GetHashCode();
hashCode = (hashCode * 397) ^ enabled.GetHashCode();
hashCode = (hashCode * 397) ^ prefixIcon.GetHashCode();

hashCode = (hashCode * 397) ^ prefixIconConstraints.GetHashCode();
hashCode = (hashCode * 397) ^ suffixIconConstraints.GetHashCode();
hashCode = (hashCode * 397) ^ counter.GetHashCode();
hashCode = (hashCode * 397) ^ counterText.GetHashCode();
hashCode = (hashCode * 397) ^ counterStyle.GetHashCode();

description.Add($"helperText: ${helperText}");
}
if (helperMaxLines != null) {
description.Add($"helperMaxLines: ${helperMaxLines}");
}
if (hintMaxLines != null) {
description.Add($"hintMaxLines: ${hintMaxLines}");
}

if (hasFloatingPlaceholder == false) {
description.Add($"hasFloatingPlaceholder: false");
}
if (floatingLabelBehavior != null) {
description.Add($"floatingLabelBehavior: {floatingLabelBehavior}");
}
if (isDense ?? false) {
description.Add($"isDense: ${isDense}");

if (prefixStyle != null) {
description.Add($"prefixStyle: ${prefixStyle}");
}
if (prefixIconConstraints != null) {
description.Add($"prefixIconConstraints: ${prefixIconConstraints}");
}
if (suffixIcon != null) {
description.Add($"suffixIcon: ${suffixIcon}");

if (suffixStyle != null) {
description.Add($"suffixStyle: ${suffixStyle}");
}
if (suffixIconConstraints != null) {
description.Add($"suffixIconConstraints: ${suffixIconConstraints}");
}
if (counter != null) {

if (fillColor != null) {
description.Add($"fillColor: ${fillColor}");
}
if (focusColor != null) {
description.Add($"focusColor: ${focusColor}");
}
if (hoverColor != null) {
description.Add($"hoverColor: ${hoverColor}");
}
if (errorBorder != null) {
description.Add($"errorBorder: ${errorBorder}");

public InputDecorationTheme(
TextStyle labelStyle = null,
TextStyle helperStyle = null,
int? helperMaxLines = null,
FloatingLabelBehavior? floatingLabelBehavior = FloatingLabelBehavior.auto,
bool? isDense = false,
EdgeInsets contentPadding = null,
bool? isCollapsed = false,

bool? filled = false,
Color fillColor = null,
Color focusColor = null,
Color hoverColor = null,
InputBorder errorBorder = null,
InputBorder focusedBorder = null,
InputBorder focusedErrorBorder = null,

D.assert(isDense != null);
D.assert(isCollapsed != null);
D.assert(filled != null);
D.assert(!(hasFloatingPlaceholder != true && floatingLabelBehavior == FloatingLabelBehavior.always),
() => "hasFloatingPlaceholder=false conflicts with FloatingLabelBehavior.always");
this.helperMaxLines = helperMaxLines;
this.floatingLabelBehavior = floatingLabelBehavior;
this.isDense = isDense;
this.contentPadding = contentPadding;
this.isCollapsed = isCollapsed;

this.filled = filled;
this.fillColor = fillColor;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.errorBorder = errorBorder;
this.focusedBorder = focusedBorder;
this.focusedErrorBorder = focusedErrorBorder;

public readonly TextStyle helperStyle;
public readonly int? helperMaxLines;
public readonly TextStyle hintStyle;
public readonly TextStyle errorStyle;

public readonly bool? hasFloatingPlaceholder;
public readonly FloatingLabelBehavior? floatingLabelBehavior;
public readonly bool? isDense;

public readonly bool? filled;
public readonly Color fillColor;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly InputBorder errorBorder;

public readonly InputBorder border;
public readonly bool alignLabelWithHint;
InputDecorationTheme copyWith(
TextStyle labelStyle = null,
TextStyle helperStyle = null,
int? helperMaxLines = null,
TextStyle hintStyle = null,
TextStyle errorStyle = null,
int? errorMaxLines = null,
bool? hasFloatingPlaceholder = null,
FloatingLabelBehavior? floatingLabelBehavior = null,
bool? isDense = null,
EdgeInsets contentPadding = null,
bool? isCollapsed = null,
TextStyle prefixStyle = null,
TextStyle suffixStyle = null,
TextStyle counterStyle = null,
bool? filled = null,
Color fillColor = null,
Color focusColor = null,
Color hoverColor = null,
InputBorder errorBorder = null,
InputBorder focusedBorder = null,
InputBorder focusedErrorBorder = null,
InputBorder disabledBorder = null,
InputBorder enabledBorder = null,
InputBorder border = null,
bool? alignLabelWithHint = null
) {
return new InputDecorationTheme(
labelStyle: labelStyle ?? this.labelStyle,
helperStyle: helperStyle ?? this.helperStyle,
helperMaxLines: helperMaxLines ?? this.helperMaxLines,
hintStyle: hintStyle ?? this.hintStyle,
errorStyle: errorStyle ?? this.errorStyle,
errorMaxLines: errorMaxLines ?? this.errorMaxLines,
hasFloatingPlaceholder: hasFloatingPlaceholder ?? this.hasFloatingPlaceholder,
floatingLabelBehavior: floatingLabelBehavior ?? this.floatingLabelBehavior,
isDense: isDense ?? this.isDense,
contentPadding: contentPadding ?? this.contentPadding,
isCollapsed: isCollapsed ?? this.isCollapsed,
prefixStyle: prefixStyle ?? this.prefixStyle,
suffixStyle: suffixStyle ?? this.suffixStyle,
counterStyle: counterStyle ?? this.counterStyle,
filled: filled ?? this.filled,
fillColor: fillColor ?? this.fillColor,
focusColor: focusColor ?? this.focusColor,
hoverColor: hoverColor ?? this.hoverColor,
errorBorder: errorBorder ?? this.errorBorder,
focusedBorder: focusedBorder ?? this.focusedBorder,
focusedErrorBorder: focusedErrorBorder ?? this.focusedErrorBorder,
disabledBorder: disabledBorder ?? this.disabledBorder,
enabledBorder: enabledBorder ?? this.enabledBorder,
border: border ?? this.border,
alignLabelWithHint: alignLabelWithHint ?? this.alignLabelWithHint
);
}
public static bool operator ==(InputDecorationTheme left, InputDecorationTheme right) {
return Equals(left, right);
}
public static bool operator !=(InputDecorationTheme left, InputDecorationTheme right) {
return !Equals(left, right);
}
public bool Equals(InputDecorationTheme other) {
return Equals(other.labelStyle, labelStyle)
&& Equals(other.helperStyle, helperStyle)
&& Equals(other.hintStyle, hintStyle)
&& Equals(other.helperMaxLines, helperMaxLines)
&& Equals(other.errorStyle, errorStyle)
&& Equals(other.errorMaxLines, errorMaxLines)
&& Equals(other.hasFloatingPlaceholder, hasFloatingPlaceholder)
&& Equals(other.floatingLabelBehavior, floatingLabelBehavior)
&& Equals(other.isDense, isDense)
&& Equals(other.contentPadding, contentPadding)
&& Equals(other.isCollapsed, isCollapsed)
&& Equals(other.prefixStyle, prefixStyle)
&& Equals(other.suffixStyle, suffixStyle)
&& Equals(other.counterStyle, counterStyle)
&& Equals(other.filled, filled)
&& Equals(other.fillColor, fillColor)
&& Equals(other.focusColor, focusColor)
&& Equals(other.hoverColor, hoverColor)
&& Equals(other.errorBorder, errorBorder)
&& Equals(other.focusedBorder, focusedBorder)
&& Equals(other.focusedErrorBorder, focusedErrorBorder)
&& Equals(other.disabledBorder, disabledBorder)
&& Equals(other.enabledBorder, enabledBorder)
&& Equals(other.border, border)
&& Equals(other.alignLabelWithHint, alignLabelWithHint);
}
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((InputDecoration) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = labelStyle.GetHashCode();
hashCode = (hashCode * 397) ^ helperStyle.GetHashCode();
hashCode = (hashCode * 397) ^ helperMaxLines.GetHashCode();
hashCode = (hashCode * 397) ^ hintStyle.GetHashCode();
hashCode = (hashCode * 397) ^ errorStyle.GetHashCode();
hashCode = (hashCode * 397) ^ errorMaxLines.GetHashCode();
hashCode = (hashCode * 397) ^ hasFloatingPlaceholder.GetHashCode();
hashCode = (hashCode * 397) ^ floatingLabelBehavior.GetHashCode();
hashCode = (hashCode * 397) ^ isDense.GetHashCode();
hashCode = (hashCode * 397) ^ contentPadding.GetHashCode();
hashCode = (hashCode * 397) ^ isCollapsed.GetHashCode();
hashCode = (hashCode * 397) ^ filled.GetHashCode();
hashCode = (hashCode * 397) ^ fillColor.GetHashCode();
hashCode = (hashCode * 397) ^ focusColor.GetHashCode();
hashCode = (hashCode * 397) ^ hoverColor.GetHashCode();
hashCode = (hashCode * 397) ^ border.GetHashCode();
hashCode = (hashCode * 397) ^ prefixStyle.GetHashCode();
hashCode = (hashCode * 397) ^ suffixStyle.GetHashCode();
hashCode = (hashCode * 397) ^ counterStyle.GetHashCode();
hashCode = (hashCode * 397) ^ filled.GetHashCode();
hashCode = (hashCode * 397) ^ fillColor.GetHashCode();
hashCode = (hashCode * 397) ^ errorBorder.GetHashCode();
hashCode = (hashCode * 397) ^ focusedBorder.GetHashCode();
hashCode = (hashCode * 397) ^ focusedErrorBorder.GetHashCode();
hashCode = (hashCode * 397) ^ disabledBorder.GetHashCode();
hashCode = (hashCode * 397) ^ enabledBorder.GetHashCode();
hashCode = (hashCode * 397) ^ border.GetHashCode();
hashCode = (hashCode * 397) ^ alignLabelWithHint.GetHashCode();
return hashCode;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

properties.add(new DiagnosticsProperty<TextStyle>("helperStyle", helperStyle,
defaultValue: defaultTheme.helperStyle));
properties.add(new IntProperty("helperMaxLines", helperMaxLines, defaultValue: defaultTheme.helperMaxLines));
properties.add(new DiagnosticsProperty<int?>("errorMaxLines", errorMaxLines,
defaultValue: defaultTheme.errorMaxLines));
properties.add(new IntProperty("errorMaxLines", errorMaxLines, defaultValue: defaultTheme.errorMaxLines));
properties.add(new DiagnosticsProperty<FloatingLabelBehavior?>("floatingLabelBehavior", floatingLabelBehavior, defaultValue: defaultTheme.floatingLabelBehavior));
properties.add(new DiagnosticsProperty<bool?>("isDense", isDense, defaultValue: defaultTheme.isDense));
properties.add(new DiagnosticsProperty<EdgeInsets>("contentPadding", contentPadding,
defaultValue: defaultTheme.contentPadding));

properties.add(new DiagnosticsProperty<TextStyle>("counterStyle", counterStyle,
defaultValue: defaultTheme.counterStyle));
properties.add(new DiagnosticsProperty<bool?>("filled", filled, defaultValue: defaultTheme.filled));
properties.add(new DiagnosticsProperty<Color>("fillColor", fillColor,
defaultValue: defaultTheme.fillColor));
properties.add(new ColorProperty("fillColor", fillColor, defaultValue: defaultTheme.fillColor));
properties.add(new ColorProperty("focusColor", focusColor, defaultValue: defaultTheme.focusColor));
properties.add(new ColorProperty("hoverColor", hoverColor, defaultValue: defaultTheme.hoverColor));
properties.add(new DiagnosticsProperty<InputBorder>("errorBorder", errorBorder,
defaultValue: defaultTheme.errorBorder));
properties.add(new DiagnosticsProperty<InputBorder>("focusedBorder", focusedBorder,

66
com.unity.uiwidgets/Runtime/material/material_localizations.cs


public abstract string backButtonTooltip { get; }
public abstract string closeButtonTooltip { get; }
public abstract string deleteButtonTooltip { get; }
public abstract string moreButtonTooltip { get; }
public abstract string nextMonthTooltip { get; }
public abstract string previousMonthTooltip { get; }
public abstract string nextPageTooltip { get; }

public abstract string formatTimeOfDay(TimeOfDay timeOfDay, bool alwaysUse24HourFormat = false);
public abstract string formatYear(DateTime date);
public abstract string formatCompactDate(DateTime date);
public abstract string formatShortDate(DateTime date);
public abstract string formatShortMonthDay(DateTime date);
public abstract DateTime? parseCompactDate(string inputString);
public abstract string formatMediumDate(DateTime date);

"November",
"December",
};
static int _getDaysInMonth(int year, int month) {
if (month == 2) {
bool isLeapYear = (year % 4 == 0) && (year % 100 != 0) ||
(year % 400 == 0);
if (isLeapYear) {
return 29;
}
return 28;
}
int[] daysInMonth = new int[] { 31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
return daysInMonth[month - 1];
}
public override string formatHour(TimeOfDay timeOfDay, bool alwaysUse24HourFormat = false) {
TimeOfDayFormat format = timeOfDayFormat(alwaysUse24HourFormat: alwaysUse24HourFormat);

return date.Year.ToString();
}
public override string formatCompactDate(DateTime date) {
string month = _formatTwoDigitZeroPad(date.Month);
string day = _formatTwoDigitZeroPad(date.Day);
string year = date.Year.ToString().PadLeft(4, '0');
return $"{month}/{day}/{year}";
}
public override string formatShortDate(DateTime date) {
string month = _shortMonths[date.Month - 1];
return $"{month} {date.Day}, {date.Year}";
}
public override string formatMediumDate(DateTime date) {
string day = _shortWeekdays[((int) date.DayOfWeek + 6) % 7];
string month = _shortMonths[date.Month - 1];

string year = formatYear(date);
string month = _months[date.Month - 1];
return $"{month} {year}";
}
public override string formatShortMonthDay(DateTime date) {
string month = _shortMonths[date.Month - 1];
return $"{month} {date.Day}";
}
public override DateTime? parseCompactDate(string inputString) {
string[] inputParts = inputString.Split('/');
if (inputParts.Length != 3) {
return null;
}
bool success = int.TryParse(inputParts[2], out int year);
if (!success || year < 1) {
return null;
}
success = int.TryParse(inputParts[0], out int month);
if (!success || month < 1 || month > 12) {
return null;
}
success = int.TryParse(inputParts[1], out int day);
if (!success || day < 1 || day > _getDaysInMonth(year, month)) {
return null;
}
return new DateTime(year, month, day);
}
public override List<string> narrowWeekdays {

public override string deleteButtonTooltip {
get { return "Delete"; }
}
public override string moreButtonTooltip {
get { return "More"; }
}
public override string nextMonthTooltip {

正在加载...
取消
保存