浏览代码

update

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
cc7bb1f7
共有 9 个文件被更改,包括 818 次插入199 次删除
  1. 8
      com.unity.uiwidgets/Runtime/material/card.cs
  2. 12
      com.unity.uiwidgets/Runtime/material/card_theme.cs
  3. 184
      com.unity.uiwidgets/Runtime/material/checkbox.cs
  4. 573
      com.unity.uiwidgets/Runtime/material/chip.cs
  5. 38
      com.unity.uiwidgets/Runtime/material/chip_theme.cs
  6. 6
      com.unity.uiwidgets/Runtime/material/ink_ripple.cs
  7. 30
      com.unity.uiwidgets/Runtime/material/ink_splash.cs
  8. 82
      com.unity.uiwidgets/Runtime/material/ink_well.cs
  9. 84
      com.unity.uiwidgets/Runtime/material/checkbox_list_tile.cs

8
com.unity.uiwidgets/Runtime/material/card.cs


using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;

public Card(
Key key = null,
Color color = null,
Color shadowColor = null,
float? elevation = null,
ShapeBorder shape = null,
bool borderOnForeground = true,

D.assert(elevation == null || elevation >= 0.0f);
this.color = color;
this.shadowColor = shadowColor;
this.elevation = elevation;
this.shape = shape;
this.borderOnForeground = borderOnForeground;

public readonly Color color;
public readonly Color shadowColor;
public readonly float? elevation;
public readonly ShapeBorder shape;

child: new Material(
type: MaterialType.card,
color: color ?? cardTheme.color ?? Theme.of(context).cardColor,
shadowColor: shadowColor ?? cardTheme.shadowColor ?? Colors.black,
clipBehavior: clipBehavior ?? cardTheme.clipBehavior ?? _defaultClipBehavior,
clipBehavior: clipBehavior ?? cardTheme.clipBehavior ?? Clip.none,
child: child)
);
}

12
com.unity.uiwidgets/Runtime/material/card_theme.cs


public CardTheme(
Clip? clipBehavior = null,
Color color = null,
Color shadowColor = null,
float? elevation = null,
EdgeInsets margin = null,
ShapeBorder shape = null

this.color = color;
this.shadowColor = shadowColor;
this.elevation = elevation;
this.margin = margin;
this.shape = shape;

public readonly Color color;
public readonly Color shadowColor;
public readonly float? elevation;
public readonly EdgeInsets margin;

CardTheme copyWith(
Clip? clipBehavior = null,
Color color = null,
Color shadowColor = null,
float? elevation = null,
EdgeInsets margin = null,
ShapeBorder shape = null

color: color ?? this.color,
shadowColor: shadowColor ?? this.shadowColor,
elevation: elevation ?? this.elevation,
margin: margin ?? this.margin,
shape: shape ?? this.shape

return new CardTheme(
clipBehavior: t < 0.5f ? a?.clipBehavior : b?.clipBehavior,
color: Color.lerp(a?.color, b?.color, t),
shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
margin: EdgeInsets.lerp(a?.margin, b?.margin, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)

public override int GetHashCode() {
var hashCode = clipBehavior?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ color?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ shadowColor?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ elevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ margin?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ shape?.GetHashCode() ?? 0;

public bool Equals(CardTheme other) {
return other.clipBehavior == clipBehavior
&& other.color == color
&& other.shadowColor == shadowColor
&& other.elevation == elevation
&& other.margin == margin
&& other.shape == shape;

base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Clip?>("clipBehavior", clipBehavior, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", color, defaultValue: null));
properties.add(new ColorProperty("color", color, defaultValue: null));
properties.add(new ColorProperty("shadowColor", shadowColor, defaultValue: null));
properties.add(new DiagnosticsProperty<float?>("elevation", elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("margin", margin, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));

184
com.unity.uiwidgets/Runtime/material/checkbox.cs


using System;
using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;

ValueChanged<bool?> onChanged = null,
Color activeColor = null,
Color checkColor = null,
MaterialTapTargetSize? materialTapTargetSize = null
Color focusColor = null,
Color hoverColor = null,
MaterialTapTargetSize? materialTapTargetSize = null,
VisualDensity visualDensity = null,
FocusNode focusNode = null,
bool autofocus = false
) : base(key: key) {
D.assert(tristate || value != null);
this.value = value;

this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.visualDensity = visualDensity;
this.focusNode = focusNode;
this.autofocus = autofocus;
}
public readonly bool? value;

public readonly bool tristate;
public readonly MaterialTapTargetSize? materialTapTargetSize;
public readonly VisualDensity visualDensity;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly FocusNode focusNode;
public readonly bool autofocus;
public const float width = 18.0f;

}
class _CheckboxState : TickerProviderStateMixin<Checkbox> {
bool enabled {
get { return widget.onChanged != null; }
}
Dictionary<LocalKey, ActionFactory> _actionMap;
public override void initState() {
base.initState();
_actionMap = new Dictionary<LocalKey, ActionFactory> {
{ActivateAction.key, _createAction}
};
}
void _actionHandler(FocusNode node, Intent intent) {
if (widget.onChanged != null) {
switch (widget.value) {
case false:
widget.onChanged(true);
break;
case true:
widget.onChanged(widget.tristate);
break;
default: // case null:
widget.onChanged(false);
break;
}
}
RenderObject renderObject = node.context.findRenderObject();
// renderObject.sendSemanticsEvent(const TapSemanticEvent());
}
UiWidgetAction _createAction() {
return new CallbackAction(
ActivateAction.key,
onInvoke: _actionHandler
);
}
bool _focused = false;
void _handleFocusHighlightChanged(bool focused) {
if (focused != _focused) {
setState(() => { _focused = focused; });
}
}
bool _hovering = false;
void _handleHoverChanged(bool hovering) {
if (hovering != _hovering) {
setState(() => { _hovering = hovering; });
}
}
public override Widget build(BuildContext context) {
D.assert(material_.debugCheckHasMaterial(context));
ThemeData themeData = Theme.of(context);

throw new Exception("Unknown target size: " + widget.materialTapTargetSize);
}
size += (widget.visualDensity ?? themeData.visualDensity).baseSizeAdjustment;
return new _CheckboxRenderObjectWidget(
value: widget.value,
tristate: widget.tristate,
activeColor: widget.activeColor ?? themeData.toggleableActiveColor,
checkColor: widget.checkColor ?? new Color(0xFFFFFFFF),
inactiveColor: widget.onChanged != null
? themeData.unselectedWidgetColor
: themeData.disabledColor,
onChanged: widget.onChanged,
additionalConstraints: additionalConstraints,
vsync: this
return new FocusableActionDetector(
actions: _actionMap,
focusNode: widget.focusNode,
autofocus: widget.autofocus,
enabled: enabled,
onShowFocusHighlight: _handleFocusHighlightChanged,
onShowHoverHighlight: _handleHoverChanged,
child: new Builder(
builder: (BuildContext _context) => {
return new _CheckboxRenderObjectWidget(
value: widget.value,
tristate: widget.tristate,
activeColor: widget.activeColor ?? themeData.toggleableActiveColor,
checkColor: widget.checkColor ?? new Color(0xFFFFFFFF),
inactiveColor: enabled ? themeData.unselectedWidgetColor : themeData.disabledColor,
focusColor: widget.focusColor ?? themeData.focusColor,
hoverColor: widget.hoverColor ?? themeData.hoverColor,
onChanged: widget.onChanged,
additionalConstraints: additionalConstraints,
vsync: this,
hasFocus: _focused,
hovering: _hovering
);
}
)
);
}
}

Color activeColor = null,
Color checkColor = null,
Color inactiveColor = null,
Color focusColor = null,
Color hoverColor = null,
BoxConstraints additionalConstraints = null
BoxConstraints additionalConstraints = null,
bool? hasFocus = null,
bool? hovering = null
) : base(key: key) {
D.assert(tristate || value != null);
D.assert(activeColor != null);

this.activeColor = activeColor;
this.checkColor = checkColor;
this.inactiveColor = inactiveColor;
this.focusColor = focusColor;
this.hoverColor = hoverColor;
this.hasFocus = hasFocus;
this.hovering = hovering;
public readonly bool? hasFocus;
public readonly bool? hovering;
public readonly Color focusColor;
public readonly Color hoverColor;
public readonly ValueChanged<bool?> onChanged;
public readonly TickerProvider vsync;
public readonly BoxConstraints additionalConstraints;

activeColor: activeColor,
checkColor: checkColor,
inactiveColor: inactiveColor,
focusColor: focusColor,
hoverColor: hoverColor,
additionalConstraints: additionalConstraints
additionalConstraints: additionalConstraints,
hasFocus: hasFocus,
hovering: hovering
);
}

renderObject.tristate = tristate;
renderObject.activeColor = activeColor;
renderObject.checkColor = checkColor;
renderObject.focusColor = focusColor;
renderObject.hoverColor = hoverColor;
renderObject.hasFocus = hasFocus ?? false;
renderObject.hovering = hovering ?? false;
}
}

Color activeColor = null,
Color checkColor = null,
Color inactiveColor = null,
Color focusColor = null,
Color hoverColor = null,
TickerProvider vsync = null
TickerProvider vsync = null,
bool? hasFocus = null,
bool? hovering = null
value: value,
tristate: tristate,
activeColor: activeColor,
inactiveColor: inactiveColor,
onChanged: onChanged,
additionalConstraints: additionalConstraints,
vsync: vsync
) {
value: value,
tristate: tristate,
activeColor: activeColor,
inactiveColor: inactiveColor,
focusColor: focusColor,
hoverColor: hoverColor,
onChanged: onChanged,
additionalConstraints: additionalConstraints,
vsync: vsync,
hasFocus: hasFocus ?? false,
hovering: hovering ?? false
) {
_oldValue = value;
this.checkColor = checkColor;
}

: (t >= 0.25f ? activeColor : Color.lerp(inactiveColor, activeColor, t * 4.0f));
}
void _initStrokePaint(Paint paint) {
Paint _createStrokePaint() {
var paint = new Paint();
return paint;
}
void _drawBorder(Canvas canvas, RRect outer, float t, Paint paint) {

Canvas canvas = context.canvas;
paintRadialReaction(canvas, offset, size.center(Offset.zero));
Paint strokePaint = _createStrokePaint();
Offset origin = offset + (size / 2.0f - Size.square(CheckboxUtils._kEdgeSize) / 2.0f);
AnimationStatus status = position.status;
float tNormalized = status == AnimationStatus.forward || status == AnimationStatus.completed

else {
canvas.drawRRect(outer, paint);
_initStrokePaint(paint);
_drawDash(canvas, origin, tShrink, paint);
_drawDash(canvas, origin, tShrink, strokePaint);
_drawCheck(canvas, origin, tShrink, paint);
_drawCheck(canvas, origin, tShrink, strokePaint);
}
}
}

paint.color = _colorAt(1.0f);
canvas.drawRRect(outer, paint);
_initStrokePaint(paint);
_drawCheck(canvas, origin, tShrink, paint);
_drawCheck(canvas, origin, tShrink, strokePaint);
_drawDash(canvas, origin, tShrink, paint);
_drawDash(canvas, origin, tShrink, strokePaint);
_drawCheck(canvas, origin, tExpand, paint);
_drawCheck(canvas, origin, tExpand, strokePaint);
_drawDash(canvas, origin, tExpand, paint);
_drawDash(canvas, origin, tExpand, strokePaint);
}
}
}

573
com.unity.uiwidgets/Runtime/material/chip.cs
文件差异内容过多而无法显示
查看文件

38
com.unity.uiwidgets/Runtime/material/chip_theme.cs


using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class ChipTheme : InheritedWidget {
public class ChipTheme : InheritedTheme {
public ChipTheme(
Key key = null,
ChipThemeData data = null,

public readonly ChipThemeData data;
public static ChipThemeData of(BuildContext context) {
ChipTheme inheritedTheme = (ChipTheme) context.inheritFromWidgetOfExactType(typeof(ChipTheme));
ChipTheme inheritedTheme = (ChipTheme) context.dependOnInheritedWidgetOfExactType<ChipTheme>();
public override Widget wrap(BuildContext context, Widget child) {
ChipTheme ancestorTheme = context.findAncestorWidgetOfExactType<ChipTheme>();
return ReferenceEquals(this, ancestorTheme) ? child : new ChipTheme(data: data, child: child);
}
public override bool updateShouldNotify(InheritedWidget _oldWidget) {
ChipTheme oldWidget = _oldWidget as ChipTheme;
return data != oldWidget.data;

Color secondarySelectedColor = null,
Color shadowColor = null,
Color selectedShadowColor = null,
bool? showCheckmark = null,
Color checkmarkColor = null,
EdgeInsets labelPadding = null,
EdgeInsets padding = null,
ShapeBorder shape = null,

this.secondarySelectedColor = secondarySelectedColor;
this.shadowColor = shadowColor;
this.selectedShadowColor = selectedShadowColor;
this.showCheckmark = showCheckmark;
this.checkmarkColor = checkmarkColor;
this.labelPadding = labelPadding;
this.padding = padding;
this.shape = shape;

public readonly Color selectedShadowColor;
public readonly bool? showCheckmark;
public readonly Color checkmarkColor;
public readonly EdgeInsets labelPadding;
public readonly EdgeInsets padding;

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

secondarySelectedColor: secondarySelectedColor ?? this.secondarySelectedColor,
shadowColor: shadowColor ?? this.shadowColor,
selectedShadowColor: selectedShadowColor ?? this.selectedShadowColor,
checkmarkColor: checkmarkColor ?? this.checkmarkColor,
labelPadding: labelPadding ?? this.labelPadding,
padding: padding ?? this.padding,
shape: shape ?? this.shape,

secondarySelectedColor: Color.lerp(a?.secondarySelectedColor, b?.secondarySelectedColor, t),
shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
selectedShadowColor: Color.lerp(a?.selectedShadowColor, b?.selectedShadowColor, t),
checkmarkColor: Color.lerp(a?.checkmarkColor, b?.checkmarkColor, 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) ^ secondarySelectedColor.GetHashCode();
hashCode = (hashCode * 397) ^ shadowColor?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ selectedShadowColor?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ checkmarkColor?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ labelPadding.GetHashCode();
hashCode = (hashCode * 397) ^ padding.GetHashCode();
hashCode = (hashCode * 397) ^ shape.GetHashCode();

&& other.secondarySelectedColor == secondarySelectedColor
&& other.shadowColor == shadowColor
&& other.selectedShadowColor == selectedShadowColor
&& other.checkmarkColor == checkmarkColor
&& other.labelPadding == labelPadding
&& other.padding == padding
&& other.shape == shape

brightness: defaultTheme.brightness,
labelStyle: defaultTheme.textTheme.body2
);
properties.add(new DiagnosticsProperty<Color>("backgroundColor", backgroundColor,
properties.add(new ColorProperty("backgroundColor", backgroundColor,
properties.add(new DiagnosticsProperty<Color>("deleteIconColor", deleteIconColor,
properties.add(new ColorProperty("deleteIconColor", deleteIconColor,
properties.add(new DiagnosticsProperty<Color>("disabledColor", disabledColor,
properties.add(new ColorProperty("disabledColor", disabledColor,
properties.add(new DiagnosticsProperty<Color>("selectedColor", selectedColor,
properties.add(new ColorProperty("selectedColor", selectedColor,
properties.add(new DiagnosticsProperty<Color>("secondarySelectedColor", secondarySelectedColor,
properties.add(new ColorProperty("secondarySelectedColor", secondarySelectedColor,
properties.add(new DiagnosticsProperty<Color>("shadowColor", shadowColor,
properties.add(new ColorProperty("shadowColor", shadowColor,
properties.add(new DiagnosticsProperty<Color>("selectedShadowColor", selectedShadowColor,
properties.add(new ColorProperty("selectedShadowColor", selectedShadowColor,
properties.add(new ColorProperty("checkMarkColor", checkmarkColor,
defaultValue: defaultData.checkmarkColor));
properties.add(new DiagnosticsProperty<EdgeInsets>("labelPadding", labelPadding,
defaultValue: defaultData.labelPadding));
properties.add(

6
com.unity.uiwidgets/Runtime/material/ink_ripple.cs


RenderBox referenceBox = null,
Offset position = null,
Color color = null,
TextDirection? textDirection = null,
bool containedInkWell = false,
RectCallback rectCallback = null,
BorderRadius borderRadius = null,

D.assert(referenceBox != null);
D.assert(position != null);
D.assert(color != null);
D.assert(textDirection != null);
return new InkRipple(
controller: controller,
referenceBox: referenceBox,

borderRadius: borderRadius,
customBorder: customBorder,
radius: radius,
onRemoved: onRemoved);
onRemoved: onRemoved,
textDiretion: textDirection
);
}
}

30
com.unity.uiwidgets/Runtime/material/ink_splash.cs


RenderBox referenceBox = null,
Offset position = null,
Color color = null,
TextDirection? textDirection = null,
bool containedInkWell = false,
RectCallback rectCallback = null,
BorderRadius borderRadius = null,

D.assert(referenceBox != null);
D.assert(position != null);
D.assert(color != null);
D.assert(textDirection != null);
return new InkSplash(
controller: controller,
referenceBox: referenceBox,

borderRadius: borderRadius,
customBorder: customBorder,
radius: radius,
onRemoved: onRemoved);
onRemoved: onRemoved,
textDirection: textDirection
);
}
}

readonly RectCallback _clipCallback;
readonly bool _repositionToReferenceBox;
readonly TextDirection _textDirection;
readonly TextDirection _textDirection;
Animation<float> _radius;
AnimationController _radiusController;

}
paintInkCircle(
canvas: canvas,
transform: transform,
paint: paint,
center: center,
textDirection: _textDirection,
radius: _radius.value,
customBorder: _customBorder,
borderRadius: _borderRadius,
clipCallback: _clipCallback
);
canvas: canvas,
transform: transform,
paint: paint,
center: center,
textDirection: _textDirection,
radius: _radius.value,
customBorder: _customBorder,
borderRadius: _borderRadius,
clipCallback: _clipCallback
);
}
}
}

82
com.unity.uiwidgets/Runtime/material/ink_well.cs


}
Color _color;
protected void paintInkCircle(
Canvas canvas,
Matrix4 transform,

ShapeBorder customBorder = null,
BorderRadius borderRadius = null,
RectCallback clipCallback = null) {
borderRadius = borderRadius ?? BorderRadius.zero;
D.assert(canvas != null);
D.assert(transform != null);

canvas.save();
if (originOffset == null) {
canvas.transform(transform.storage);
} else {
}
else {
}
}
else if (borderRadius != BorderRadius.zero) {
canvas.clipRRect(RRect.fromRectAndCorners(
rect,

}
}
canvas.drawCircle(center, radius, paint);
canvas.restore();
}

RenderBox referenceBox = null,
Offset position = null,
Color color = null,
TextDirection? textDirection = null,
bool containedInkWell = false,
RectCallback rectCallback = null,
BorderRadius borderRadius = null,

public class _InkResponseState<T> : AutomaticKeepAliveClientMixin<T> where T : InkResponse {
HashSet<InteractiveInkFeature> _splashes;
InteractiveInkFeature _currentSplash;
void _handleAction(FocusNode node, Intent intent) {
_startSplash(context: node.context);
_handleTap(node.context);

return new CallbackAction(
ActivateAction.key,
onInvoke: _handleAction
onInvoke: _handleAction
);
}

protected override bool wantKeepAlive {
get { return highlightsExist || (_splashes != null && _splashes.isNotEmpty()); }
}
Color getHighlightColorForType(_HighlightType type) {
switch (type) {
case _HighlightType.pressed:

case _HighlightType.hover:
return widget.hoverColor ?? Theme.of(context).hoverColor;
}
return new TimeSpan(0, 0, 0, 0, 200);
return new TimeSpan(0, 0, 0, 0, 200);
D.assert(false, () => $"Unhandled {typeof(_HighlightType)} {type}");
return TimeSpan.Zero;
}

onRemoved: handleInkRemoval,
textDirection: Directionality.of(context),
fadeDuration: getFadeDurationForType(type)
);
);
updateKeepAlive();
}
else {

if (_currentSplash == splash) {
_currentSplash = null;
}
updateKeepAlive();
}
}

return splash;
}
setState(() =>{
_updateFocusHighlights();
});
setState(() => { _updateFocusHighlights(); });
}
void _updateFocusHighlights() {

break;
}
}
void _handleFocusUpdate(bool hasFocus) {
_hasFocus = hasFocus;
_updateFocusHighlights();

widget.onTapDown(details);
}
}
void _startSplash(TapDownDetails details = null, BuildContext context = null) {
void _startSplash(TapDownDetails details = null, BuildContext context = null) {
D.assert(details != null || context != null);
Offset globalPosition;

globalPosition = referenceBox.localToGlobal(referenceBox.paintBounds.center);
} else {
}
else {
InteractiveInkFeature splash = _createInkFeature(globalPosition);
_splashes = _splashes ?? new HashSet<InteractiveInkFeature>();
_splashes.Add(splash);

}
D.assert(_currentSplash == null);
foreach ( _HighlightType highlight in _highlights.Keys) {
foreach (_HighlightType highlight in _highlights.Keys) {
get {
return _isWidgetEnabled(widget);
}
get { return _isWidgetEnabled(widget); }
void _handleMouseEnter(PointerEnterEvent Event) {
_handleHoverChange(true);
}

public override Widget build(BuildContext context) {
D.assert(widget.debugCheckContext(context));
base.build(context);
foreach ( _HighlightType type in _highlights.Keys) {
foreach (_HighlightType type in _highlights.Keys) {
if (_highlights[type] != null) {
_highlights[type].color = getHighlightColorForType(type);
}

_currentSplash.color = widget.splashColor ?? Theme.of(context).splashColor;
}
return new Actions(
actions: _actionMap,
child: new Focus(

autofocus: widget.autofocus,
child: new MouseRegion(
onEnter: enabled ? _handleMouseEnter : (PointerEnterEventListener)null,
onExit: enabled ? _handleMouseExit : (PointerExitEventListener)null,
onEnter: enabled ? _handleMouseEnter : (PointerEnterEventListener) null,
onExit: enabled ? _handleMouseExit : (PointerExitEventListener) null,
onTapDown: enabled ? _handleTapDown : (GestureTapDownCallback)null,
onTapDown: enabled ? _handleTapDown : (GestureTapDownCallback) null,
onTapCancel: enabled ? _handleTapCancel : (GestureTapCancelCallback)null,
onDoubleTap: widget.onDoubleTap != null ? _handleDoubleTap : (GestureDoubleTapCallback)null,
onLongPress: widget.onLongPress != null ? () => _handleLongPress(context) : (GestureLongPressCallback)null,
onTapCancel: enabled ? _handleTapCancel : (GestureTapCancelCallback) null,
onDoubleTap: widget.onDoubleTap != null
? _handleDoubleTap
: (GestureDoubleTapCallback) null,
onLongPress: widget.onLongPress != null
? () => _handleLongPress(context)
: (GestureLongPressCallback) null,
behavior: HitTestBehavior.opaque,
child: widget.child
)

84
com.unity.uiwidgets/Runtime/material/checkbox_list_tile.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class CheckboxListTile : StatelessWidget {
public CheckboxListTile(
Key key,
bool? value = null,
ValueChanged<bool?> onChanged = null,
Color activeColor = null,
Color checkColor = null,
Widget title = null,
Widget subtitle = null,
bool isThreeLine = false,
bool? dense = null,
Widget secondary = null,
bool selected = false,
ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform
) : base(key: key) {
D.assert(value != null);
D.assert(!isThreeLine || subtitle != null);
this.checkColor = checkColor;
this.title = title;
this.subtitle = subtitle;
this.isThreeLine = isThreeLine;
this.dense = dense;
this.secondary = secondary;
this.selected = selected;
this.controlAffinity = controlAffinity;
}
public readonly bool? value;
public readonly ValueChanged<bool?> onChanged;
public readonly Color activeColor;
public readonly Color checkColor;
public readonly Widget title;
public readonly Widget subtitle;
public readonly Widget secondary;
public readonly bool isThreeLine;
public readonly bool? dense;
public readonly bool selected;
public readonly ListTileControlAffinity controlAffinity;
public override Widget build(BuildContext context) {
Widget control = new Checkbox(
value: value,
onChanged: onChanged,
activeColor: activeColor,
checkColor: checkColor,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap
);
Widget leading = null;
Widget trailing = null;
switch (controlAffinity) {
case ListTileControlAffinity.leading:
leading = control;
trailing = secondary;
break;
case ListTileControlAffinity.trailing:
case ListTileControlAffinity.platform:
leading = secondary;
trailing = control;
break;
}
return ListTileTheme.merge(
selectedColor: activeColor ?? Theme.of(context).accentColor,
child: new ListTile(
leading: leading,
title: title,
subtitle: subtitle,
trailing: trailing,
isThreeLine: isThreeLine,
dense: dense,
enabled: onChanged != null,
onTap: onChanged != null ? () => { onChanged(!value); } : (GestureTapCallback) null,
selected: selected
)
);
}
}
}
正在加载...
取消
保存