浏览代码

Code cleanup.

/main
Yuncong Zhang 5 年前
当前提交
daeedb3b
共有 1 个文件被更改,包括 26 次插入40 次删除
  1. 66
      Samples/UIWidgetSample/BenchMarkLayout.cs

66
Samples/UIWidgetSample/BenchMarkLayout.cs


using FontStyle = Unity.UIWidgets.ui.FontStyle;
using Material = Unity.UIWidgets.material.Material;
namespace UIWidgetsSample
{
public class BenchMarkLayout : UIWidgetsSamplePanel
{
protected override Widget createWidget()
{
namespace UIWidgetsSample {
public class BenchMarkLayout : UIWidgetsSamplePanel {
protected override Widget createWidget() {
builder: (_, child) =>
{
builder: (_, child) => {
context =>
{
context => {
return new MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 1.0f

});
}
protected override void OnEnable()
{
protected override void OnEnable() {
internal class BenchMarkLayoutWidget : StatefulWidget
{
public BenchMarkLayoutWidget(Key key = null) : base(key)
{
class BenchMarkLayoutWidget : StatefulWidget {
public BenchMarkLayoutWidget(Key key = null) : base(key) {
public override State createState()
{
public override State createState() {
internal class BenchMarkLayoutWidgetState : State<BenchMarkLayoutWidget>
{
private int width = 260;
private bool visible = true;
class BenchMarkLayoutWidgetState : State<BenchMarkLayoutWidget> {
int width = 260;
bool visible = true;
private Widget richtext = new Container(
Widget richtext = new Container(
new List<TextSpan>()
{
new List<TextSpan>() {
new TextSpan("Real-time 3D revolutioni\t淡粉色的方式地方\tzes the animation pipeline "),
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0)),
text: "for Disney Television Animation's\t “Baymax Dreams"),

)
);
public override Widget build(BuildContext context)
{
public override Widget build(BuildContext context) {
children: new List<Widget>
{
new Text($"Width: {width}"),
children: new List<Widget> {
new Text($"Width: {this.width}"),
onPressed: () => { setState(() => { width += 10; }); },
onPressed: () => { this.setState(() => { this.width += 10; }); },
onPressed: () => { setState(() => { width -= 10; }); },
onPressed: () => { this.setState(() => { this.width -= 10; }); },
onPressed: () => { setState(() => { visible = true; }); },
onPressed: () => { this.setState(() => { this.visible = true; }); },
onPressed: () => { setState(() => { visible = false; }); },
onPressed: () => { this.setState(() => { this.visible = false; }); },
children: new List<Widget>
{
visible ? richtext : new Text(""),
visible
children: new List<Widget> {
this.visible ? this.richtext : new Text(""),
this.visible
? new Text(
"Very Very Very Very Very Very Very Very Very Very Very Very Very Very\nVery Very Very Very Very Very Very Very Very Very Very Long Text",
maxLines: 3, overflow: TextOverflow.ellipsis, textAlign: TextAlign.justify

child = new Stack(
children: new List<Widget>{
children: new List<Widget> {
width: width,
width: this.width,
color: Colors.black12,
child: child
);

正在加载...
取消
保存