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/services/gnss/gnss_service.dart';

import 'fix_chip.dart';
import 'mini_status_value.dart';
import 'satellite_mini_value.dart';

class GnssStatusStrip extends StatelessWidget {
  final MapSurveyController controller;

  const GnssStatusStrip({
    required this.controller,
  });

  @override
  Widget build(BuildContext context) {
    final colorScheme = Theme.of(context).colorScheme;

    return Obx(() {
      return Container(
        height: 28,
        padding: const EdgeInsets.symmetric(horizontal: 10),
        decoration: BoxDecoration(
          color: colorScheme.surfaceContainerHighest.withOpacity(0.75),
          border: Border(
            top: BorderSide(
              color: colorScheme.outlineVariant.withOpacity(0.6),
            ),
          ),
        ),
        child: Row(
          children: [
            MiniStatusValue(
              label: 'H',
              value: controller.horizontalAccuracyText,
              //color: controller.horizontalAccuracyColor(context),
              color: Colors.green,
            ),
            const SizedBox(width: 10),
            MiniStatusValue(
              label: 'V',
              value: controller.verticalAccuracyText,
              //color: controller.verticalAccuracyColor(context),
              color: Colors.green,
            ),
            const Spacer(),
            FixChip(
                //label: controller.fixLabel, // GPS, DGPS, FLOAT, FIX
                //color: controller.fixColor(context),
                label: 'GPS',
                color: Colors.green),
            const SizedBox(width: 8),
            SatelliteMiniValue(
              used: GnssService.to.totalUsedSatellites,
              inView: GnssService.to.totalVisibleSatellites,
              //onTap: controller.showGnssSkyPlotSheet,
              onTap: () {},
            ),
          ],
        ),
      );
    });
  }
}
