flutter 系统组件学习一 Text组件

前言

开发中最常用的组件就是text组件,对应ios里面的就是UILabel控件了

使用方法

Text(
              'You have pushed the button this many ave pushed the button this manyave pushed the button this manyave pushed the button this manyave pushed the button this manytimes:',
              textAlign: TextAlign.end,
              textDirection: TextDirection.ltr,
              maxLines:2,
              softWrap: true,                  
              overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
              style: TextStyle(
                // color: Colors.red,
                // backgroundColor: Colors.blue,
                fontSize: 30.0,
                fontWeight: FontWeight.w900,
                fontStyle: FontStyle.italic,
                letterSpacing: 2, // 字母间距
                wordSpacing: 4,   // 单词间距
                height:2, // 行间距倍数
                foreground: Paint()..color = Colors.blue,
                decoration:TextDecoration.combine(
                  [TextDecoration.underline,
                  TextDecoration.overline,
                  TextDecoration.lineThrough]
                ),
                decorationColor:Colors.red,
                decorationStyle: TextDecorationStyle.dotted,
                decorationThickness:1.0, 
              ),
            ),

运行的效果如下:


屏幕快照 2020-01-06 下午4.18.46.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容