91 lines
3.8 KiB
Dart
91 lines
3.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get_state_manager/get_state_manager.dart';
|
|
import 'package:terepi_seged/enums/map_survey_mode.dart';
|
|
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
|
|
|
class MapModeMenuAnchor extends StatelessWidget {
|
|
final MapSurveyController controller;
|
|
|
|
const MapModeMenuAnchor({super.key, required this.controller});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
|
|
return Obx(() {
|
|
return MenuAnchor(
|
|
menuChildren: [
|
|
MenuItemButton(
|
|
leadingIcon: const Icon(Icons.map),
|
|
trailingIcon: controller.mode.value == MapSurveyMode.browse
|
|
? const Icon(Icons.check)
|
|
: null,
|
|
onPressed: () => controller.setMode(MapSurveyMode.browse),
|
|
child: const Text('Térkép')),
|
|
MenuItemButton(
|
|
leadingIcon: const Icon(Icons.add_location_alt),
|
|
trailingIcon: controller.mode.value == MapSurveyMode.measure
|
|
? const Icon(Icons.check)
|
|
: null,
|
|
onPressed: () => controller.setMode(MapSurveyMode.measure),
|
|
child: const Text('Bemérés')),
|
|
MenuItemButton(
|
|
leadingIcon: const Icon(Icons.gps_fixed),
|
|
trailingIcon: controller.mode.value == MapSurveyMode.stakeout
|
|
? const Icon(Icons.check)
|
|
: null,
|
|
onPressed: () => controller.setMode(MapSurveyMode.stakeout),
|
|
child: const Text('Kitűzés')),
|
|
MenuItemButton(
|
|
leadingIcon: const Icon(Icons.hiking),
|
|
trailingIcon: controller.mode.value == MapSurveyMode.fieldWalk
|
|
? const Icon(Icons.check)
|
|
: null,
|
|
onPressed: () => controller.setMode(MapSurveyMode.fieldWalk),
|
|
child: const Text('Bejárás')),
|
|
MenuItemButton(
|
|
leadingIcon: const Icon(Icons.route),
|
|
trailingIcon: controller.mode.value == MapSurveyMode.track
|
|
? const Icon(Icons.check)
|
|
: null,
|
|
onPressed: () => controller.setMode(MapSurveyMode.track),
|
|
child: const Text('Útvonal')),
|
|
],
|
|
builder: (context, menuController, child) {
|
|
return InkWell(
|
|
borderRadius: BorderRadius.circular(18),
|
|
onTap: () {
|
|
if (menuController.isOpen) {
|
|
menuController.close();
|
|
} else {
|
|
menuController.open();
|
|
}
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 6,
|
|
vertical: 4,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Row(mainAxisSize: MainAxisSize.min, children: [
|
|
Icon(controller.currentModeIcon, size: 14),
|
|
const SizedBox(width: 1),
|
|
Text(controller.currentModeLabel,
|
|
style: const TextStyle(
|
|
fontSize: 14, fontWeight: FontWeight.w600)),
|
|
const Icon(Icons.arrow_drop_down, size: 18),
|
|
]),
|
|
Text('Projekt',
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontStyle: FontStyle.italic,
|
|
fontWeight: FontWeight.w400,
|
|
color: colorScheme.onSurfaceVariant))
|
|
],
|
|
)));
|
|
});
|
|
});
|
|
}
|
|
}
|