import 'package:fis_i18n/i18n.dart';
import 'package:fis_ui/index.dart';
import 'package:fis_ui/interface/interactive_container.dart';
import 'package:flutter/material.dart';
import 'package:fis_measure/values/unit_desc.dart';
import 'package:fis_measure/view/cursor.dart';
import 'package:fis_jsonrpc/services/remedical.m.dart';
import 'package:flyinsono/architecture/define.dart';
import 'package:flyinsono/lab/color/lab_colors.dart';
import 'package:fis_theme/theme.dart';

import 'package:fis_measure/view/measure/measure_config/widgets/measure_configuration_style.dart';

import '../measure_configuration_style.dart';
import 'common.dart';

class PatternItemSelect extends StatelessWidget implements FWidget {
  const PatternItemSelect({
    super.key,
    required this.onChanged,
    required this.value,
    required this.itemList,
  });
  final ValueCallback onChanged;
  final String value;
  final List<MeasureSelectModel> itemList;
  @override
  FWidget build(BuildContext context) {
    return FContainer(
      margin: const EdgeInsets.symmetric(
        vertical: 4,
        horizontal: 10,
      ),
      child: QuickFWidget(
        Theme(
          data: ThemeData(
            primaryColor: LabColors.base100,
            secondaryHeaderColor: LabColors.selectMeasureBgColor,
          ),
          child: FSelect<MeasureSelectModel, String>(
            source: itemList,
            fontFamily: FTheme.ins.localeSetting.fontFamily,
            hintText: i18nBook.measure.selectAnnotationFontSize.t,
            textColor: LabColors.text600,
            value: value,
            clearable: false,
            height: 36,
            width: 400,
            optionLabelExtractor: (data) => data.name,
            optionValueExtractor: (data) => data.value.toString(),
            onSelectChanged: (value, index) => onChanged.call(value),
          ),
        ),
      ),
    );
  }
}
