import 'package:flutter/material.dart';
import 'package:vitalapp/consts/styles.dart';
import 'package:vitalapp/pages/check/models/form.dart';
import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_card.dart';
import 'package:vitalapp/pages/check/widgets/exam_title.dart';

class ExamHealthGuidanceCheckBox extends StatelessWidget {
  const ExamHealthGuidanceCheckBox({
    super.key,
    required this.currentFormObject,
    required this.options,
    required this.selectCheckBoxChange,
    required this.currentSelectedCheckBox,
    required this.score,
    required this.judgmentResult,
  });
  final FormObject currentFormObject;
  final List<Option> options;
  final Function selectCheckBoxChange;
  final List<dynamic> currentSelectedCheckBox;
  final int score;
  final String judgmentResult;
  @override
  Widget build(BuildContext context) {
    String label = currentFormObject.label ?? '';
    return ExamCard(
      titleText: ExamTitle(
        label: label,
        titleType: '（多选）    得分:$score    判定结果：$judgmentResult',
      ),
      title: label,
      content: Center(
        child: Wrap(
          children: options
              .map(
                (e) => Container(
                  padding: const EdgeInsets.all(8),
                  child: InkWell(
                    onTap: () => selectCheckBoxChange(e),
                    borderRadius: GlobalStyles.borderRadius,
                    child: Ink(
                      decoration: BoxDecoration(
                        border: Border.all(
                          color: currentSelectedCheckBox.contains(e.value)
                              ? Colors.blue
                              : Colors.black26,
                        ),
                        borderRadius: const BorderRadius.all(
                          Radius.circular(16),
                        ),
                        color: currentSelectedCheckBox.contains(e.value)
                            ? Colors.blue
                            : Colors.transparent,
                      ),
                      child: Container(
                        padding: const EdgeInsets.all(15),
                        alignment: Alignment.center,
                        width: 250,
                        child: FittedBox(
                          child: Text(
                            e.label ?? '',
                            style: TextStyle(
                              fontSize: 20,
                              color: currentSelectedCheckBox.contains(e.value)
                                  ? Colors.white
                                  : Colors.black54,
                            ),
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
              )
              .toList(),
        ),
      ),
    );
  }
}
