import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ExaminationItemCard extends StatelessWidget {
  final MySelectedExamination examination;
  final Function removeExamination;

  ExaminationItemCard(this.examination, this.removeExamination);

  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);

    return Container(
      color: Colors.white,
      padding: EdgeInsets.all(8),
      margin: EdgeInsets.only(bottom: 8),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Expanded(
                  child: Container(
                child: AppText(
                  projectViewModel.isArabic
                      ? examination.selectedExamination.nameAr != null &&
                              examination.selectedExamination.nameAr != ""
                          ? examination.selectedExamination.nameAr
                          : examination.selectedExamination.nameEn
                      : examination.selectedExamination.nameEn,
                  fontWeight: FontWeight.w600,
                  fontFamily: 'Poppins',
                  color: Color(0xFF2B353E),
                  fontSize: SizeConfig.textMultiplier * 1.8,
                ),
              )),
              Row(
                children: [
                  AppText(
                    TranslationBase.of(context).remove,
                    fontWeight: FontWeight.w600,
                    fontFamily: 'Poppins',
                    color: Colors.red.shade800,
                    fontSize: SizeConfig.textMultiplier * 1.8,
                  ),
                  InkWell(
                    onTap: removeExamination,
                    child: Icon(
                      Icons.clear,
                      size: 20,
                      color: Colors.red.shade800,
                    ),
                  )
                ],
              ),
            ],
          ),
          AppText(
            !examination.isNormal
                ? examination.isAbnormal
                    ? TranslationBase.of(context).abnormal
                    : TranslationBase.of(context).notExamined
                : TranslationBase.of(context).normal,
            fontWeight: FontWeight.bold,
            fontFamily: 'Poppins',
            color: !examination.isNormal
                ? examination.isAbnormal
                    ? Colors.red.shade800
                    : Colors.grey.shade800
                : Colors.green.shade800,
            fontSize: SizeConfig.textMultiplier * 1.8,
          ),
          SizedBox(
            height: 4,
          ),
          AppText(
            examination.remark,
            fontWeight: FontWeight.normal,
            fontFamily: 'Poppins',
            color: Color(0xFF575757),
            fontSize: SizeConfig.textMultiplier * 1.8,
          ),
        ],
      ),
    );
  }
}
