您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
72 行
2.1 KiB
72 行
2.1 KiB
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 => { }
|
|
)
|
|
});
|
|
}
|
|
}
|
|
}
|