import 'package:flutter/material.dart';
import 'package:flyinsono/lab/color/lab_colors.dart';
import 'package:flyinsono/lab/components/control_panel_item/control_item_number.dart';
import 'package:get/get.dart';

import 'controller.dart';

class RoiSyncView extends GetView<ImageRoiSyncController> {
  final ImageRoiSyncController iniitController;

  RoiSyncView({required this.iniitController});

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        id: "roi_sync",
        init: iniitController,
        builder: (_) {
          return Column(
            children: [
              Row(
                children: [
                  Text(
                    "ROI复制",
                    style: TextStyle(
                      color: LabColors.text600,
                      fontSize: 16,
                    ),
                  ),
                  Switch(
                    value: controller.isOpenSync,
                    inactiveTrackColor: LabColors.base600,
                    onChanged: (v) {
                      controller.switchRoiSync(v);
                    },
                  ),
                ],
              ),
              SizedBox(
                height: 10,
              ),
              NumberPad(
                key: GlobalKey(),
                currentValue: controller.startFrame,
                maxFrame: controller.endFrame,
                minFrame: 0,
                title: '起始帧',
                onNumberValueChange: (value) {
                  controller.startFrame = value;
                  controller.frameUpdate();
                },
              ),
              SizedBox(
                height: 10,
              ),
              NumberPad(
                key: GlobalKey(),
                currentValue: controller.endFrame,
                maxFrame: controller.framesGot,
                minFrame: controller.startFrame,
                title: '结束帧',
                onNumberValueChange: (value) {
                  controller.endFrame = value;
                  controller.frameUpdate();
                },
              ),
            ],
          );
        });
  }
}
