74 lines
1.9 KiB
Dart
74 lines
1.9 KiB
Dart
import 'package:get/get.dart';
|
|
import '../bindings/login_binding.dart';
|
|
import '../pages/examples/geolocation_example.dart';
|
|
import '../bindings/geolocation_binding.dart';
|
|
import '../pages/login/login_view.dart';
|
|
|
|
/// App Routes Konfiguration
|
|
class AppRoutes {
|
|
static const String home = '/';
|
|
static const String geolocation = '/geolocation';
|
|
static const String login = '/login';
|
|
|
|
/// Route Pages Definition
|
|
static List<GetPage> pages = [
|
|
GetPage(
|
|
name: geolocation,
|
|
page: () => const GeolocationExample(),
|
|
binding: GeolocationBinding(), // Dependency Injection
|
|
transition: Transition.cupertino,
|
|
transitionDuration: const Duration(milliseconds: 300),
|
|
),
|
|
GetPage(
|
|
name: login,
|
|
page: () => const LoginPage(),
|
|
binding: LoginBinding(), // Dependency Injection
|
|
transition: Transition.cupertino,
|
|
transitionDuration: const Duration(milliseconds: 300),
|
|
),
|
|
];
|
|
}
|
|
|
|
/// Route Namen als Konstanten für typsichere Navigation
|
|
// class Routes {
|
|
// static const String geolocationExample = '/geolocation-example';
|
|
// }
|
|
|
|
/// Navigation Helper Klasse
|
|
class AppNavigation {
|
|
/// Navigate to Geolocation Example
|
|
static void toGeolocation() {
|
|
Get.toNamed(AppRoutes.geolocation);
|
|
}
|
|
|
|
/// Navigate and replace current route
|
|
static void offGeolocation() {
|
|
Get.offNamed(AppRoutes.geolocation);
|
|
}
|
|
|
|
/// Navigate and clear all previous routes
|
|
static void offAllToGeolocation() {
|
|
Get.offAllNamed(AppRoutes.geolocation);
|
|
}
|
|
|
|
/// Navigate to Login Page
|
|
static void toLogin() {
|
|
Get.toNamed(AppRoutes.login);
|
|
}
|
|
/// Navigate and replace current route
|
|
static void offLogin() {
|
|
Get.offNamed(AppRoutes.login);
|
|
}
|
|
/// Navigate and clear all previous routes
|
|
static void offAllToLogin() {
|
|
Get.offAllNamed(AppRoutes.login);
|
|
}
|
|
|
|
|
|
|
|
/// Navigate back
|
|
static void back() {
|
|
Get.back();
|
|
}
|
|
|
|
} |