Phase 1 #24: Flutter 移动端框架(三合一 APP 骨架)
- pubspec.yaml: dio/provider/shared_preferences/flutter_map/geolocator - main.dart: Provider 状态管理 + 登录守卫 - AuthService: Token 管理 + Dio HTTP + SharedPreferences 持久化 - LoginPage: Material Design 登录页 - HomePage: 三合一 BottomTab 导航(供水/巡检/营收) - 预留依赖: flutter_local_notifications/image_picker/permission_handler
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'services/auth_service.dart';
|
||||
import 'pages/login/login_page.dart';
|
||||
import 'pages/home/home_page.dart';
|
||||
|
||||
void main() => runApp(const WaterApp());
|
||||
|
||||
class WaterApp extends StatelessWidget {
|
||||
const WaterApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [ChangeNotifierProvider(create: (_) => AuthService())],
|
||||
child: MaterialApp(
|
||||
title: '智慧水务',
|
||||
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
|
||||
home: Consumer<AuthService>(
|
||||
builder: (_, auth, __) => auth.isLoggedIn ? const HomePage() : const LoginPage(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user