30 lines
721 B
Dart
30 lines
721 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class GlobalNavigator {
|
|
static final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
|
|
|
static NavigatorState? get navigator => navigatorKey.currentState;
|
|
|
|
static void navigateToLogin() {
|
|
print('🚀 GlobalNavigator: Navigating to login...');
|
|
|
|
if (navigator != null) {
|
|
navigator!.pushNamedAndRemoveUntil(
|
|
'/login',
|
|
(Route<dynamic> route) => false,
|
|
);
|
|
}
|
|
}
|
|
|
|
static void navigateToMain() {
|
|
print('🚀 GlobalNavigator: Navigating to main...');
|
|
|
|
if (navigator != null) {
|
|
navigator!.pushNamedAndRemoveUntil(
|
|
'/main',
|
|
(Route<dynamic> route) => false,
|
|
);
|
|
}
|
|
}
|
|
}
|