|
|
|
|
|
|
float? elevation = null, |
|
|
|
ShapeBorder avatarBorder = null |
|
|
|
) : base(key: key) { |
|
|
|
D.assert(selected != null); |
|
|
|
D.assert(onSelected != null); |
|
|
|
D.assert(clipBehavior != null); |
|
|
|
D.assert(pressElevation == null || pressElevation >= 0.0f); |
|
|
|
D.assert(elevation == null || elevation >= 0.0f); |
|
|
|
this._avatarBorder = avatarBorder ?? new CircleBorder(); |
|
|
|
|
|
|
) : base(key: key) { |
|
|
|
D.assert(label != null); |
|
|
|
D.assert(isEnabled != null); |
|
|
|
D.assert(clipBehavior != null); |
|
|
|
D.assert(pressElevation == null || pressElevation >= 0.0f); |
|
|
|
D.assert(elevation == null || elevation >= 0.0f); |
|
|
|
deleteIcon = deleteIcon ?? ChipUtils._kDefaultDeleteIcon; |
|
|
|
|
|
|
ChipThemeData chipTheme = ChipTheme.of(context); |
|
|
|
TextDirection textDirection = Directionality.of(context); |
|
|
|
ShapeBorder shape = this.widget.shape ?? chipTheme.shape; |
|
|
|
float elevation = this.widget.elevation ?? chipTheme.elevation ?? _defaultElevation; |
|
|
|
float pressElevation = this.widget.pressElevation ?? chipTheme.pressElevation ?? _defaultPressElevation; |
|
|
|
float elevation = this.widget.elevation ?? (chipTheme.elevation ?? _defaultElevation); |
|
|
|
float pressElevation = this.widget.pressElevation ?? (chipTheme.pressElevation ?? _defaultPressElevation); |
|
|
|
|
|
|
|
Widget result = new Material( |
|
|
|
elevation: this.isTapping ? pressElevation : elevation, |
|
|
|
|
|
|
) |
|
|
|
); |
|
|
|
BoxConstraints constraints; |
|
|
|
switch (this.widget.materialTapTargetSize) { |
|
|
|
switch (this.widget.materialTapTargetSize ?? theme.materialTapTargetSize) { |
|
|
|
case MaterialTapTargetSize.padded: |
|
|
|
constraints = new BoxConstraints(minHeight: 48.0f); |
|
|
|
break; |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void _mountChild(Widget widget, _ChipSlot slot) { |
|
|
|
Element oldChild = this.slotToChild[slot]; |
|
|
|
Element oldChild = this.slotToChild.getOrDefault(slot); |
|
|
|
Element newChild = this.updateChild(oldChild, widget, slot); |
|
|
|
if (oldChild != null) { |
|
|
|
this.slotToChild.Remove(slot); |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override void insertChildRenderObject(RenderObject child, dynamic slotValue) { |
|
|
|
protected override void insertChildRenderObject(RenderObject child, object slotValue) { |
|
|
|
_ChipSlot slot = slotValue; |
|
|
|
_ChipSlot slot = (_ChipSlot) slotValue; |
|
|
|
this._updateRenderObject(child, slot); |
|
|
|
D.assert(this.renderObject.childToSlot.ContainsKey((RenderBox) child)); |
|
|
|
D.assert(this.renderObject.slotToChild.ContainsKey(slot)); |
|
|
|
|
|
|
D.assert(!this.renderObject.slotToChild.ContainsKey((_ChipSlot) this.slot)); |
|
|
|
} |
|
|
|
|
|
|
|
protected override void moveChildRenderObject(RenderObject child, dynamic slotValue) { |
|
|
|
protected override void moveChildRenderObject(RenderObject child, object slotValue) { |
|
|
|
D.assert(false, "not reachable"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static bool operator ==(_ChipRenderTheme left, _ChipRenderTheme right) { |
|
|
|
return left.Equals(right); |
|
|
|
return Equals(left, right); |
|
|
|
return !left.Equals(right); |
|
|
|
return !Equals(left, right); |
|
|
|
} |
|
|
|
|
|
|
|
public override int GetHashCode() { |
|
|
|
|
|
|
) { |
|
|
|
D.assert(theme != null); |
|
|
|
this._theme = theme; |
|
|
|
this.checkmarkAnimation.addListener(this.markNeedsPaint); |
|
|
|
checkmarkAnimation.addListener(this.markNeedsPaint); |
|
|
|
this.deleteDrawerAnimation.addListener(this.markNeedsLayout); |
|
|
|
deleteDrawerAnimation.addListener(this.markNeedsLayout); |
|
|
|
enableAnimation.addListener(this.markNeedsPaint); |
|
|
|
this.value = value; |
|
|
|
this.isEnabled = isEnabled; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const float left = 0.0f; |
|
|
|
float right = overallSize.width; |
|
|
|
return new Offset(x - boxSize.width, (contentSize - boxSize.height) / 2.0f); |
|
|
|
return new Offset(x, (contentSize - boxSize.height) / 2.0f); |
|
|
|
} |
|
|
|
|
|
|
|
Offset avatarOffset = Offset.zero; |
|
|
|
|
|
|
); |
|
|
|
this.size = this.constraints.constrain(paddedSize); |
|
|
|
D.assert(this.size.height == this.constraints.constrainHeight(paddedSize.height), |
|
|
|
"Constrained height ${size.height} doesn't match expected height " + |
|
|
|
"${constraints.constrainWidth(paddedSize.height)}"); |
|
|
|
$"Constrained height {this.size.height} doesn't match expected height " + |
|
|
|
$"{this.constraints.constrainWidth(paddedSize.height)}"); |
|
|
|
"Constrained width ${size.width} doesn't match expected width " + |
|
|
|
"${constraints.constrainWidth(paddedSize.width)}"); |
|
|
|
$"Constrained width {this.size.width} doesn't match expected width " + |
|
|
|
$"{this.constraints.constrainWidth(paddedSize.width)}"); |
|
|
|
} |
|
|
|
|
|
|
|
static ColorTween selectionScrimTween = new ColorTween( |
|
|
|