浏览代码

[Cupertino] Add Cupertino Sample

/main
iizzaya 5 年前
当前提交
ece133b2
共有 2 个文件被更改,包括 69 次插入0 次删除
  1. 66
      Samples/UIWidgetSample/Editor/CupertinoSampleWidget.cs
  2. 3
      Samples/UIWidgetSample/Editor/CupertinoSampleWidget.cs.meta

66
Samples/UIWidgetSample/Editor/CupertinoSampleWidget.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEditor;
using UnityEngine;
using Rect = UnityEngine.Rect;
namespace UIWidgetsSample {
public class CupertinoSample : UIWidgetsEditorWindow {
[MenuItem("UIWidgetsTests/CupertinoSample")]
public static void gallery() {
GetWindow<CupertinoSample>();
}
protected override void OnEnable() {
FontManager.instance.addFont(Resources.Load<Font>("CupertinoIcons"), "CupertinoIcons");
base.OnEnable();
}
protected override Widget createWidget() {
Debug.Log("[Cupertino Sample] Created");
return new CupertinoSampleApp();
}
}
public class CupertinoSampleApp : StatelessWidget {
public override Widget build(BuildContext context) {
return new CupertinoApp(
theme: new CupertinoThemeData(
textTheme: new CupertinoTextThemeData(
navLargeTitleTextStyle: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 70f,
color: CupertinoColors.activeBlue
)
)),
home: new CupertinoSampleWidget()
);
}
}
public class CupertinoSampleWidget : StatefulWidget {
public CupertinoSampleWidget(Key key = null) : base(key) { }
public override State createState() {
return new CupertinoSampleWidgetState();
}
}
public class CupertinoSampleWidgetState : State<CupertinoSampleWidget> {
public override Widget build(BuildContext context) {
return new CupertinoPageScaffold(
child: new Center(
child: new Text("Hello Cupertino",
style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle
)
)
);
}
}
}

3
Samples/UIWidgetSample/Editor/CupertinoSampleWidget.cs.meta


fileFormatVersion: 2
guid: 92aa3442134248a38d03c2a24a8a9962
timeCreated: 1566545424
正在加载...
取消
保存