GnssService osztály és refraktorálás a app_drawer miatt, shellview bevezetés.
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/pages/home/presentation/controllers/home_controller.dart';
|
||||
import 'package:terepi_seged/pages/home/presentation/widgets/big_button_widget.dart';
|
||||
import 'package:terepi_seged/widgets/app_drawer.dart';
|
||||
|
||||
class HomeView extends GetView<HomeViewController> {
|
||||
const HomeView({Key? key}) : super(key: key);
|
||||
@@ -10,195 +11,179 @@ class HomeView extends GetView<HomeViewController> {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Scaffold(
|
||||
extendBody: true,
|
||||
backgroundColor: Colors.black.withOpacity(0.05),
|
||||
appBar: AppBar(
|
||||
elevation: 0.0,
|
||||
title: const Text('Kezdőlap'),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios),
|
||||
color: Colors.white,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Column(children: [
|
||||
Column(
|
||||
children: const [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10.0),
|
||||
child: Center(
|
||||
child: Text("Kezdőlap"),
|
||||
),
|
||||
),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/map');
|
||||
// },
|
||||
// child: const Text('Map')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/bluetooth_test');
|
||||
// },
|
||||
// child: const Text('Bluetooth test')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/socket_test');
|
||||
// },
|
||||
// child: const Text('Socket teszt')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/rtcm_test');
|
||||
// },
|
||||
// child: const Text('RTCM teszt'))
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.toNamed("/field_trip");
|
||||
},
|
||||
child: Text('Field trip')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed("/tracking");
|
||||
// },
|
||||
// child: Text('Tracking')),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.toNamed("/map");
|
||||
},
|
||||
child: Text('Kitűzés'))
|
||||
])),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// BigButtonWidget(
|
||||
// iconData: Icons.flag,
|
||||
// label: "Kitűzés",
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/map');
|
||||
// },
|
||||
// ),
|
||||
BigButtonWidget(
|
||||
iconData: Icons.flag,
|
||||
label: "Bemérés",
|
||||
onPressed: () async {
|
||||
Get.toNamed('/map_survey');
|
||||
},
|
||||
),
|
||||
BigButtonWidget(
|
||||
iconData: Icons.monitor_heart,
|
||||
label: "Mérés",
|
||||
onPressed: () async {
|
||||
Get.toNamed("/measured_data");
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(const SnackBar(
|
||||
// content: Text(
|
||||
// "Fejlesztlés alatt",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// backgroundColor: Colors.black54,
|
||||
// ));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(children: [
|
||||
Column(
|
||||
children: const [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10.0),
|
||||
child: Center(
|
||||
child: Text("Kezdőlap"),
|
||||
),
|
||||
),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/map');
|
||||
// },
|
||||
// child: const Text('Map')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/bluetooth_test');
|
||||
// },
|
||||
// child: const Text('Bluetooth test')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/socket_test');
|
||||
// },
|
||||
// child: const Text('Socket teszt')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/rtcm_test');
|
||||
// },
|
||||
// child: const Text('RTCM teszt'))
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.toNamed("/field_trip");
|
||||
},
|
||||
child: Text('Field trip')),
|
||||
// TextButton(
|
||||
// onPressed: () async {
|
||||
// Get.toNamed("/tracking");
|
||||
// },
|
||||
// child: Text('Tracking')),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.toNamed("/map");
|
||||
},
|
||||
child: Text('Kitűzés'))
|
||||
])),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// BigButtonWidget(
|
||||
// iconData: Icons.flag,
|
||||
// label: "Kitűzés",
|
||||
// onPressed: () async {
|
||||
// Get.toNamed('/map');
|
||||
// },
|
||||
// ),
|
||||
BigButtonWidget(
|
||||
iconData: Icons.flag,
|
||||
label: "Bemérés",
|
||||
onPressed: () async {
|
||||
Get.toNamed('/map_survey');
|
||||
},
|
||||
),
|
||||
BigButtonWidget(
|
||||
iconData: Icons.monitor_heart,
|
||||
label: "Mérés",
|
||||
onPressed: () async {
|
||||
Get.toNamed("/measured_data");
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(const SnackBar(
|
||||
// content: Text(
|
||||
// "Fejlesztlés alatt",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// backgroundColor: Colors.black54,
|
||||
// ));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
BigButtonWidget(
|
||||
iconData: Icons.navigation,
|
||||
label: "Navigáció",
|
||||
onPressed: () async {
|
||||
Get.toNamed('/navigation');
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(const SnackBar(
|
||||
// content: Text(
|
||||
// "Fejlesztlés alatt",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// backgroundColor: Colors.black54,
|
||||
// ));
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
BigButtonWidget(
|
||||
iconData: Icons.navigation,
|
||||
label: "Navigáció",
|
||||
onPressed: () async {
|
||||
Get.toNamed('/navigation');
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(const SnackBar(
|
||||
// content: Text(
|
||||
// "Fejlesztlés alatt",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// backgroundColor: Colors.black54,
|
||||
// ));
|
||||
},
|
||||
),
|
||||
BigButtonWidget(
|
||||
iconData: Icons.message,
|
||||
label: "Üzenetek",
|
||||
onPressed: () async {
|
||||
// Get.toNamed("/navigation");
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
"Fejlesztlés alatt",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
backgroundColor: Colors.black54,
|
||||
));
|
||||
},
|
||||
),
|
||||
],
|
||||
BigButtonWidget(
|
||||
iconData: Icons.message,
|
||||
label: "Üzenetek",
|
||||
onPressed: () async {
|
||||
// Get.toNamed("/navigation");
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
"Fejlesztlés alatt",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
backgroundColor: Colors.black54,
|
||||
));
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
BigButtonWidget(
|
||||
iconData: Icons.house,
|
||||
label: "Ingatlanok",
|
||||
onPressed: () async {
|
||||
// Get.toNamed('/map_test');
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
"Fejlesztlés alatt",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
backgroundColor: Colors.black54,
|
||||
));
|
||||
},
|
||||
),
|
||||
BigButtonWidget(
|
||||
iconData: Icons.edit_road,
|
||||
label: "Track",
|
||||
onPressed: () async {
|
||||
Get.toNamed("/tracking");
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(const SnackBar(
|
||||
// content: Text(
|
||||
// "Fejlesztlés alatt",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// backgroundColor: Colors.black54,
|
||||
// ));
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
BigButtonWidget(
|
||||
iconData: Icons.house,
|
||||
label: "Ingatlanok",
|
||||
onPressed: () async {
|
||||
// Get.toNamed('/map_test');
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
"Fejlesztlés alatt",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
backgroundColor: Colors.black54,
|
||||
));
|
||||
},
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Obx(
|
||||
() => Text(
|
||||
"Verzió: ${controller.packageInfo.value.version}+${controller.packageInfo.value.buildNumber}",
|
||||
style: const TextStyle(fontSize: 12)),
|
||||
)
|
||||
],
|
||||
BigButtonWidget(
|
||||
iconData: Icons.edit_road,
|
||||
label: "Track",
|
||||
onPressed: () async {
|
||||
Get.toNamed("/tracking");
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(const SnackBar(
|
||||
// content: Text(
|
||||
// "Fejlesztlés alatt",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// backgroundColor: Colors.black54,
|
||||
// ));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Obx(
|
||||
() => Text(
|
||||
"Verzió: ${controller.packageInfo.value.version}+${controller.packageInfo.value.buildNumber}",
|
||||
style: const TextStyle(fontSize: 12)),
|
||||
)
|
||||
])));
|
||||
],
|
||||
)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,7 @@ class StartPageController extends GetxController {
|
||||
|
||||
void _departStartPage() async {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
Get.offAllNamed(Routes.HOME);
|
||||
//Get.offAllNamed(Routes.HOME);
|
||||
Get.offAllNamed(Routes.SHELL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user