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,17 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// Service to broadcast tab navigation events
|
||||
/// Allows screens to refresh when their tab becomes active
|
||||
class TabNavigationService extends ChangeNotifier {
|
||||
int _currentTabIndex = 0;
|
||||
|
||||
int get currentTabIndex => _currentTabIndex;
|
||||
|
||||
/// Notify listeners that a tab has been selected
|
||||
void onTabSelected(int index) {
|
||||
if (_currentTabIndex != index) {
|
||||
_currentTabIndex = index;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user