This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
104 lines (96 loc) · 2.9 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
import 'package:cannot_qiandao/func/plugin.dart';
import 'package:cannot_qiandao/widgets/dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:cannot_qiandao/pages/qiandao.dart';
import 'package:cannot_qiandao/pages/settings.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:dynamic_color/dynamic_color.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
statusBarColor: Colors.transparent,
),
);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
QiandaoPlugin initplugin = QiandaoPlugin();
await initplugin.init();
runApp(const MainAPP());
}
class MainAPP extends StatelessWidget {
const MainAPP({super.key});
@override
Widget build(BuildContext context) {
return DynamicColorBuilder(builder: (lightDynamic, darkDynamic) {
return MaterialApp(
title: '没必要签到',
theme: ThemeData(
colorScheme: lightDynamic,
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: darkDynamic,
useMaterial3: true,
),
themeMode: ThemeMode.system,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [Locale('zh', 'CN')],
home: const MainPage(),
);
});
}
}
class MainPage extends StatefulWidget {
const MainPage({super.key});
@override
State<MainPage> createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("没必要签到"),
actions: [
// 登录按钮
IconButton(
onPressed: () => showDialog(
context: context,
barrierDismissible: false,
builder: (builder) => const UserDialog(),
),
icon: const Icon(Icons.login),
tooltip: "登录",
),
// 编辑按钮
IconButton(
onPressed: () => showDialog(
context: context,
builder: (builder) => const EditDialog(),
),
icon: const Icon(Icons.edit),
tooltip: "编辑",
),
// 设置按钮
IconButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const SettingsPage();
}),
),
icon: const Icon(Icons.settings),
tooltip: "设置",
),
],
),
body: const QiandaoPage(),
);
}
}