fzhangtj
6 年前
当前提交
ded9350d
共有 19 个文件被更改,包括 911 次插入 和 560 次删除
-
26README.md
-
998Runtime/material/icons.cs
-
19Runtime/painting/text_style.cs
-
2Runtime/ui/painting/canvas_impl.cs
-
102Runtime/ui/painting/txt/font_manager.cs
-
2Runtime/ui/painting/txt/mesh_generator.cs
-
111Runtime/ui/text.cs
-
2Runtime/ui/txt/layout.cs
-
1Runtime/ui/txt/linebreaker.cs
-
9Runtime/ui/txt/paragraph.cs
-
2Samples/UIWidgetSample/MaterialSample.cs
-
9Samples/UIWidgetsGallery/GalleryMain.cs
-
6Tests/Editor/Widgets.cs
-
8Samples/UIWidgetSample/txt.meta
-
84Samples/UIWidgetSample/txt/FontWeightStyle.cs
-
11Samples/UIWidgetSample/txt/FontWeightStyle.cs.meta
-
68Samples/UIWidgetSample/txt/TextSpanGesture.cs
-
11Samples/UIWidgetSample/txt/TextSpanGesture.cs.meta
998
Runtime/material/icons.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 57dc3a2ca4c5643b482cd6c4e9e545d6 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using FontStyle = Unity.UIWidgets.ui.FontStyle; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample { |
|||
public class FontWeightStyle : UIWidgetsSamplePanel { |
|||
void Awake() { |
|||
// To run this sample, you need to download Roboto fonts and place them under Resources/Fonts folder
|
|||
// Roboto fonts could be downloaded from google website
|
|||
// https://fonts.google.com/specimen/Roboto?selection.family=Roboto
|
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons"); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Black"), "Roboto", |
|||
FontWeight.w900); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-BlackItalic"), "Roboto", |
|||
FontWeight.w900, FontStyle.italic); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Bold"), "Roboto", |
|||
FontWeight.bold); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-BoldItalic"), "Roboto", |
|||
FontWeight.bold, FontStyle.italic); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Regular"), "Roboto", |
|||
FontWeight.normal); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Italic"), "Roboto", |
|||
FontWeight.normal, FontStyle.italic); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Medium"), "Roboto", |
|||
FontWeight.w500); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-MediumItalic"), "Roboto", |
|||
FontWeight.w500, FontStyle.italic); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Light"), "Roboto", |
|||
FontWeight.w300); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-LightItalic"), "Roboto", |
|||
FontWeight.w300, FontStyle.italic); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-Thin"), "Roboto", |
|||
FontWeight.w100); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/Roboto-ThinItalic"), "Roboto", |
|||
FontWeight.w100, FontStyle.italic); |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
title: "Navigation Basics", |
|||
home: new FontWeightStyleWidget() |
|||
); |
|||
} |
|||
} |
|||
|
|||
class FontWeightStyleWidget : StatelessWidget { |
|||
public override Widget build(BuildContext context) { |
|||
var fontStyleTexts = new List<Widget> { |
|||
new Text("Thin", style: new TextStyle(fontWeight: FontWeight.w100)), |
|||
new Text("Thin Italic", style: new TextStyle(fontWeight: FontWeight.w100, |
|||
fontStyle: FontStyle.italic)), |
|||
new Text("Light", style: new TextStyle(fontWeight: FontWeight.w300)), |
|||
new Text("Light Italic", style: new TextStyle(fontWeight: FontWeight.w300, |
|||
fontStyle: FontStyle.italic)), |
|||
new Text("Regular", style: new TextStyle(fontWeight: FontWeight.normal)), |
|||
new Text("Regular Italic", style: new TextStyle(fontWeight: FontWeight.normal, |
|||
fontStyle: FontStyle.italic)), |
|||
new Text("Medium", style: new TextStyle(fontWeight: FontWeight.w500)), |
|||
new Text("Medium Italic", style: new TextStyle(fontWeight: FontWeight.w500, |
|||
fontStyle: FontStyle.italic)), |
|||
new Text("Bold", style: new TextStyle(fontWeight: FontWeight.bold)), |
|||
new Text("Bold Italic", style: new TextStyle(fontWeight: FontWeight.bold, |
|||
fontStyle: FontStyle.italic)), |
|||
new Text("Black", style: new TextStyle(fontWeight: FontWeight.w900)), |
|||
new Text("Black Italic", style: new TextStyle(fontWeight: FontWeight.w900, |
|||
fontStyle: FontStyle.italic)), |
|||
}; |
|||
return new Scaffold( |
|||
appBar: new AppBar( |
|||
title: new Text("Font weight & style") |
|||
), |
|||
body: new Card( |
|||
child: new DefaultTextStyle( |
|||
style: new TextStyle(fontSize: 40, fontFamily: "Roboto"), |
|||
child: new ListView(children: fontStyleTexts)) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b64f268a7786741718163d1a4eef0a8c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample { |
|||
public class TextSpanGesture : UIWidgetsSamplePanel { |
|||
protected override Widget createWidget() { |
|||
return new WidgetsApp( |
|||
home: new BuzzingText(), |
|||
pageRouteBuilder: this.pageRouteBuilder); |
|||
} |
|||
} |
|||
|
|||
class BuzzingText : StatefulWidget { |
|||
public override State createState() { |
|||
return new _BuzzingTextState(); |
|||
} |
|||
} |
|||
|
|||
class _BuzzingTextState : State<BuzzingText> { |
|||
LongPressGestureRecognizer _longPressRecognizer; |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._longPressRecognizer = new LongPressGestureRecognizer(); |
|||
this._longPressRecognizer.onLongPress = this._handlePress; |
|||
} |
|||
|
|||
public override void dispose() { |
|||
this._longPressRecognizer.dispose(); |
|||
base.dispose(); |
|||
} |
|||
|
|||
void _handlePress() { |
|||
Debug.Log("Long Pressed Text"); |
|||
} |
|||
/* |
|||
|
|||
Any professional looking app you have seen probably has multiple screens in it. It can contain a welcome screen, a login screen and then further screens. |
|||
*/ |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return 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._longPressRecognizer
|
|||
), |
|||
new TextSpan( |
|||
text: " secret?" |
|||
) |
|||
} |
|||
)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c91c5cfdde64e465e956815f92b78ae7 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue