用于顯示文字
Text(
"Text組件的使用",
style: TextStyle(
// 文字顏色
color: Color(0xfff0000),
// none 不顯示裝飾線條,underline 字體下方,overline 字體上方,lineThrough穿過文字
decoration: TextDecoration.none,
// solid 直線,double 雙下劃線,dotted 虛線,dashed 點(diǎn)下劃線,wavy 波浪線
decorationStyle: TextDecorationStyle.solid,
// 裝飾線的顏色
decorationColor: Colors.red,
// 文字大小
fontSize: 15.0,
// normal 正常,italic 斜體
fontStyle: FontStyle.normal,
// 字體的粗細(xì)
fontWeight: FontWeight.bold,
// 文字間的寬度
letterSpacing: 1.0,
// 文本行與行的高度,作為字體大小的倍數(shù)(取值1~2,如1.2)
height: 1,
//對齊文本的水平線:
//TextBaseline.alphabetic:文本基線是標(biāo)準(zhǔn)的字母基線
//TextBaseline.ideographic:文字基線是表意字基線;
//如果字符本身超出了alphabetic 基線,那么ideograhpic基線位置在字符本身的底部。
textBaseline: TextBaseline.alphabetic),
// 段落的間距樣式
strutStyle: StrutStyle(
fontFamily: 'serif',
fontFamilyFallback: ['monospace', 'serif'],
fontSize: 20,
height: 2,
leading: 2.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
forceStrutHeight: true,
debugLabel: 'text demo',
),
// 文字對齊方式
textAlign: TextAlign.center,
// 文字排列方向 ltr 左到右,rtl右到左
textDirection: TextDirection.ltr,
// 用于選擇區(qū)域特定字形的語言環(huán)境
locale: Locale('zh_CN'),
// 軟包裹 ,文字是否應(yīng)該在軟斷行出斷行
softWrap: false,
// 如何處理視覺溢出:clip 剪切溢出的文本以修復(fù)其容器。ellipsis 使用省略號表示文本已溢出。fade 將溢出的文本淡化為透明。
overflow: TextOverflow.clip,
// 文字的縮放比例
textScaleFactor: 1.0,
// 文本要跨越的可選最大行數(shù),
maxLines: 2,
// 圖像的語義描述,用于向Andoid上的TalkBack和iOS上的VoiceOver提供圖像描述
semanticsLabel: 'text demo',
textWidthBasis: TextWidthBasis.longestLine,
)