浏览代码

[1.5.4] Upgrade chip and chip theme.

/main
Yuncong Zhang 5 年前
当前提交
853462df
共有 4 个文件被更改,包括 126 次插入8 次删除
  1. 2
      Runtime/material/button_theme.cs
  2. 106
      Runtime/material/chip.cs
  3. 22
      Runtime/material/chip_theme.cs
  4. 4
      Runtime/material/ink_well.cs

2
Runtime/material/button_theme.cs


return fillColor;
}
if (button is FlatButton || button is OutlineButton) {
if (button is FlatButton || button is OutlineButton || button.GetType() == typeof(MaterialButton)) {
return null;
}

106
Runtime/material/chip.cs


MaterialTapTargetSize? materialTapTargetSize { get; }
float? elevation { get; }
Color shadowColor { get; }
}
public interface DeletableChipAttributes {

string tooltip { get; }
ShapeBorder avatarBorder { get; }
Color selectedShadowColor { get; }
}
public interface DisabledChipAttributes {

Color backgroundColor = null,
EdgeInsets padding = null,
MaterialTapTargetSize? materialTapTargetSize = null,
float? elevation = null
float? elevation = null,
Color shadowColor = null
) : base(key: key) {
D.assert(label != null);
D.assert(elevation == null || elevation >= 0.0f);

this._padding = padding;
this._materialTapTargetSize = materialTapTargetSize;
this._elevation = elevation;
this._shadowColor = shadowColor;
}
public Widget avatar {

}
float? _elevation;
public Color shadowColor {
get { return this._shadowColor; }
}
Color _shadowColor;
public override Widget build(BuildContext context) {
D.assert(MaterialD.debugCheckHasMaterial(context));

padding: this.padding,
materialTapTargetSize: this.materialTapTargetSize,
elevation: this.elevation,
shadowColor: this.shadowColor,
isEnabled: true
);
}

EdgeInsets padding = null,
MaterialTapTargetSize? materialTapTargetSize = null,
float? elevation = null,
Color shadowColor = null,
Color selectedShadowColor = null,
ShapeBorder avatarBorder = null
) : base(key: key) {

this._padding = padding;
this._materialTapTargetSize = materialTapTargetSize;
this._elevation = elevation;
this._shadowColor = shadowColor;
this._selectedShadowColor = selectedShadowColor;
}
public Widget avatar {

float? _elevation;
public Color shadowColor {
get { return this._shadowColor; }
}
Color _shadowColor;
public Color selectedShadowColor {
get { return this._selectedShadowColor; }
}
Color _selectedShadowColor;
public ShapeBorder avatarBorder {
get { return this._avatarBorder; }
}

padding: this.padding,
materialTapTargetSize: this.materialTapTargetSize,
elevation: this.elevation,
shadowColor: this.shadowColor,
selectedShadowColor: this.selectedShadowColor,
isEnabled: this.isEnabled == true &&
(this.onSelected != null || this.onDeleted != null || this.onPressed != null),
avatarBorder: this.avatarBorder

EdgeInsets padding = null,
MaterialTapTargetSize? materialTapTargetSize = null,
float? elevation = null,
Color shadowColor = null,
Color selectedShadowColor = null,
ShapeBorder avatarBorder = null
) : base(key: key) {
D.assert(selected != null);

this._padding = padding;
this._materialTapTargetSize = materialTapTargetSize;
this._elevation = elevation;
this._shadowColor = shadowColor;
this._selectedShadowColor = selectedShadowColor;
}
public Widget avatar {

float? _elevation;
public Color shadowColor {
get { return this._shadowColor; }
}
Color _shadowColor;
public Color selectedShadowColor {
get { return this._selectedShadowColor; }
}
Color _selectedShadowColor;
public ShapeBorder avatarBorder {
get { return this._avatarBorder; }
}

isEnabled: this.isEnabled,
materialTapTargetSize: this.materialTapTargetSize,
elevation: this.elevation,
shadowColor: this.shadowColor,
selectedShadowColor: this.selectedShadowColor,
avatarBorder: this.avatarBorder
);
}

EdgeInsets padding = null,
MaterialTapTargetSize? materialTapTargetSize = null,
float? elevation = null,
Color shadowColor = null,
Color selectedShadowColor = null,
ShapeBorder avatarBorder = null
) : base(key: key) {
D.assert(label != null);

this._padding = padding;
this._materialTapTargetSize = materialTapTargetSize;
this._elevation = elevation;
this._shadowColor = shadowColor;
this._selectedShadowColor = selectedShadowColor;
}
public Widget avatar {

float? _elevation;
public Color shadowColor {
get { return this._shadowColor; }
}
Color _shadowColor;
public Color selectedShadowColor {
get { return this._selectedShadowColor; }
}
Color _selectedShadowColor;
public ShapeBorder avatarBorder {
get { return this._avatarBorder; }
}

isEnabled: this.isEnabled,
materialTapTargetSize: this.materialTapTargetSize,
elevation: this.elevation,
shadowColor: this.shadowColor,
selectedShadowColor: this.selectedShadowColor,
avatarBorder: this.avatarBorder
);
}

Color backgroundColor = null,
EdgeInsets padding = null,
MaterialTapTargetSize? materialTapTargetSize = null,
float? elevation = null
float? elevation = null,
Color shadowColor = null
) : base(key: key) {
D.assert(label != null);
D.assert(

this._padding = padding;
this._materialTapTargetSize = materialTapTargetSize;
this._elevation = elevation;
this._shadowColor = shadowColor;
}

float? _elevation;
public Color shadowColor {
get { return this._shadowColor; }
}
Color _shadowColor;
public override Widget build(BuildContext context) {
D.assert(MaterialD.debugCheckHasMaterial(context));
return new RawChip(

labelPadding: this.labelPadding,
isEnabled: true,
materialTapTargetSize: this.materialTapTargetSize,
elevation: this.elevation
elevation: this.elevation,
shadowColor: this._shadowColor
);
}
}

Color backgroundColor = null,
MaterialTapTargetSize? materialTapTargetSize = null,
float? elevation = null,
Color shadowColor = null,
Color selectedShadowColor = null,
ShapeBorder avatarBorder = null
) : base(key: key) {
D.assert(label != null);

this._backgroundColor = backgroundColor;
this._materialTapTargetSize = materialTapTargetSize;
this._elevation = elevation;
this._shadowColor = shadowColor;
this._selectedShadowColor = selectedShadowColor;
}

float? _elevation;
public Color shadowColor {
get { return this._shadowColor; }
}
Color _shadowColor;
public Color selectedShadowColor {
get { return this._selectedShadowColor; }
}
Color _selectedShadowColor;
public ShapeBorder avatarBorder {
get { return this._avatarBorder; }
}

ShapeBorder shape = this.widget.shape ?? chipTheme.shape;
float elevation = this.widget.elevation ?? (chipTheme.elevation ?? _defaultElevation);
float pressElevation = this.widget.pressElevation ?? (chipTheme.pressElevation ?? _defaultPressElevation);
Color shadowColor = this.widget.shadowColor ?? chipTheme.shadowColor ?? _defaultShadowColor;
Color selectedShadowColor = this.widget.selectedShadowColor ?? chipTheme.selectedShadowColor ?? _defaultShadowColor;
bool selected = this.widget.selected ?? false;
shadowColor: selected ? selectedShadowColor : shadowColor,
child: new InkResponse(
child: new InkWell(
onTapCancel: this.canTap ? this._handleTapCancel : (GestureTapCallback) null,
onTapCancel: this.canTap ? this._handleTapCancel : (GestureTapCancelCallback) null,
customBorder: shape,
child: new AnimatedBuilder(
animation: ListenableUtils.merge(new List<Listenable>
{this.selectController, this.enableController}),

22
Runtime/material/chip_theme.cs


Color disabledColor = null,
Color selectedColor = null,
Color secondarySelectedColor = null,
Color shadowColor = null,
Color selectedShadowColor = null,
EdgeInsets labelPadding = null,
EdgeInsets padding = null,
ShapeBorder shape = null,

this.disabledColor = disabledColor;
this.selectedColor = selectedColor;
this.secondarySelectedColor = secondarySelectedColor;
this.shadowColor = shadowColor;
this.selectedShadowColor = selectedShadowColor;
this.labelPadding = labelPadding;
this.padding = padding;
this.shape = shape;

public readonly Color secondarySelectedColor;
public readonly Color shadowColor;
public readonly Color selectedShadowColor;
public readonly EdgeInsets labelPadding;
public readonly EdgeInsets padding;

Color disabledColor = null,
Color selectedColor = null,
Color secondarySelectedColor = null,
Color shadowColor = null,
Color selectedShadowColor = null,
EdgeInsets labelPadding = null,
EdgeInsets padding = null,
ShapeBorder shape = null,

disabledColor: disabledColor ?? this.disabledColor,
selectedColor: selectedColor ?? this.selectedColor,
secondarySelectedColor: secondarySelectedColor ?? this.secondarySelectedColor,
shadowColor: shadowColor ?? this.shadowColor,
selectedShadowColor: selectedShadowColor ?? this.selectedShadowColor,
labelPadding: labelPadding ?? this.labelPadding,
padding: padding ?? this.padding,
shape: shape ?? this.shape,

disabledColor: Color.lerp(a?.disabledColor, b?.disabledColor, t),
selectedColor: Color.lerp(a?.selectedColor, b?.selectedColor, t),
secondarySelectedColor: Color.lerp(a?.secondarySelectedColor, b?.secondarySelectedColor, t),
shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
selectedShadowColor: Color.lerp(a?.selectedShadowColor, b?.selectedShadowColor, t),
labelPadding: EdgeInsets.lerp(a?.labelPadding, b?.labelPadding, t),
padding: EdgeInsets.lerp(a?.padding, b?.padding, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),

hashCode = (hashCode * 397) ^ this.disabledColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.selectedColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.secondarySelectedColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.shadowColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.selectedShadowColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.labelPadding.GetHashCode();
hashCode = (hashCode * 397) ^ this.padding.GetHashCode();
hashCode = (hashCode * 397) ^ this.shape.GetHashCode();

&& other.disabledColor == this.disabledColor
&& other.selectedColor == this.selectedColor
&& other.secondarySelectedColor == this.secondarySelectedColor
&& other.shadowColor == this.shadowColor
&& other.selectedShadowColor == this.selectedShadowColor
&& other.labelPadding == this.labelPadding
&& other.padding == this.padding
&& other.shape == this.shape

defaultValue: defaultData.selectedColor));
properties.add(new DiagnosticsProperty<Color>("secondarySelectedColor", this.secondarySelectedColor,
defaultValue: defaultData.secondarySelectedColor));
properties.add(new DiagnosticsProperty<Color>("shadowColor", this.shadowColor,
defaultValue: defaultData.shadowColor));
properties.add(new DiagnosticsProperty<Color>("selectedShadowColor", this.selectedShadowColor,
defaultValue: defaultData.selectedShadowColor));
properties.add(new DiagnosticsProperty<EdgeInsets>("labelPadding", this.labelPadding,
defaultValue: defaultData.labelPadding));
properties.add(

4
Runtime/material/ink_well.cs


Widget child = null,
GestureTapCallback onTap = null,
GestureTapDownCallback onTapDown = null,
GestureTapCallback onTapCancel = null,
GestureTapCancelCallback onTapCancel = null,
GestureTapCallback onDoubleTap = null,
GestureLongPressCallback onLongPress = null,
ValueChanged<bool> onHighlightChanged = null,

public readonly GestureTapDownCallback onTapDown;
public readonly GestureTapCallback onTapCancel;
public readonly GestureTapCancelCallback onTapCancel;
public readonly GestureTapCallback onDoubleTap;

正在加载...
取消
保存