加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flutter基础—常用控件之文本

发布时间:2020-12-14 14:54:49 所属栏目:百科 来源:网络整理
导读:Text控件即容器,是一个常用的控件,下面的实例有7个不同样式的文本控件: import 'package:flutter/material.dart' ; class ContainerDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( appBar: new Ap

Text控件即容器,是一个常用的控件,下面的实例有7个不同样式的文本控件:

import 'package:flutter/material.dart';
class ContainerDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('文本控件'),),body: new Column(
        children: <Widget>[
          new Text(
            '红色+黑色删除线+25号',style: new TextStyle(
              color: const Color(0xffff0000),decoration: TextDecoration.lineThrough,decorationColor: const Color(0xff000000),fontSize: 25.0,new Text(
            '橙色+下划线+24号',style: new TextStyle(
              color: const Color(0xffff9900),decoration: TextDecoration.underline,fontSize: 24.0,new Text(
            '虚线上划线+23号+倾斜',style: new TextStyle(
              decoration: TextDecoration.overline,decorationStyle: TextDecorationStyle.dashed,fontSize: 23.0,fontStyle: FontStyle.italic,new Text(
            'serif字体+24号',style: new TextStyle(
              fontFamily: 'serif',fontSize: 26.0,new Text(
            'monospace字体+24号+加粗',style: new TextStyle(
              fontFamily: 'monospace',fontWeight: FontWeight.bold,new Text(
            '天蓝色+25号+2行跨度',style: new TextStyle(
              color: const Color(0xff4a86e8),height: 2.0,new Text(
            '24号+2个字母间隔',style: new TextStyle(
              fontSize: 24.0,letterSpacing: 2.0,]
      ),);
  }
}
void main() {
  runApp(
    new MaterialApp(
      title: 'Flutter教程',home: new ContainerDemo(),);
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读