GnssService osztály és refraktorálás a app_drawer miatt, shellview bevezetés.

This commit is contained in:
2026-05-11 13:50:40 +02:00
parent f1a3753f36
commit af5d9d2c0b
18 changed files with 1048 additions and 192 deletions
@@ -0,0 +1,15 @@
import 'package:get/get.dart';
import 'package:terepi_seged/pages/home/presentation/controllers/home_controller.dart';
import 'package:terepi_seged/pages/map/presentation/controllers/map_controller.dart';
import '../presentations/controllers/shell_controller.dart';
class ShellBinding extends Bindings {
@override
void dependencies() {
// TODO: implement dependencies
Get.put(ShellController());
Get.put(HomeViewController());
Get.put(MapViewController());
}
}
@@ -0,0 +1,27 @@
import 'package:get/get.dart';
class ShellController extends GetxController {
static ShellController get to => Get.find();
final currentIndex = 0.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);
}
@@ -0,0 +1,62 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:terepi_seged/pages/home/presentation/views/home_view.dart';
import '../../../../widgets/app_drawer.dart';
import '../../../map_survey/presentations/views/mapsurvey_view.dart';
import '../controllers/shell_controller.dart';
class ShellView extends GetView<ShellController> {
const ShellView({super.key});
static const _pages = [
HomeView(),
//MapView(),
MapSurveyView(),
//TrackingView(),
//DataView(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Cím reaktívan frissül tab váltáskor
title: Obx(() => Text(controller.currentTitle)),
actions: [
//Obx(() => _GnssStatusChip()),
const SizedBox(width: 8),
],
),
drawer: const AppDrawer(),
body: Obx(() => IndexedStack(
index: controller.currentIndex.value,
children: _pages,
)),
bottomNavigationBar: Obx(() => NavigationBar(
selectedIndex: controller.currentIndex.value,
onDestinationSelected: controller.goToTab,
destinations: const [
NavigationDestination(
icon: Icon(Icons.map_outlined),
selectedIcon: Icon(Icons.map),
label: 'Térkép',
),
NavigationDestination(
icon: Icon(Icons.gps_fixed),
label: 'Mérés',
),
NavigationDestination(
icon: Icon(Icons.route),
label: 'Track',
),
NavigationDestination(
icon: Icon(Icons.table_chart_outlined),
selectedIcon: Icon(Icons.table_chart),
label: 'Adatok',
),
],
)),
);
}
}