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

Commit 9395191

Browse files
committed
[Cupertino] Add Cupertino Sample
1 parent ea9d1a5 commit 9395191

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using Unity.UIWidgets.animation;
2+
using Unity.UIWidgets.cupertino;
3+
using Unity.UIWidgets.editor;
4+
using Unity.UIWidgets.foundation;
5+
using Unity.UIWidgets.painting;
6+
using Unity.UIWidgets.ui;
7+
using Unity.UIWidgets.widgets;
8+
using UnityEditor;
9+
using UnityEngine;
10+
using Rect = UnityEngine.Rect;
11+
12+
namespace UIWidgetsSample {
13+
public class CupertinoSample : UIWidgetsEditorWindow {
14+
[MenuItem("UIWidgetsTests/CupertinoSample")]
15+
public static void gallery() {
16+
GetWindow<CupertinoSample>();
17+
}
18+
19+
protected override void OnEnable() {
20+
FontManager.instance.addFont(Resources.Load<Font>("CupertinoIcons"), "CupertinoIcons");
21+
base.OnEnable();
22+
}
23+
24+
protected override Widget createWidget() {
25+
Debug.Log("[Cupertino Sample] Created");
26+
return new CupertinoSampleApp();
27+
}
28+
}
29+
30+
31+
public class CupertinoSampleApp : StatelessWidget {
32+
public override Widget build(BuildContext context) {
33+
return new CupertinoApp(
34+
theme: new CupertinoThemeData(
35+
textTheme: new CupertinoTextThemeData(
36+
navLargeTitleTextStyle: new TextStyle(
37+
fontWeight: FontWeight.bold,
38+
fontSize: 70f,
39+
color: CupertinoColors.activeBlue
40+
)
41+
)),
42+
home: new CupertinoSampleWidget()
43+
);
44+
}
45+
}
46+
47+
public class CupertinoSampleWidget : StatefulWidget {
48+
public CupertinoSampleWidget(Key key = null) : base(key) { }
49+
50+
public override State createState() {
51+
return new CupertinoSampleWidgetState();
52+
}
53+
}
54+
55+
public class CupertinoSampleWidgetState : State<CupertinoSampleWidget> {
56+
public override Widget build(BuildContext context) {
57+
return new CupertinoPageScaffold(
58+
child: new Center(
59+
child: new Text("Hello Cupertino",
60+
style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle
61+
)
62+
)
63+
);
64+
}
65+
}
66+
}

Samples/UIWidgetSample/Editor/CupertinoSampleWidget.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)