浏览代码

restore samples

/main
xingwei.zhu 6 年前
当前提交
f6b691b7
共有 2 个文件被更改,包括 10 次插入52 次删除
  1. 35
      Samples/UIWidgetSample/MaterialSample.cs
  2. 27
      Samples/UIWidgetSample/txt/TextSpanGesture.cs

35
Samples/UIWidgetSample/MaterialSample.cs


using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();
VoidCallback _showBottomSheetCallback;
TapGestureRecognizer _tapRecognizer;
HoverRecognizer _hoverRecognizer;
this._tapRecognizer = new TapGestureRecognizer();
this._tapRecognizer.onTap = () => {
Debug.Log("Tap");
};
this._hoverRecognizer = new HoverRecognizer();
this._hoverRecognizer.OnPointerEnter = (evt) => { Debug.Log("Pointer Enter"); };
this._hoverRecognizer.OnPointerLeave = () => { Debug.Log("Pointer Leave"); };
}
void _showBottomSheet() {

return new Scaffold(
key: this._scaffoldKey,
appBar: new AppBar(
title: new RichText(
text: new TextSpan(
text: "Can you ",
style: new TextStyle(color: Colors.black),
children: new List<TextSpan>() {
new TextSpan(
text: "find the",
style: new TextStyle(
color: Colors.green,
decoration: TextDecoration.underline
),
recognizer: this._tapRecognizer,
hoverRecognizer: this._hoverRecognizer
),
new TextSpan(
text: " secret?"
)
}
)),
title: new Text("Basic AppBar"),
actions: new List<Widget> {
new IconButton(
icon: new Icon(Choice.choices[0].icon),

children: new List<Widget> {
new Icon(this.choice.icon, size: 128.0f, color: textStyle.color),
new RaisedButton(
//child: new Text(this.choice.title, style: textStyle),
child: new Icon(Unity.UIWidgets.material.Icons.pool),
child: new Text(this.choice.title, style: textStyle),
onPressed: () => {
SnackBar snackBar = new SnackBar(
content: new Text(this.choice.title + " is chosen !"),

27
Samples/UIWidgetSample/txt/TextSpanGesture.cs


}
class _BuzzingTextState : State<BuzzingText> {
TapGestureRecognizer _tapRecognizer;
HoverRecognizer _hoverRecognizer;
LongPressGestureRecognizer _longPressRecognizer;
this._tapRecognizer = new TapGestureRecognizer();
this._tapRecognizer.onTap = () => {
Debug.Log("Tap");
};
this._hoverRecognizer = new HoverRecognizer();
this._hoverRecognizer.OnPointerEnter = (evt) => { Debug.Log("Pointer Enter"); };
this._hoverRecognizer.OnPointerLeave = () => { Debug.Log("Pointer Leave"); };
this._longPressRecognizer = new LongPressGestureRecognizer();
this._longPressRecognizer.onLongPress = this._handlePress;
this._tapRecognizer.dispose();
this._longPressRecognizer.dispose();
void _handleEnter() {
Debug.Log("Enter");
}
void _handleLeave() {
Debug.Log("Leave");
void _handlePress() {
Debug.Log("Long Pressed Text");
}
/*

style: new TextStyle(
color: Colors.green,
decoration: TextDecoration.underline
),
recognizer: this._tapRecognizer,
hoverRecognizer: this._hoverRecognizer
)
//recognizer: this._longPressRecognizer
),
new TextSpan(
text: " secret?"

正在加载...
取消
保存