-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.dart
142 lines (132 loc) · 5.19 KB
/
main.dart
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:tipui/tipui.dart';
import 'package:tipui/TipColorText.dart';
import 'package:tipui/TipMarqueeWidget.dart';
import 'package:tipui/TipTextSwitch.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformVersion = await Tipui.platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
String text =
'我是普通文字<font color="#ff0000">我是红色字</font>又是积分积分普通字<font color="#00ff00">我是绿色字</font><font color="#0000ff">我是蓝色色字</font>';
List<String> runHouse = [
"<font color='#ffffff'>恭喜</font><font color='#fdcb32'>你总是盘旋在我</font><font color='#ffffff'>通过不懈的努力攻下</font><font color='#fdcb32'>腾讯科技(深圳)有限公司(科兴科学园)</font><font color='#ffffff'>,成为擂主</font>",
"<font color='#ffffff'>恭喜</font><font color='#fdcb32'>这些猫</font><font color='#ffffff'>通过不懈的努力攻下</font><font color='#fdcb32'>科兴科学园</font><font color='#ffffff'>,成为擂主</font>",
"<font color='#ffffff'>恭喜</font><font color='#fdcb32'>秋之凉</font><font color='#ffffff'>通过不懈的努力攻下</font><font color='#fdcb32'>科兴科学园</font><font color='#ffffff'>,成为擂主</font>",
"<font color='#ffffff'>恭喜</font><font color='#fdcb32'></font><font color='#ffffff'>通过不懈的努力攻下</font><font color='#fdcb32'>广东省</font><font color='#ffffff'>,成为擂主</font>",
"<font color='#ffffff'>恭喜</font><font color='#fdcb32'>这些猫</font><font color='#ffffff'>,拿下</font><font color='#fdcb32'>2344</font><font color='#ffffff'>高分</font>",
"<font color='#ffffff'>恭喜</font><font color='#fdcb32'></font><font color='#ffffff'>,拿下</font><font color='#fdcb32'>2405</font><font color='#ffffff'>高分</font>"
];
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('王者人生flutter控件demo'),
),
body: Padding(
padding: const EdgeInsets.all(18.0),
child: ListView(
children: <Widget>[
Card(
child: Center(child: Text("TipColorText 单行")),
),
Card(
child: Center(
child: TipColorText(
text,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
Card(
child: Center(child: Text("TipColorText 多行")),
),
Card(
child: Center(child: TipColorText(text)),
),
Container(
height: 2,
color: Colors.red,
),
Card(
child: Center(child: Text("TipMarqueeWidget")),
),
Card(
child: Container(
height: 20,
child: Center(
child: TipMarqueeWidget(
text: text,
)),
),
),
Container(
height: 2,
color: Colors.red,
),
Card(
child: Center(child: Text("TipSwitchText 单行")),
),
Card(
child: Container(
color: Colors.black45,
height: 20.0,
child: Center(
child: TipSwitchText(
runHouse,
scrollDirection: Axis.vertical,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
),
),
Card(
child: Center(child: Text("TipSwitchText 多行")),
),
Card(
child: Container(
color: Colors.black45,
height: 40.0,
child: Center(
child: TipSwitchText(
runHouse,
scrollDirection: Axis.vertical,
)),
),
),
],
),
),
),
);
}
}