import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
import 'package:terepi_seged/widgets/map_info_card.dart';

import 'coordinate_row.dart';

class EovCoordinateCard extends StatelessWidget {
  final MapSurveyController controller;

  const EovCoordinateCard({
    super.key,
    required this.controller,
  });

  @override
  Widget build(BuildContext context) {
    return Obx(() {
      return MapInfoCard(
        onClose: controller.toggleShowEovCard,
        title: Row(
          children: [
            const Icon(Icons.grid_on, size: 18),
            const SizedBox(width: 6),
            Text(
              'EOV',
              style: Theme.of(context).textTheme.titleSmall?.copyWith(
                    fontWeight: FontWeight.w700,
                  ),
            ),
          ],
        ),
        child: Column(
          children: [
            CoordinateRow(
              label: 'Y',
              value: controller.eovY.value.toStringAsFixed(3),
            ),
            const SizedBox(height: 4),
            CoordinateRow(
              label: 'X',
              value: controller.eovX.value.toStringAsFixed(3),
            ),
            const SizedBox(height: 4),
            CoordinateRow(
              label: 'Z',
              value: controller.eovHeight.value?.toStringAsFixed(3) ?? '-',
            ),
          ],
        ),
      );
    });
  }
}
