import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';

class ComplaintItems extends StatefulWidget {
  final GetChiefComplaintVidaPlus complaint;
  final Function(GetChiefComplaintVidaPlus) onCrossClicked;
  final bool isDeletable;

  const ComplaintItems(
      {super.key, required this.complaint, required this.onCrossClicked, this.isDeletable = false});


  @override
  State<ComplaintItems> createState() => _ComplaintItemsState();
}

class _ComplaintItemsState extends State<ComplaintItems> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(5.0),

      margin:const EdgeInsets.all(5.0) ,
      alignment: Alignment.center,
      decoration: BoxDecoration(
          color: Color(0xffEAEAEA),
          borderRadius: BorderRadius.circular(
            5,
          )),
      child: Row(children: [ SizedBox(
        width: 120,
        child: Text(
          widget.complaint.chiefComplain!,
            style: TextStyle(
            overflow: TextOverflow.ellipsis,
            fontWeight: FontWeight.w400,
            height: 1.2,
            fontSize: 14,
              color: Color(0xFF575757),
            ),
              maxLines: 1,
              softWrap: false,
          textAlign: TextAlign.center,
            ),
      ),
        widget.isDeletable ?  InkWell(
          onTap: () {
            widget.onCrossClicked(widget.complaint);
          },
          child: Icon(
            Icons.close,
            size: 18,
            color: Color(0xFFD02127),
          ),
        ) :SizedBox()
          ],),
    );

  }
}
