Flutter入门之Text控件的使用(一)

Text控件的使用

import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      title: "TextDemo",
      home: TextDemo(),
    ),
  );
}

class TextDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Text文本控件'),
      ),
      body: Column(
        children: <Widget>[
          Text(
            "红色+23号字+加粗",
            style: TextStyle(
              color: Colors.orange,
              fontWeight: FontWeight.bold,
              letterSpacing: 6,
              fontSize: 23,
            ),
          ),
          Text(
            "绿色+底部实线+24号字体",
            style: TextStyle(
              color: Colors.green,
              decoration: TextDecoration.underline,
              fontSize: 24,
            ),
          ),
          Text(
            "顶部虚线上划线+25号字+倾斜字",
            style: TextStyle(
              decoration: TextDecoration.overline,
              decorationStyle: TextDecorationStyle.dashed,
              fontStyle: FontStyle.italic,
              fontSize: 25,
            ),
          ),
          Text(
            "蓝色+红色的删除线+27号字体",
            style: TextStyle(
              color: Colors.blue,
              decoration: TextDecoration.lineThrough,
              decorationColor: Colors.red,
              fontSize: 27,
            ),
          ),
        ],
      ),
    );
  }
}

运行结果:

Flutter入门之Text控件的使用(一)_第1张图片
Text类详情 请访问https://api.flutter.dev/flutter/widgets/Text-class.html

请帮顶 / 评论点赞!你们的鼓励是我写作的最大动力!

你可能感兴趣的:(Flutter入门学习,Flutter入门学习)