Flutter ~ Text 同时添加中划线和下划线

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import 'package:flutter/material.dart';

void main() {
runApp(
MaterialApp(title: 'Text Demo', home: ContainerDemo()),
);
}

class ContainerDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('文本组件'),
),
body: Center(
child: Column(
children: <Widget>[
Text(
"Hello world!",
style: TextStyle(
color: Colors.green,
fontSize: 23.0,
decoration: TextDecoration.combine(
[TextDecoration.underline, TextDecoration.lineThrough]),
),
),
const Text(
'红色+黑色删除线+25号',
style: TextStyle(
color: Color(0xffff0000),
decoration: TextDecoration.lineThrough,
decorationColor: Color(0xff000000),
fontSize: 25.0,
),
),
const Text(
'橙色+下划线+24号',
style: TextStyle(
color: Color(0xffff9900),
decoration: TextDecoration.underline,
fontSize: 24.0,
),
),
const Text(
'虚线上划线+23号+倾斜',
style: TextStyle(
decoration: TextDecoration.overline,
decorationStyle: TextDecorationStyle.dashed,
fontSize: 23.0,
fontStyle: FontStyle.italic,
),
),
const Text(
'24号+加粗',
style: TextStyle(
fontSize: 23.0,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
letterSpacing: 6.0,
),
),
],
),
),
);
}
}
打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2012-2022 Soto Pu

请我喝杯咖啡吧~

支付宝
微信