GitHub
6 年前
当前提交
e05771c4
共有 17 个文件被更改,包括 245 次插入 和 117 次删除
-
37Runtime/painting/text_style.cs
-
2Runtime/ui/painting/canvas_impl.cs
-
63Runtime/ui/painting/txt/font_manager.cs
-
29Runtime/ui/painting/txt/mesh_generator.cs
-
23Runtime/ui/painting/txt/text_blob.cs
-
39Runtime/ui/text.cs
-
12Runtime/ui/txt/layout.cs
-
17Runtime/ui/txt/linebreaker.cs
-
2Runtime/ui/txt/paint_record.cs
-
51Runtime/ui/txt/paragraph.cs
-
12Runtime/ui/txt/paragraph_builder.cs
-
6Runtime/ui/txt/styled_runs.cs
-
2Runtime/ui/txt/word_separate.cs
-
2Runtime/ui/txt/wordbreaker.cs
-
11Tests/Editor/CanvasAndLayers.cs
-
43Samples/UIWidgetSample/txt/TextStyleSample.cs
-
11Samples/UIWidgetSample/txt/TextStyleSample.cs.meta
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class TextStyleSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
title: "Text Style", |
|||
home: new TextStyleSampleWidget() |
|||
); |
|||
} |
|||
} |
|||
|
|||
class TextStyleSampleWidget : StatelessWidget { |
|||
public override Widget build(BuildContext context) { |
|||
var fontStyleTexts = new List<Widget> { |
|||
new Text("text", style: new TextStyle(fontSize: 18)), |
|||
new Text("text with font size 0 below", style: new TextStyle(fontSize: 14)), |
|||
new Text("font size 0", style: new TextStyle(fontSize: 0)), |
|||
new Text("text with font size 0 above", style: new TextStyle(fontSize: 14)), |
|||
new Text("text with font size 0.3f", style: new TextStyle(fontSize: 0.3f)), |
|||
new Text("Text with background", style: new TextStyle(fontSize: 14, background: |
|||
new Paint(){color = new Color(0xFF00FF00)})), |
|||
|
|||
}; |
|||
return new Scaffold( |
|||
appBar: new AppBar( |
|||
title: new Text("Text Style") |
|||
), |
|||
body: new Card( |
|||
child: new DefaultTextStyle( |
|||
style: new TextStyle(fontSize: 40, fontFamily: "Roboto"), |
|||
child: new ListView(children: fontStyleTexts)) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1de691b215926469a959e54492262ff4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue