Refactor provider initialization to load only essential providers at startup. Introduce TabNavigationService for managing tab state and update screens to respond to tab changes. Clean up view models and navigation logic for improved performance and maintainability.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../data/repositories/notification_repository.dart';
|
||||
import '../../data/services/notification_check_service.dart';
|
||||
import '../../data/services/notification_state_service.dart';
|
||||
import '../../view_models/notification_view_model.dart';
|
||||
|
||||
/// Lazy NotificationViewModel provider
|
||||
/// Wraps screens that need NotificationViewModel
|
||||
Widget notificationProvider({required Widget child}) {
|
||||
return ChangeNotifierProvider(
|
||||
create:
|
||||
(context) => NotificationViewModel(
|
||||
notificationsRepository: context.read<NotificationsRepository>(),
|
||||
notificationStateService: context.read<NotificationStateService>(),
|
||||
notificationCheckService: context.read<NotificationCheckService>(),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user