浏览代码

add test sample

/main
Xingwei Zhu 4 年前
当前提交
e471fa3f
共有 1 个文件被更改,包括 72 次插入0 次删除
  1. 72
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/MobileTouchSample.cs

72
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/MobileTouchSample.cs


using System;
using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using UnityEngine.Networking;
using Image = Unity.UIWidgets.widgets.Image;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample
{
public class MobileTouchSample : UIWidgetsPanel
{
protected override void main()
{
ui_.runApp(new MaterialApp(
title: "Http Request Sample",
home: new Scaffold(
body: new MobileTouchWidget()
)
));
}
}
public class MobileTouchWidget : StatefulWidget
{
public MobileTouchWidget(Key key = null) : base(key)
{
}
public override State createState()
{
return new MobileTouchWidgetState();
}
}
class MobileTouchWidgetState : State<MobileTouchWidget>
{
private float scale = 1;
private int frameNo = 0;
private float rotation = 0;
public override Widget build(BuildContext context)
{
return new Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: new List<Widget>()
{
new Text("Frame: " + frameNo),
new Text("Scale: " + scale),
new Text("Rotation: " + rotation),
new GestureDetector(
child: new Container(height: 300, color: Colors.blue),
onScaleStart: details => { },
onScaleUpdate: details =>
{
scale = details.scale;
rotation = details.rotation;
frameNo += 1;
setState(() => { });
},
onScaleEnd: details => { }
)
});
}
}
}
正在加载...
取消
保存