about_page.dart
3.12 KB
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
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:Parlando/res/resources.dart';
import 'package:Parlando/routers/fluro_navigator.dart';
import 'package:Parlando/util/device_utils.dart';
import 'package:Parlando/util/other_utils.dart';
import 'package:Parlando/util/toast_utils.dart';
import 'package:Parlando/widgets/click_item.dart';
import 'package:Parlando/widgets/my_app_bar.dart';
import 'package:Parlando/extension/int_extension.dart';
class AboutPage extends StatefulWidget {
const AboutPage({Key? key}) : super(key: key);
@override
_AboutPageState createState() => _AboutPageState();
}
class _AboutPageState extends State<AboutPage> {
final List<FlutterLogoStyle> _styles = <FlutterLogoStyle>[
FlutterLogoStyle.stacked,
FlutterLogoStyle.markOnly,
FlutterLogoStyle.horizontal
];
final List<Cubic> _curves = <Cubic>[
Curves.ease,
Curves.easeIn,
Curves.easeInOutCubic,
Curves.easeInOut,
Curves.easeInQuad,
Curves.easeInCirc,
Curves.easeInBack,
Curves.easeInOutExpo,
Curves.easeInToLinear,
Curves.easeOutExpo,
Curves.easeInOutSine,
Curves.easeOutSine,
];
// 取随机颜色
Color _randomColor() {
final int red = Random.secure().nextInt(255);
final int greed = Random.secure().nextInt(255);
final int blue = Random.secure().nextInt(255);
return Color.fromARGB(255, red, greed, blue);
}
Timer? _countdownTimer;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
// 2s定时器
_countdownTimer = Timer.periodic(const Duration(seconds: 2), (_) {
// https://www.jianshu.com/p/e4106b829bff
if (!mounted) {
return;
}
setState(() {});
});
});
}
@override
void dispose() {
_countdownTimer?.cancel();
_countdownTimer = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
homeMenuHeader: Container(
alignment: Alignment.center,
width: double.infinity,
child: const Text(
"关于我们",
style: TextStyle(
color: Colors.white,
),
),
),
),
body: Column(
children: <Widget>[
Gaps.vGap50,
FlutterLogo(
size: 100.px,
textColor: _randomColor(),
style: _styles[Random.secure().nextInt(3)],
curve: _curves[Random.secure().nextInt(12)],
),
Gaps.vGap10,
ClickItem(
title: '项目官网',
onTap: () => _launchWebURL('项目官网', 'http://www.mofunsky.com/'),
),
Gaps.vGap10,
ClickItem(
title: '自我介绍',
onTap: () {
Toast.show('我们是一首很有诗意的APP~');
},
),
],
),
);
}
void _launchWebURL(String title, String url) {
if (Device.isMobile) {
NavigatorUtils.goWebViewPage(context, title, url);
} else {
Utils.launchWebURL(url);
}
}
}