33 lines
832 B
Dart
33 lines
832 B
Dart
import 'package:get/get.dart';
|
|
|
|
class ShellController extends GetxController {
|
|
static ShellController get to => Get.find();
|
|
|
|
final currentIndex = 1.obs;
|
|
final isNavBarVisible = true.obs;
|
|
|
|
static const titles = [
|
|
'Térkép',
|
|
'Pontmérés',
|
|
'Nyomvonal',
|
|
'Adatok',
|
|
];
|
|
|
|
String get currentTitle => titles[currentIndex.value];
|
|
|
|
void goToTab(int index) {
|
|
if (index < 0 || index >= titles.length) return;
|
|
currentIndex.value = index;
|
|
}
|
|
|
|
// Shortcutok — a Drawerből hívhatók
|
|
void goToMap() => goToTab(0);
|
|
void goToSurvey() => goToTab(1);
|
|
void goToTracking() => goToTab(2);
|
|
void goToData() => goToTab(3);
|
|
|
|
void showNavBar() => isNavBarVisible.value = true;
|
|
void hideNavBar() => isNavBarVisible.value = false;
|
|
void toggleNavBar() => isNavBarVisible.value = !isNavBarVisible.value;
|
|
}
|