01c36eb32e
- 删除 mock_api_client、mock_calendar_service、mock_history_service - 新增 fixed_length_code_input、link_button、message_composer 共享组件 - 优化登录/注册/密码重置页面使用新组件 - 简化 injection.dart 移除 mock 分支 - 更新 env.dart 配置(BACKEND_URL 替换 API_URL) - 后端 agentscope 工具和测试更新 - 重构 AGENTS.md 文档结构 - 新增 deploy/ 目录和 protocol 文档
52 lines
1.5 KiB
Dart
52 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'core/config/env.dart';
|
|
import 'core/di/injection.dart';
|
|
import 'core/router/app_router.dart';
|
|
import 'core/theme/app_theme.dart';
|
|
import 'core/notifications/local_notification_service.dart';
|
|
import 'features/auth/presentation/bloc/auth_bloc.dart';
|
|
import 'features/auth/presentation/bloc/auth_event.dart';
|
|
import 'features/calendar/data/services/calendar_service.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await configureDependencies();
|
|
|
|
final notificationService = sl<LocalNotificationService>();
|
|
await notificationService.initialize();
|
|
|
|
final authBloc = sl<AuthBloc>();
|
|
authBloc.add(AuthStarted());
|
|
|
|
try {
|
|
final now = DateTime.now();
|
|
final end = now.add(const Duration(days: 90));
|
|
final events = await sl<CalendarService>().getEventsForRange(now, end);
|
|
await notificationService.rebuildUpcomingReminders(events);
|
|
} catch (_) {
|
|
// ignore startup sync failures
|
|
}
|
|
|
|
runApp(LinksyApp(authBloc: authBloc));
|
|
}
|
|
|
|
class LinksyApp extends StatelessWidget {
|
|
final AuthBloc authBloc;
|
|
|
|
const LinksyApp({super.key, required this.authBloc});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider<AuthBloc>.value(
|
|
value: authBloc,
|
|
child: MaterialApp.router(
|
|
title: 'Linksy',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: AppTheme.light,
|
|
routerConfig: createAppRouter(authBloc),
|
|
),
|
|
);
|
|
}
|
|
}
|