Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 6c44bed

Browse files
committed
restore samples
1 parent 938569a commit 6c44bed

File tree

2 files changed

+10
-52
lines changed

2 files changed

+10
-52
lines changed

Samples/UIWidgetSample/MaterialSample.cs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Collections.Generic;
22
using RSG;
33
using Unity.UIWidgets.foundation;
4-
using Unity.UIWidgets.gestures;
54
using Unity.UIWidgets.material;
65
using Unity.UIWidgets.painting;
76
using Unity.UIWidgets.rendering;
@@ -171,21 +170,10 @@ public class MaterialAppBarWidgetState : State<MaterialAppBarWidget> {
171170
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();
172171

173172
VoidCallback _showBottomSheetCallback;
174-
175-
TapGestureRecognizer _tapRecognizer;
176-
HoverRecognizer _hoverRecognizer;
177173

178174
public override void initState() {
179175
base.initState();
180176
this._showBottomSheetCallback = this._showBottomSheet;
181-
182-
this._tapRecognizer = new TapGestureRecognizer();
183-
this._tapRecognizer.onTap = () => {
184-
Debug.Log("Tap");
185-
};
186-
this._hoverRecognizer = new HoverRecognizer();
187-
this._hoverRecognizer.OnPointerEnter = (evt) => { Debug.Log("Pointer Enter"); };
188-
this._hoverRecognizer.OnPointerLeave = () => { Debug.Log("Pointer Leave"); };
189177
}
190178

191179
void _showBottomSheet() {
@@ -224,25 +212,7 @@ public override Widget build(BuildContext context) {
224212
return new Scaffold(
225213
key: this._scaffoldKey,
226214
appBar: new AppBar(
227-
title: new RichText(
228-
text: new TextSpan(
229-
text: "Can you ",
230-
style: new TextStyle(color: Colors.black),
231-
children: new List<TextSpan>() {
232-
new TextSpan(
233-
text: "find the",
234-
style: new TextStyle(
235-
color: Colors.green,
236-
decoration: TextDecoration.underline
237-
),
238-
recognizer: this._tapRecognizer,
239-
hoverRecognizer: this._hoverRecognizer
240-
),
241-
new TextSpan(
242-
text: " secret?"
243-
)
244-
}
245-
)),
215+
title: new Text("Basic AppBar"),
246216
actions: new List<Widget> {
247217
new IconButton(
248218
icon: new Icon(Choice.choices[0].icon),
@@ -347,8 +317,7 @@ public override Widget build(BuildContext context) {
347317
children: new List<Widget> {
348318
new Icon(this.choice.icon, size: 128.0f, color: textStyle.color),
349319
new RaisedButton(
350-
//child: new Text(this.choice.title, style: textStyle),
351-
child: new Icon(Unity.UIWidgets.material.Icons.pool),
320+
child: new Text(this.choice.title, style: textStyle),
352321
onPressed: () => {
353322
SnackBar snackBar = new SnackBar(
354323
content: new Text(this.choice.title + " is chosen !"),

Samples/UIWidgetSample/txt/TextSpanGesture.cs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,21 @@ public override State createState() {
2323
}
2424

2525
class _BuzzingTextState : State<BuzzingText> {
26-
TapGestureRecognizer _tapRecognizer;
27-
HoverRecognizer _hoverRecognizer;
26+
LongPressGestureRecognizer _longPressRecognizer;
2827

2928
public override void initState() {
3029
base.initState();
31-
this._tapRecognizer = new TapGestureRecognizer();
32-
this._tapRecognizer.onTap = () => {
33-
Debug.Log("Tap");
34-
};
35-
this._hoverRecognizer = new HoverRecognizer();
36-
this._hoverRecognizer.OnPointerEnter = (evt) => { Debug.Log("Pointer Enter"); };
37-
this._hoverRecognizer.OnPointerLeave = () => { Debug.Log("Pointer Leave"); };
30+
this._longPressRecognizer = new LongPressGestureRecognizer();
31+
this._longPressRecognizer.onLongPress = this._handlePress;
3832
}
3933

4034
public override void dispose() {
41-
this._tapRecognizer.dispose();
35+
this._longPressRecognizer.dispose();
4236
base.dispose();
4337
}
4438

45-
void _handleEnter() {
46-
Debug.Log("Enter");
47-
}
48-
49-
void _handleLeave() {
50-
Debug.Log("Leave");
39+
void _handlePress() {
40+
Debug.Log("Long Pressed Text");
5141
}
5242
/*
5343
@@ -65,9 +55,8 @@ public override Widget build(BuildContext context) {
6555
style: new TextStyle(
6656
color: Colors.green,
6757
decoration: TextDecoration.underline
68-
),
69-
recognizer: this._tapRecognizer,
70-
hoverRecognizer: this._hoverRecognizer
58+
)
59+
//recognizer: this._longPressRecognizer
7160
),
7261
new TextSpan(
7362
text: " secret?"

0 commit comments

Comments
 (0)