- Implemented new navigation system with NavigationProvider and route management - Added adaptive theme system with ThemeProvider for better theme handling - Introduced glassmorphism design elements (app bars, scaffolds, cards) - Added advanced animations (spring animations, page transitions, staggered lists) - Implemented performance optimizations (memory manager, lazy loading) - Refactored Analysis screen into modular components - Added floating navigation bar with haptic feedback - Improved subscription cards with swipe actions - Enhanced skeleton loading with better animations - Added cached network image support - Improved overall app architecture and code organization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
2.5 KiB
Dart
79 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../providers/navigation_provider.dart';
|
|
|
|
class AppNavigationObserver extends NavigatorObserver {
|
|
@override
|
|
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
|
super.didPush(route, previousRoute);
|
|
_updateNavigationState(route);
|
|
debugPrint('Navigation: Push ${route.settings.name}');
|
|
}
|
|
|
|
@override
|
|
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
|
super.didPop(route, previousRoute);
|
|
if (previousRoute != null) {
|
|
_updateNavigationState(previousRoute);
|
|
} else {
|
|
// 이전 라우트가 없으면 Provider의 히스토리를 사용
|
|
_handlePopWithProvider();
|
|
}
|
|
debugPrint('Navigation: Pop ${route.settings.name}');
|
|
}
|
|
|
|
@override
|
|
void didRemove(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
|
super.didRemove(route, previousRoute);
|
|
if (previousRoute != null) {
|
|
_updateNavigationState(previousRoute);
|
|
}
|
|
debugPrint('Navigation: Remove ${route.settings.name}');
|
|
}
|
|
|
|
@override
|
|
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) {
|
|
super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
|
|
if (newRoute != null) {
|
|
_updateNavigationState(newRoute);
|
|
}
|
|
debugPrint('Navigation: Replace ${oldRoute?.settings.name} with ${newRoute?.settings.name}');
|
|
}
|
|
|
|
void _updateNavigationState(Route<dynamic> route) {
|
|
if (navigator?.context == null) return;
|
|
|
|
final routeName = route.settings.name;
|
|
if (routeName == null) return;
|
|
|
|
// build 완료 후 업데이트하도록 변경
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
if (navigator?.context == null) return;
|
|
|
|
try {
|
|
final context = navigator!.context;
|
|
final navigationProvider = Provider.of<NavigationProvider>(context, listen: false);
|
|
navigationProvider.updateByRoute(routeName);
|
|
} catch (e) {
|
|
debugPrint('Failed to update navigation state: $e');
|
|
}
|
|
});
|
|
}
|
|
|
|
void _handlePopWithProvider() {
|
|
if (navigator?.context == null) return;
|
|
|
|
// build 완료 후 업데이트하도록 변경
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
if (navigator?.context == null) return;
|
|
|
|
try {
|
|
final context = navigator!.context;
|
|
final navigationProvider = Provider.of<NavigationProvider>(context, listen: false);
|
|
navigationProvider.pop();
|
|
} catch (e) {
|
|
debugPrint('Failed to handle pop with provider: $e');
|
|
}
|
|
});
|
|
}
|
|
} |