浏览代码

fix yuncong's commits

/main
xingwei.zhu 6 年前
当前提交
80810ac2
共有 21 个文件被更改,包括 347 次插入173 次删除
  1. 7
      Runtime/material/button.cs
  2. 67
      Runtime/material/button_bar.cs
  3. 74
      Runtime/material/button_theme.cs
  4. 1
      Runtime/material/divider.cs
  5. 60
      Runtime/material/flat_button.cs
  6. 13
      Runtime/material/icon_button.cs
  7. 59
      Runtime/material/ink_ripple.cs
  8. 2
      Runtime/material/ink_splash.cs
  9. 7
      Runtime/material/material_button.cs
  10. 79
      Runtime/material/raised_button.cs
  11. 12
      Runtime/material/utils.cs
  12. 1
      Runtime/widgets/single_child_scroll_view.cs
  13. 1
      Samples/MaterialSample/DividerButtonCanvas.cs
  14. 1
      Samples/UIWidgetSample/MaterialCanvas.cs
  15. 73
      Samples/UIWidgetSample/UIWidgetSample.unity
  16. 11
      Runtime/material/button_bar.cs.meta
  17. 11
      Runtime/material/flat_button.cs.meta
  18. 11
      Runtime/material/ink_ripple.cs.meta
  19. 11
      Runtime/material/raised_button.cs.meta
  20. 8
      Samples/MaterialSample.meta
  21. 11
      Samples/MaterialSample/DividerButtonCanvas.cs.meta

7
Runtime/material/button.cs


Clip clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget child = null) : base(key: key) {
D.assert(onPressed != null);
MaterialTapTargetSize _materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded;
shape = shape ?? new RoundedRectangleBorder();
padding = padding ?? EdgeInsets.zero;

onHighlightChanged: this._handleHighlightChanged,
splashColor: this.widget.splashColor,
highlightColor: this.widget.highlightColor,
onTap: () => this.widget.onPressed(),
onTap: () => {
if (this.widget.onPressed != null) {
this.widget.onPressed();
}
},
customBorder: this.widget.shape,
child: IconTheme.merge(
data: new IconThemeData(color: this.widget.textStyle?.color),

67
Runtime/material/button_bar.cs


using System;
using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.rendering;
using System.Collections.Generic;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.rendering;
) : base(key : key) {
) : base(key: key) {
this.alignment = alignment;
this.mainAxisSize = mainAxisSize;
this.children = children ?? new List<Widget>();

foreach(Widget _child in children) {
_children.Add(new Padding(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
child: _child
));
foreach (Widget _child in this.children) {
_children.Add(
new Padding(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
child: _child
)
);
mainAxisAlignment: alignment,
mainAxisSize: mainAxisSize,
mainAxisAlignment: this.alignment,
mainAxisSize: this.mainAxisSize,
switch(buttonTheme.layoutBehavior) {
case ButtonBarLayoutBehavior.padded:
return new Padding(
padding: EdgeInsets.symmetric(
vertical: 2.0 * paddingUnit,
horizontal: paddingUnit
),
child: child
);
case ButtonBarLayoutBehavior.constrained:
return new Container(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
constraints: new BoxConstraints(minHeight: 52.0),
alignment: Alignment.center,
child: child
);
switch (buttonTheme.layoutBehavior) {
case ButtonBarLayoutBehavior.padded:
return new Padding(
padding: EdgeInsets.symmetric(
vertical: 2.0 * paddingUnit,
horizontal: paddingUnit
),
child: child
);
case ButtonBarLayoutBehavior.constrained:
return new Container(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
constraints: new BoxConstraints(minHeight: 52.0),
alignment: Alignment.center,
child: child
);
D.assert(false);
return null;
}

74
Runtime/material/button_theme.cs


return fillColor;
}
// todo xingwei.zhu: uncomment these when FlatButton & OutlineButton & RaisedButton are ready
// if (button is FlatButton || button is OutlineButton)
// return null;
//
//
// if (button.enabled && button is RaisedButton && this._buttonColor != null)
// return this._buttonColor;
//todo:xingwei.zhu: uncomment these when OutlineButton are ready
if (button is FlatButton /* || button is OutlineButton*/) {
return null;
}
if (button.enabled && button is RaisedButton && this._buttonColor != null) {
return this._buttonColor;
}
switch (this.getTextTheme(button)) {
case ButtonTextTheme.normal:

return Colors.white;
}
// todo xingwei.zhu: uncomment these when FlatButton & OutlineButton are ready
// if (button is FlatButton || button is OutlineButton)
// return this.colorScheme.primary;
//todo:xingwei.zhu: uncomment these when OutlineButton are ready
if (button is FlatButton /* || button is OutlineButton*/) {
return this.colorScheme.primary;
}
return Colors.black;
}
}

return button.splashColor;
}
// todo xingwei.zhu: uncomment these when FlatButton & OutlineButton & RaisedButton are ready
// if (this._splashColor != null && (button is RaisedButton || button is OutlineButton)) {
// return this._splashColor;
// }
//
// if (this._splashColor != null && button is FlatButton) {
// switch (this.getTextTheme(button)) {
// case ButtonTextTheme.normal:
// case ButtonTextTheme.accent:
// return this._splashColor;
// case ButtonTextTheme.primary:
// break;
// }
// }
//todo:xingwei.zhu: uncomment these when OutlineButton is ready
if (this._splashColor != null && (button is RaisedButton /* || button is OutlineButton*/)) {
return this._splashColor;
}
if (this._splashColor != null && button is FlatButton) {
switch (this.getTextTheme(button)) {
case ButtonTextTheme.normal:
case ButtonTextTheme.accent:
return this._splashColor;
case ButtonTextTheme.primary:
break;
}
}
return this.getTextColor(button).withOpacity(0.12);
}

return button.elevation ?? 0.0;
}
// todo xingwei.zhu: uncomment these when FlatButton are ready
// if (button is FlatButton)
// return 0.0;
if (button is FlatButton) {
return 0.0;
}
return 2.0;
}

return button.highlightElevation ?? 0.0;
}
// todo xingwei.zhu: uncomment these when FlatButton & OutlineButton are ready
// if (button is FlatButton)
// return 0.0;
if (button is FlatButton) {
return 0.0;
}
//todo:xingwei.zhu: uncomment these when OutlineButton are ready
// if (button is OutlineButton)
// return 2.0;
return 8.0;

return button.padding;
}
// todo xingwei.zhu: uncomment these when MaterialButtonWithIconMixin are ready
// if (button is MaterialButtonWithIconMixin)
// return const EdgeInsetsDirectional.only(start: 12.0, end: 16.0);
if (button is MaterialButtonWithIconMixin) {
return EdgeInsets.fromLTRB(12.0, 0.0, 16.0, 0.0);
}
if (this._padding != null) {
return this._padding;

1
Runtime/material/divider.cs


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

60
Runtime/material/flat_button.cs


using System;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

Brightness? colorBrightness = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
Clip? clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget child = null) : base(
key: key,

highlightColor: highlightColor,
splashColor: splashColor,
colorBrightness: colorBrightness,
elevation: null,
highlightElevation: null,
disabledElevation: null,
animationDuration: null,
minWidth: null,
height: null,
child: child) {}
child: child) {
}
public static FlatButton icon(
Key key = null,

Brightness? colorBrightness = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
Clip? clipBehavior = null,
D.assert(icon != null);
D.assert(label != null);
return new _FlatButtonWithIcon(
key: key,
onPressed: onPressed,

ButtonThemeData buttonTheme = ButtonTheme.of(context);
return new RawMaterialButton(
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,
clipBehavior: clipBehavior ?? Clip.none,
onPressed: this.onPressed,
onHighlightChanged: this.onHighlightChanged,
clipBehavior: this.clipBehavior ?? Clip.none,
fillColor: buttonTheme.getFillColor(this),
textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
highlightColor: buttonTheme.getHighlightColor(this),

shape: buttonTheme.getShape(this),
animationDuration: buttonTheme.getAnimationDuration(this),
materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
child: child
child: this.child
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", onPressed, ifNull: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", textTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("textColor", textColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledTextColor", disabledTextColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledColor", disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("colorBrightness", colorBrightness, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize", materialTapTargetSize, defaultValue: null));
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", this.onPressed, ifNull: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", this.textTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("textColor", this.textColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledTextColor", this.disabledTextColor,
defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledColor", this.disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", this.highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", this.splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("colorBrightness", this.colorBrightness,
defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", this.padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
this.materialTapTargetSize, defaultValue: null));
class _FlatButtonWithIcon : FlatButton {
class _FlatButtonWithIcon : FlatButton, MaterialButtonWithIconMixin {
public _FlatButtonWithIcon(
Key key = null,
VoidCallback onPressed = null,

Brightness? colorBrightness = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
Clip? clipBehavior = null,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget icon = null,
Widget label = null) : base(

D.assert(label != null);
}
}
}
}

13
Runtime/material/icon_button.cs


using Unity.UIWidgets.rendering;
using System;
using System;
using Unity.UIWidgets.rendering;
public IconButton(
Key key = null,
double iconSize = 24.0,

}
return new InkResponse(
onTap: () => this.onPressed(),
onTap: () => {
if (this.onPressed != null) {
this.onPressed();
}
},
child: result,
highlightColor: this.highlightColor ?? Theme.of(context).highlightColor,
splashColor: this.splashColor ?? Theme.of(context).splashColor,

59
Runtime/material/ink_ripple.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;

onRemoved: onRemoved) {
D.assert(controller != null);
D.assert(referenceBox != null);
D.assert(color != null);
D.assert(position != null);
this._position = position;
this._borderRadius = borderRadius ?? BorderRadius.zero;
this._customBorder = customBorder;

D.assert(this._borderRadius != null);
this._fadeInController = new AnimationController(duration: InkRippleUtils._kFadeInDuration, vsync: controller.vsync);
this._fadeInController =
new AnimationController(duration: InkRippleUtils._kFadeInDuration, vsync: controller.vsync);
begin: 0,
end: color.alpha
begin: 0,
end: color.alpha
this._radiusController = new AnimationController(
duration: InkRippleUtils._kUnconfirmedRippleDuration,

this._radius = this._radiusController.drive(new DoubleTween(
begin: this._targetRadius * 0.30,
end: this._targetRadius + 5.0).chain(_easeCurveTween));
begin: this._targetRadius * 0.30,
end: this._targetRadius + 5.0
).chain(_easeCurveTween)
);
this._fadeOutController = new AnimationController(
duration: InkRippleUtils._kFadeOutDuration,

this._fadeOut = this._fadeOutController.drive(new IntTween(
begin: color.alpha,
end: 0).chain(_fadeOutIntervalTween));
begin: color.alpha,
end: 0
).chain(_fadeOutIntervalTween)
);
controller.addInkFeature(this);
}

Animation<int> _fadeOut;
AnimationController _fadeOutController;
public static InteractiveInkFeatureFactory rippleFactory = new _InkRippleFactory();
public static InteractiveInkFeatureFactory splashFactory = new _InkRippleFactory();
static Animatable<double> _easeCurveTween = new CurveTween(curve: Curves.ease);
static Animatable<double> _fadeOutIntervalTween = new CurveTween(curve: new Interval(InkRippleUtils._kFadeOutIntervalStart, 1.0));
static readonly Animatable<double> _easeCurveTween = new CurveTween(curve: Curves.ease);
static readonly Animatable<double> _fadeOutIntervalTween =
new CurveTween(curve: new Interval(InkRippleUtils._kFadeOutIntervalStart, 1.0));
this._fadeInController.forward();
_fadeInController.stop();
double fadeOutValue = 1.0 - _fadeInController.value;
_fadeOutController.setValue(fadeOutValue);
if (fadeOutValue < 1.0)
_fadeOutController.animateTo(1.0, duration: InkRippleUtils._kCancelDuration);
this._fadeInController.stop();
double fadeOutValue = 1.0 - this._fadeInController.value;
this._fadeOutController.setValue(fadeOutValue);
if (fadeOutValue < 1.0) {
this._fadeOutController.animateTo(1.0, duration: InkRippleUtils._kCancelDuration);
}
}
void _handleAlphaStatusChanged(AnimationStatus status) {

}
protected override void paintFeature(Canvas canvas, Matrix3 transform) {
int alpha = _fadeInController.isAnimating ? _fadeIn.value : _fadeOut.value;
int alpha = this._fadeInController.isAnimating ? this._fadeIn.value : this._fadeOut.value;
_position,
referenceBox.size.center(Offset.zero),
Curves.ease.transform(_radiusController.value)
this._position,
this.referenceBox.size.center(Offset.zero),
Curves.ease.transform(this._radiusController.value)
Offset originOffset = MatrixUtils.getAsTranslation(transform);
Offset originOffset = transform.getAsTranslation();
} else {
}
else {
canvas.translate(originOffset.dx, originOffset.dy);
}

}
}
//todo xingwei.zhu: remove this condition when drawCircle bug fixed (when radius.value == 0)
//todo:xingwei.zhu: remove this condition when drawCircle bug fixed (when radius.value == 0)
if (this._radius.value != 0) {
canvas.drawCircle(center, this._radius.value, paint);
}

2
Runtime/material/ink_splash.cs


}
}
//todo xingwei.zhu: remove this condition when drawCircle bug fixed (when radius.value == 0)
//todo:xingwei.zhu: remove this condition when drawCircle bug fixed (when radius.value == 0)
if (this._radius.value != 0) {
canvas.drawCircle(center, this._radius.value, paint);
}

7
Runtime/material/material_button.cs


double? disabledElevation = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
Clip? clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
TimeSpan? animationDuration = null,
double? minWidth = null,

D.assert(onPressed != null);
this.onPressed = onPressed;
this.onHighlightChanged = onHighlightChanged;
this.textTheme = textTheme;

base.debugFillProperties(properties);
properties.add(new FlagProperty("enabled", value: this.enabled, ifFalse: "disabled"));
}
}
public interface MaterialButtonWithIconMixin {
}
}

79
Runtime/material/raised_button.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme textTheme = ButtonTextTheme.normal,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,

double? disabledElevation = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
Clip? clipBehavior = Clip.none,
Widget child = null) : base(
Widget child = null
) : base(
key: key,
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,

materialTapTargetSize: materialTapTargetSize,
animationDuration: animationDuration,
child: child) {
D.assert(elevation == null || elevation >= 0.0);
D.assert(highlightElevation == null || highlightElevation >= 0.0);
D.assert(disabledElevation == null || disabledElevation >= 0.0);

Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme textTheme = ButtonTextTheme.normal,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,

Brightness colorBrightness = Brightness.dark,
Brightness? colorBrightness = null,
Clip clipBehavior = Clip.none,
MaterialTapTargetSize materialTapTargetSize = MaterialTapTargetSize.padded,
Clip? clipBehavior = null,
MaterialTapTargetSize? materialTapTargetSize = null,
D.assert(icon != null);
D.assert(label != null);
return new _RaisedButtonWithIcon(
key: key,
onPressed: onPressed,

ButtonThemeData buttonTheme = ButtonTheme.of(context);
return new RawMaterialButton(
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,
clipBehavior: clipBehavior ?? Clip.none,
onPressed: this.onPressed,
onHighlightChanged: this.onHighlightChanged,
clipBehavior: this.clipBehavior ?? Clip.none,
fillColor: buttonTheme.getFillColor(this),
textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
highlightColor: buttonTheme.getHighlightColor(this),

shape: buttonTheme.getShape(this),
animationDuration: buttonTheme.getAnimationDuration(this),
materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
child: child
child: this.child
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", onPressed, ifNull: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", textTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("textColor", textColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledTextColor", disabledTextColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledColor", disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("colorBrightness", colorBrightness, defaultValue: null));
properties.add(new DiagnosticsProperty<double?>("elevation", elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<double?>("highlightElevation", highlightElevation, defaultValue: null));
properties.add(new DiagnosticsProperty<double?>("disabledElevation", disabledElevation, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize", materialTapTargetSize, defaultValue: null));
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", this.onPressed, ifNull: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", this.textTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("textColor", this.textColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledTextColor", this.disabledTextColor,
defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledColor", this.disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", this.highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", this.splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("colorBrightness", this.colorBrightness,
defaultValue: null));
properties.add(new DiagnosticsProperty<double?>("elevation", this.elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<double?>("highlightElevation", this.highlightElevation,
defaultValue: null));
properties.add(new DiagnosticsProperty<double?>("disabledElevation", this.disabledElevation,
defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", this.padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
this.materialTapTargetSize, defaultValue: null));
class _RaisedButtonWithIcon : RaisedButton {
class _RaisedButtonWithIcon : RaisedButton, MaterialButtonWithIconMixin {
ButtonTextTheme textTheme = ButtonTextTheme.normal,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,

Brightness colorBrightness = Brightness.dark,
Brightness? colorBrightness = null,
Clip clipBehavior = Clip.none,
MaterialTapTargetSize materialTapTargetSize = MaterialTapTargetSize.padded,
Clip? clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget label = null) : base(
Widget label = null
) : base(
key: key,
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,

D.assert(label != null);
}
}
}
}

12
Runtime/material/utils.cs


public static readonly TimeSpan _kFadeOutDuration = new TimeSpan(0, 0, 0, 0, 375);
public static readonly TimeSpan _kCancelDuration = new TimeSpan(0, 0, 0, 0, 75);
// The fade out begins 225ms after the _fadeOutController starts. See confirm().
public static RectCallback _getClipCallback(RenderBox referenceBox, bool containedInkWell, RectCallback rectCallback) {
public static RectCallback _getClipCallback(RenderBox referenceBox, bool containedInkWell,
RectCallback rectCallback) {
if (containedInkWell)
if (containedInkWell) {
}
public static double _getTargetRadius(RenderBox referenceBox, bool containedInkWell, RectCallback rectCallback, Offset position) {
public static double _getTargetRadius(RenderBox referenceBox, bool containedInkWell, RectCallback rectCallback,
Offset position) {
Size size = rectCallback != null ? rectCallback().size : referenceBox.size;
double d1 = size.bottomRight(Offset.zero).distance;
double d2 = (size.topRight(Offset.zero) - size.bottomLeft(Offset.zero)).distance;

1
Runtime/widgets/single_child_scroll_view.cs


}
Offset _paintOffsetForPosition(double position) {
D.assert(this.axisDirection != null);
switch (this.axisDirection) {
case AxisDirection.up:
return new Offset(0.0, position - this.child.size.height + this.size.height);

1
Samples/MaterialSample/DividerButtonCanvas.cs


using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace UIWidgetsSample {
public class DividerButtonCanvas : WidgetCanvas {
protected override Widget getWidget() {

1
Samples/UIWidgetSample/MaterialCanvas.cs


return new Material(
child: new Center(
child: new MaterialButton(
color: Colors.blue,
splashColor: new Color(0xFFFF0011),
highlightColor: new Color(0x88FF0011),
onPressed: () => { Debug.Log("pressed here"); }

73
Samples/UIWidgetSample/UIWidgetSample.unity


- {fileID: 1399904531}
- {fileID: 432951246}
- {fileID: 552752111}
- {fileID: 1199742532}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1148735784}
m_CullTransparentMesh: 0
--- !u!1 &1199742531
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1199742532}
- component: {fileID: 1199742534}
- component: {fileID: 1199742533}
m_Layer: 5
m_Name: ExpansionPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1199742532
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1199742531}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 304189374}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 300, y: 500}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1199742533
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1199742531}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7b7c8f92f79054eb6ae6e6749ebec2a1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!222 &1199742534
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1199742531}
m_CullTransparentMesh: 0
--- !u!1 &1333497001
GameObject:

11
Runtime/material/button_bar.cs.meta


fileFormatVersion: 2
guid: 2658772190aaa4fa79836ff61595171d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Runtime/material/flat_button.cs.meta


fileFormatVersion: 2
guid: ad54f63ca420e42518aead08e1b27526
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Runtime/material/ink_ripple.cs.meta


fileFormatVersion: 2
guid: 230d796f8dd4b408d9bf02bedfe642da
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Runtime/material/raised_button.cs.meta


fileFormatVersion: 2
guid: fe7aa5e2aef9349f3acc963fb45a1bed
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/MaterialSample.meta


fileFormatVersion: 2
guid: 611706478d8aa410983272ad601895d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Samples/MaterialSample/DividerButtonCanvas.cs.meta


fileFormatVersion: 2
guid: 7d02ebc8543484a84b26e073e5ec501f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存