浏览代码

Merge branch 'material' into 'master'

sliversafearea

See merge request upm-packages/ui-widgets/com.unity.uiwidgets!96
/main
Shenhua Gu 6 年前
当前提交
b9c5f145
共有 7 个文件被更改,包括 99 次插入13 次删除
  1. 6
      Runtime/material/ink_ripple.cs
  2. 8
      Runtime/material/ink_splash.cs
  3. 60
      Runtime/widgets/safe_area.cs
  4. 5
      Samples/UIWidgetSample/MaterialSample.cs
  5. 11
      Runtime/material/app.cs.meta
  6. 11
      Runtime/material/page.cs.meta
  7. 11
      Runtime/material/page_transitions_theme.cs.meta

6
Runtime/material/ink_ripple.cs


}
}
//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);
}
canvas.drawCircle(center, this._radius.value, paint);
canvas.restore();
}
}

8
Runtime/material/ink_splash.cs


canvas.clipRect(rect);
}
}
//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);
}
canvas.drawCircle(center, this._radius.value, paint);
canvas.restore();
}
}

60
Runtime/widgets/safe_area.cs


using UnityEngine;
using UnityEngine;
namespace Unity.UIWidgets.widgets {
public class SafeArea : StatelessWidget {

child: this.child));
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FlagProperty("left", value: this.left, ifTrue: "avoid left padding"));
properties.add(new FlagProperty("top", value: this.top, ifTrue: "avoid top padding"));
properties.add(new FlagProperty("right", value: this.right, ifTrue: "avoid right padding"));
properties.add(new FlagProperty("bottom", value: this.bottom, ifTrue: "avoid bottom padding"));
}
}
class SliverSafeArea : StatelessWidget {
public SliverSafeArea(
Key key = null,
bool left = true,
bool top = true,
bool right = true,
bool bottom = true,
EdgeInsets minimum = null,
Widget sliver = null) : base(key: key) {
D.assert(sliver != null);
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
this.minimum = minimum ?? EdgeInsets.zero;
this.sliver = sliver;
}
public readonly bool left;
public readonly bool top;
public readonly bool right;
public readonly bool bottom;
public readonly EdgeInsets minimum;
public readonly Widget sliver;
public override Widget build(BuildContext context) {
EdgeInsets padding = MediaQuery.of(context).padding;
return new SliverPadding(
padding: EdgeInsets.only(
left: Mathf.Max(this.left ? padding.left : 0.0f, this.minimum.left),
top: Mathf.Max(this.top ? padding.top : 0.0f, this.minimum.top),
right: Mathf.Max(this.right ? padding.right : 0.0f, this.minimum.right),
bottom: Mathf.Max(this.bottom ? padding.bottom : 0.0f, this.minimum.bottom)
),
sliver: MediaQuery.removePadding(
context: context,
removeLeft: this.left,
removeTop: this.top,
removeRight: this.right,
removeBottom: this.bottom,
child: this.sliver));
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

5
Samples/UIWidgetSample/MaterialSample.cs


public override Widget build(BuildContext context) {
return new Material(
child: new Center(
child: new MaterialButton(
child: new FlatButton(
shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(20.0f)),
color: new Color(0xFF00FF00),
child: new Text("Click Me"),
onPressed: () => { Debug.Log("pressed here"); }
)
)

11
Runtime/material/app.cs.meta


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

11
Runtime/material/page.cs.meta


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

11
Runtime/material/page_transitions_theme.cs.meta


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