浏览代码

custom font weight & custom font interface change

/main
fzhangtj 6 年前
当前提交
ded9350d
共有 19 个文件被更改,包括 911 次插入560 次删除
  1. 26
      README.md
  2. 998
      Runtime/material/icons.cs
  3. 19
      Runtime/painting/text_style.cs
  4. 2
      Runtime/ui/painting/canvas_impl.cs
  5. 102
      Runtime/ui/painting/txt/font_manager.cs
  6. 2
      Runtime/ui/painting/txt/mesh_generator.cs
  7. 111
      Runtime/ui/text.cs
  8. 2
      Runtime/ui/txt/layout.cs
  9. 1
      Runtime/ui/txt/linebreaker.cs
  10. 9
      Runtime/ui/txt/paragraph.cs
  11. 2
      Samples/UIWidgetSample/MaterialSample.cs
  12. 9
      Samples/UIWidgetsGallery/GalleryMain.cs
  13. 6
      Tests/Editor/Widgets.cs
  14. 8
      Samples/UIWidgetSample/txt.meta
  15. 84
      Samples/UIWidgetSample/txt/FontWeightStyle.cs
  16. 11
      Samples/UIWidgetSample/txt/FontWeightStyle.cs.meta
  17. 68
      Samples/UIWidgetSample/txt/TextSpanGesture.cs
  18. 11
      Samples/UIWidgetSample/txt/TextSpanGesture.cs.meta

26
README.md


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using FontStyle = Unity.UIWidgets.ui.FontStyle;
protected override void OnEnable() {
base.OnEnable();
void Awake() {
// if you want to use your own font or font icons.
// use the asset name of font (file name without extension) in FontStyle.fontFamily.
// FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font"));
// if you want to use your own font or font icons.
// FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font"), "font family name");
// load custom font with weight & style. The font weight & style corresponds to fontWeight, fontStyle of
// a TextStyle object
// FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font"), "Roboto", FontWeight.w500,
// FontStyle.italic);
// add material icons, familyName must be "Material Icons"
// FontManager.instance.addFont(Resources.Load<Font>(path: "path to material icons"), "Material Icons");
}
protected override Widget createWidget() {

you can refer to Flutter Wiki to access detailed descriptions of UIWidgets APIs
from those of their Flutter counterparts.
#### NOTES
##### Using Material Icons
To use material Icons, you need to add font MaterialIcons-Regular.ttf into your project and add it into
```FontManager``` as the sample code shows. The file name must be MaterialIcons-Regular.ttf, otherwise the icons
could not shown
#### FAQ

998
Runtime/material/icons.cs
文件差异内容过多而无法显示
查看文件

19
Runtime/painting/text_style.cs


public readonly bool inherit;
public readonly Color color;
public readonly float? fontSize;
public readonly FontWeight? fontWeight;
public readonly FontWeight fontWeight;
public readonly FontStyle? fontStyle;
public readonly float? letterSpacing;
public readonly float? wordSpacing;

public TextStyle(bool inherit = true, Color color = null, float? fontSize = null,
FontWeight? fontWeight = null,
FontWeight fontWeight = null,
FontStyle? fontStyle = null, float? letterSpacing = null, float? wordSpacing = null,
TextBaseline? textBaseline = null, float? height = null, Paint background = null,
TextDecoration decoration = null,

public TextStyle copyWith(Color color = null,
string fontFamily = null,
float? fontSize = null,
FontWeight? fontWeight = null,
FontWeight fontWeight = null,
FontStyle? fontStyle = null,
float? letterSpacing = null,
float? wordSpacing = null,

defaultValue: Diagnostics.kNullDefaultValue));
string weightDescription = "";
if (this.fontWeight != null) {
switch (this.fontWeight) {
case FontWeight.w400:
weightDescription = "400";
break;
case FontWeight.w700:
weightDescription = "700";
break;
}
weightDescription = this.fontWeight.weightValue.ToString();
styles.Add(new DiagnosticsProperty<FontWeight?>(
styles.Add(new DiagnosticsProperty<FontWeight>(
"weight", this.fontWeight,
description: weightDescription,
defaultValue: Diagnostics.kNullDefaultValue

var hashCode = this.inherit.GetHashCode();
hashCode = (hashCode * 397) ^ (this.color != null ? this.color.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.fontSize.GetHashCode();
hashCode = (hashCode * 397) ^ this.fontWeight.GetHashCode();
hashCode = (hashCode * 397) ^ (this.fontWeight != null ? this.fontWeight.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.fontStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.letterSpacing.GetHashCode();
hashCode = (hashCode * 397) ^ this.wordSpacing.GetHashCode();

2
Runtime/ui/painting/canvas_impl.cs


var mesh = new TextBlobMesh(textBlob, scale, matrix);
// request font texture so text mesh could be generated correctly
var font = FontManager.instance.getOrCreate(textBlob.style.fontFamily).font;
var font = FontManager.instance.getOrCreate(textBlob.style.fontFamily, style.fontWeight, style.fontStyle).font;
var fontSizeToLoad = Mathf.CeilToInt(style.UnityFontSize * scale);
var subText = textBlob.text.Substring(textBlob.textOffset, textBlob.textSize);
font.RequestCharactersInTexture(subText, fontSizeToLoad, style.UnityFontStyle);

102
Runtime/ui/painting/txt/font_manager.cs


using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using UnityEngine;

}
}
class FontRef : IEquatable<FontRef> {
public readonly string familyName;
public readonly FontWeight fontWeight;
public readonly FontStyle fontStyle;
public FontRef(string familyName, FontWeight fontWeight, FontStyle fontStyle) {
this.familyName = familyName;
this.fontWeight = fontWeight;
this.fontStyle = fontStyle;
}
public bool Equals(FontRef other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return string.Equals(this.familyName, other.familyName) && this.fontWeight == other.fontWeight && this.fontStyle == other.fontStyle;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((FontRef) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (this.familyName != null ? this.familyName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.fontWeight != null ? this.fontWeight.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (int) this.fontStyle;
return hashCode;
}
}
public static bool operator ==(FontRef left, FontRef right) {
return Equals(left, right);
}
public static bool operator !=(FontRef left, FontRef right) {
return !Equals(left, right);
}
public override string ToString() {
return $"{nameof(this.familyName)}: {this.familyName}, {nameof(this.fontWeight)}: {this.fontWeight}, {nameof(this.fontStyle)}: {this.fontStyle}";
}
}
readonly Dictionary<string, FontInfo> _fonts = new Dictionary<string, FontInfo>();
readonly Dictionary<FontRef, FontInfo> _fonts = new Dictionary<FontRef, FontInfo>();
static readonly int defaultFontSize = 14;

Font.textureRebuilt += this.onFontTextureRebuilt;
}
public void addFont(Font font) {
public void addFont(Font font, string familyName,
FontWeight fontWeight = null, FontStyle fontStyle = FontStyle.normal) {
if (fontWeight == null) {
fontWeight = FontWeight.normal;
}
FontRef fontRef = new FontRef(familyName, fontWeight, fontStyle);
D.assert(font != null);
D.assert(font.dynamic, $"adding font which is not dynamic is not allowed {font.name}");
font.hideFlags = HideFlags.DontSave & ~HideFlags.DontSaveInBuild;

this._fonts.TryGetValue(name, out current);
D.assert(current == null || current.font == font, $"font with name {name} already exists");
this._fonts.TryGetValue(fontRef, out current);
D.assert(current == null || current.font == font, $"font with key {fontRef} already exists");
this._fonts[name] = fontInfo;
this._fonts[fontRef] = fontInfo;
internal FontInfo getOrCreate(string name) {
if (this._fonts.TryGetValue(name, out var fontInfo)) {
D.assert(fontInfo.font.name == name);
internal FontInfo getOrCreate(string familyName, FontWeight fontWeight, FontStyle fontStyle) {
if (fontWeight == null) {
fontWeight = FontWeight.normal;
}
FontRef fontRef = new FontRef(familyName, fontWeight, fontStyle);
if (this._fonts.TryGetValue(fontRef, out var fontInfo)) {
var osFont = Font.CreateDynamicFontFromOSFont(name, defaultFontSize);
// fallback to normal weight & style
if (fontWeight != FontWeight.normal || fontStyle != FontStyle.normal) {
fontInfo = this.getOrCreate(familyName, FontWeight.normal, FontStyle.normal);
if (fontInfo != null) {
return fontInfo;
}
}
var osFont = Font.CreateDynamicFontFromOSFont(familyName, defaultFontSize);
this._fonts[osFont.name] = newFont;
fontRef = new FontRef(familyName, fontWeight, fontStyle);
this._fonts[fontRef] = newFont;
return newFont;
}

2
Runtime/ui/painting/txt/mesh_generator.cs


this._resolved = true;
var style = this._textBlob.style;
var fontInfo = FontManager.instance.getOrCreate(style.fontFamily);
var fontInfo = FontManager.instance.getOrCreate(style.fontFamily, style.fontWeight, style.fontStyle);
var key = new MeshKey(this._textBlob.instanceId, this._scale);
_meshes.TryGetValue(key, out var meshInfo);

111
Runtime/ui/text.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.ui {
public enum FontStyle {

internal UnityEngine.FontStyle UnityFontStyle {
get {
bool isBold = this.fontWeight == FontWeight.bold;
if (this.fontWeight == FontWeight.w700) {
if (isBold) {
return UnityEngine.FontStyle.BoldAndItalic;
}
else {

else if (this.fontWeight == FontWeight.w700) {
else if (isBold) {
return UnityEngine.FontStyle.Bold;
}

unchecked {
var hashCode = (this.color != null ? this.color.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.fontSize.GetHashCode();
hashCode = (hashCode * 397) ^ this.fontWeight.GetHashCode();
hashCode = (hashCode * 397) ^ (this.fontWeight != null ? this.fontWeight.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.fontStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.letterSpacing.GetHashCode();
hashCode = (hashCode * 397) ^ this.wordSpacing.GetHashCode();

public TextStyle(Color color = null, float? fontSize = null,
FontWeight? fontWeight = null, FontStyle? fontStyle = null, float? letterSpacing = null,
FontWeight fontWeight = null, FontStyle? fontStyle = null, float? letterSpacing = null,
float? wordSpacing = null, TextBaseline? textBaseline = null, float? height = null,
TextDecoration decoration = null, TextDecorationStyle? decorationStyle = null, Color decorationColor = null,
string fontFamily = null,

public class ParagraphStyle : IEquatable<ParagraphStyle> {
public ParagraphStyle(TextAlign? textAlign = null,
TextDirection? textDirection = null,
FontWeight? fontWeight = null,
FontWeight fontWeight = null,
FontStyle? fontStyle = null,
int? maxLines = null,
float? fontSize = null,

unchecked {
var hashCode = this.textAlign.GetHashCode();
hashCode = (hashCode * 397) ^ this.textDirection.GetHashCode();
hashCode = (hashCode * 397) ^ this.fontWeight.GetHashCode();
hashCode = (hashCode * 397) ^ (this.fontWeight != null ? this.fontWeight.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.fontStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.maxLines.GetHashCode();
hashCode = (hashCode * 397) ^ this.fontSize.GetHashCode();

public readonly TextAlign? textAlign;
public readonly TextDirection? textDirection;
public readonly FontWeight? fontWeight;
public readonly FontWeight fontWeight;
public readonly FontStyle? fontStyle;
public readonly int? maxLines;
public readonly float? fontSize;

downstream,
}
public enum FontWeight {
w400, // normal
w700, // bold
public class FontWeight: IEquatable<FontWeight> {
private FontWeight(int index) {
this.index = index;
}
public readonly int index;
public static readonly FontWeight w100 = new FontWeight(0);
public static readonly FontWeight w200 = new FontWeight(1);
public static readonly FontWeight w300 = new FontWeight(2);
public static readonly FontWeight w400 = new FontWeight(3);
public static readonly FontWeight w500 = new FontWeight(4);
public static readonly FontWeight w600 = new FontWeight(5);
public static readonly FontWeight w700 = new FontWeight(6);
public static readonly FontWeight w800 = new FontWeight(7);
public static readonly FontWeight w900 = new FontWeight(8);
public static readonly FontWeight normal = w400;
public static readonly FontWeight bold = w700;
public static readonly List<FontWeight> values = new List<FontWeight>{
w100, w200, w300, w400, w500, w600, w700, w800, w900
};
public static readonly Dictionary<int, int> indexToFontWeight = new Dictionary<int, int> {
{0, 100},
{1, 200},
{2, 300},
{3, 400},
{4, 500},
{5, 600},
{6, 700},
{7, 800},
{8, 900},
};
public bool Equals(FontWeight other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return this.index == other.index;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((FontWeight) obj);
}
public override int GetHashCode() {
return this.index;
}
public static bool operator ==(FontWeight left, FontWeight right) {
return Equals(left, right);
}
public static bool operator !=(FontWeight left, FontWeight right) {
return !Equals(left, right);
}
public override string ToString() {
return $"FontWeight.w{this.weightValue}";
}
public int weightValue {
get {
return indexToFontWeight[this.index];
}
}
public class TextPosition : IEquatable<TextPosition> {
public readonly int offset;

2
Runtime/ui/txt/layout.cs


this._advances.Clear();
this._positions.Clear();
this._count = count;
var font = FontManager.instance.getOrCreate(style.fontFamily).font;
var font = FontManager.instance.getOrCreate(style.fontFamily, style.fontWeight, style.fontStyle).font;
font.RequestCharactersInTexture(this._text.Substring(start, count),
style.UnityFontSize,
style.UnityFontStyle);

1
Runtime/ui/txt/linebreaker.cs


this._charWidths, start, this._tabStops);
}
var font = FontManager.instance.getOrCreate(style.fontFamily).font;
int current = this._wordBreaker.current();
int afterWord = start;
int lastBreak = start;

9
Runtime/ui/txt/paragraph.cs


}
var textStyle = this._paragraphStyle.getTextStyle();
this._tabStops.setFont(FontManager.instance.getOrCreate(textStyle.fontFamily).font,
this._tabStops.setFont(FontManager.instance.getOrCreate(textStyle.fontFamily,
textStyle.fontWeight, textStyle.fontStyle).font,
textStyle.UnityFontSize);
this._needsLayout = false;

continue;
}
var font = FontManager.instance.getOrCreate(run.style.fontFamily).font;
var font = FontManager.instance.getOrCreate(run.style.fontFamily,
run.style.fontWeight, run.style.fontStyle).font;
var metrics = FontMetrics.fromFont(font, run.style.UnityFontSize);
paintRecords.Add(new PaintRecord(run.style, new Offset(runXOffset, 0),
builder.make(), metrics, lineNumber, layout.getAdvance()

if (paintRecords.Count == 0) {
var defaultStyle = this._paragraphStyle.getTextStyle();
var defaultFont = FontManager.instance.getOrCreate(defaultStyle.fontFamily).font;
var defaultFont = FontManager.instance.getOrCreate(defaultStyle.fontFamily,
defaultStyle.fontWeight, defaultStyle.fontStyle).font;
var metrics = FontMetrics.fromFont(defaultFont, defaultStyle.UnityFontSize);
updateLineMetrics(metrics, defaultStyle);
}

2
Samples/UIWidgetSample/MaterialSample.cs


protected override void OnEnable() {
base.OnEnable();
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"));
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons");
}
}

9
Samples/UIWidgetsGallery/GalleryMain.cs


protected override Widget createWidget() {
return new GalleryApp();
}
protected override void OnEnable() {
base.OnEnable();
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"));
FontManager.instance.addFont(Resources.Load<Font>("GalleryIcons"));
void Awake() {
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"), "Material Icons");
FontManager.instance.addFont(Resources.Load<Font>("GalleryIcons"), "GalleryIcons");
}
}
}

6
Tests/Editor/Widgets.cs


this.windowAdapter.Update();
}
void Awake() {
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"), "Material Icons");
}
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"));
}
void OnDisable() {

8
Samples/UIWidgetSample/txt.meta


fileFormatVersion: 2
guid: 57dc3a2ca4c5643b482cd6c4e9e545d6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

84
Samples/UIWidgetSample/txt/FontWeightStyle.cs


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))
)
);
}
}
}

11
Samples/UIWidgetSample/txt/FontWeightStyle.cs.meta


fileFormatVersion: 2
guid: b64f268a7786741718163d1a4eef0a8c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

68
Samples/UIWidgetSample/txt/TextSpanGesture.cs


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?"
)
}
));
}
}
}

11
Samples/UIWidgetSample/txt/TextSpanGesture.cs.meta


fileFormatVersion: 2
guid: c91c5cfdde64e465e956815f92b78ae7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存