|
|
@@ -1,25 +1,30 @@
|
|
1
|
1
|
import 'package:flutter/material.dart';
|
|
2
|
2
|
import 'package:provider/provider.dart';
|
|
3
|
|
-import 'services/auth_service.dart';
|
|
4
|
|
-import 'pages/login/login_page.dart';
|
|
5
|
|
-import 'pages/home/home_page.dart';
|
|
|
3
|
+import 'package:water_management_mobile/pages/home/home_page.dart';
|
|
|
4
|
+import 'package:water_management_mobile/services/auth_service.dart';
|
|
6
|
5
|
|
|
7
|
|
-void main() => runApp(const WaterApp());
|
|
|
6
|
+void main() {
|
|
|
7
|
+ runApp(
|
|
|
8
|
+ ChangeNotifierProvider(
|
|
|
9
|
+ create: (context) => AuthService(),
|
|
|
10
|
+ child: const MyApp(),
|
|
|
11
|
+ ),
|
|
|
12
|
+ );
|
|
|
13
|
+}
|
|
8
|
14
|
|
|
9
|
|
-class WaterApp extends StatelessWidget {
|
|
10
|
|
- const WaterApp({super.key});
|
|
|
15
|
+class MyApp extends StatelessWidget {
|
|
|
16
|
+ const MyApp({super.key});
|
|
11
|
17
|
|
|
12
|
18
|
@override
|
|
13
|
19
|
Widget build(BuildContext context) {
|
|
14
|
|
- return MultiProvider(
|
|
15
|
|
- providers: [ChangeNotifierProvider(create: (_) => AuthService())],
|
|
16
|
|
- child: MaterialApp(
|
|
17
|
|
- title: '智慧水务',
|
|
18
|
|
- theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
|
|
19
|
|
- home: Consumer<AuthService>(
|
|
20
|
|
- builder: (_, auth, __) => auth.isLoggedIn ? const HomePage() : const LoginPage(),
|
|
21
|
|
- ),
|
|
|
20
|
+ return MaterialApp(
|
|
|
21
|
+ title: '水务管理系统',
|
|
|
22
|
+ theme: ThemeData(
|
|
|
23
|
+ primarySwatch: Colors.blue,
|
|
|
24
|
+ fontFamily: 'Roboto',
|
|
22
|
25
|
),
|
|
|
26
|
+ home: const HomePage(),
|
|
|
27
|
+ debugShowCheckedModeBanner: false,
|
|
23
|
28
|
);
|
|
24
|
29
|
}
|
|
25
|
30
|
}
|