forked from UnityTech/UIWidgets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextStyleSample.cs
More file actions
47 lines (42 loc) · 2.05 KB
/
TextStyleSample.cs
File metadata and controls
47 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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)})),
new Text("positive letter spacing", style: new TextStyle(fontSize: 14, letterSpacing:5)),
new Text("negative letter spacing", style: new TextStyle(fontSize: 14, letterSpacing:-1)),
new Text("positive word spacing test", style: new TextStyle(fontSize: 14, wordSpacing: 20f)),
new Text("negative word spacing test", style: new TextStyle(fontSize: 14, wordSpacing: -4f)),
};
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))
)
);
}
}
}