import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:line_icons/line_icons.dart';
import 'package:rkm/widgets/input_text.dart';
import '../../models/check_model.dart';
import '../../config/color_palette.dart';
import '../../config/const_variable.dart';
import '../../widgets/alert_dialog_default.dart';
import '../../widgets/appbar_default.dart';
import '../../widgets/button_default.dart';
import '../../widgets/check_box_subtitle.dart';
import '../../widgets/dropdown_with_subtitle.dart';
import '../../widgets/input_with_subtitle.dart';
import '../../widgets/onbackbutton.dart';
import '../../widgets/switch_with_subtitle.dart';
import '../../widgets/text_default.dart';
import '../../widgets/title_containers.dart';

class ServiceIndividualScreen extends StatefulWidget {
  const ServiceIndividualScreen({Key? key}) : super(key: key);

  @override
  State<ServiceIndividualScreen> createState() => _ServiceIndividualScreenState();
}

class _ServiceIndividualScreenState extends State<ServiceIndividualScreen> {

  var professionalController = TextEditingController(text: 'ADMINISTRADOR');
  var unitController = TextEditingController(text: 'USF PINHAL - EMILIA STEPHANI SIMIONATO');
  var controllerSearchCondition = TextEditingController();
  var controllerSearchCID = TextEditingController();
  var controllerComplement = TextEditingController();
  String date='Data Atendimento';
  String? selectCodTeam;
  String? selectRationalityHealth;
  String? selectModelService;
  String? selectServicePlace;
  String? selectTypeService;
  String? selectModality;
  String? selectRotation;
  String? selectCIAP1;
  String? selectCIAP2;
  String? selectCID;
  String? selectConduct;
  String? selectBreastfeeding;
  String? selectProfessionals;
  String? selectCBO;
  String add='';
  List examsList=[];
  List<CheckModel> serviceConditionModel = [];
  List<CheckModel> trackingModel = [];
  List<CheckModel> nasfPoloModelList = [];
  List<CheckModel> communicableDiseasesModel = [];
  List<CheckModel> proceduresModel = [];
  List<CheckModel> conductList = [];
  List<CheckModel> forwardingList = [];
  bool switchVaccineUpToDate = false;
  bool switchPregnancyPlane = false;
  bool switchResquestedTest = false;
  bool switchListenStart = false;
  bool switchAvalibleTest = false;
  bool switchUnderObservation = false;
  bool selectExamsRequested = false;
  bool selectExamsAvalible = false;
  var userResponsibleRegisterController = TextEditingController(text: 'ADMINISTRADOR');
  var userUnitController = TextEditingController(text: 'USF PINHAL - EMILIA STEPHANI SIMIONATO');
  var weigthController = TextEditingController();
  var heightController = TextEditingController();
  var cephalicPerimeterController = TextEditingController();
  var dumController = TextEditingController();
  var oldPregnancyController = TextEditingController();
  var childBirthsController = TextEditingController();

  escolherprazoInicio(BuildContext context) async {
    var pickDate = await showDatePicker(
        context: context,
        initialDate: DateTime.now(),
        firstDate: DateTime(2022),
        lastDate: DateTime(2025));
    if (pickDate != null) {
      setState(() {
        date = formatData(year: pickDate.year, month: pickDate.month, day: pickDate.day);
        date = 'Data Atendimento $date';
      });
    }
  }

  String formatData({int? year, int? month, int? day}) {
    DateTime data = DateTime(year!, month!, day!);
    String formattedDate = DateFormat('dd/MM/yyyy').format(data);
    return formattedDate;
  }

  @override
  Widget build(BuildContext context) {

    double heigth = MediaQuery.of(context).size.height;
    double width = MediaQuery.of(context).size.width;

    return WillPopScope(
      onWillPop: ()=> OnBackButton().onBackButton(context),
      child: Scaffold(
        appBar: AppBarDefault().appbar(context, 'RKM AB - Atendimento Individual'),
        body: Container(
          height: double.infinity,
          width: double.infinity,
          decoration: ConstVariable().backgroundGradient,
          child: ListView(
            children: [
              Card(
                margin: EdgeInsets.all(10),
                child: Column(
                  children: [
                    TitleContainers(title: 'Identificação do Atendimento'),
                    Row(
                      children: [
                        Container(
                          height: heigth*0.5,
                          width: width*0.2,
                          child: Icon(Icons.assignment_rounded,size: 80,),
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.start,
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            GestureDetector(
                              onTap: ()=>escolherprazoInicio(context),
                              child: Container(
                                height: 50,
                                margin: EdgeInsets.symmetric(horizontal: 10),
                                padding: EdgeInsets.symmetric(horizontal: 8,vertical: 10),
                                decoration: BoxDecoration(
                                  border: Border.all(color: ColorPalette.white),
                                  borderRadius: BorderRadius.all(
                                      Radius.circular(5.0) //                 <--- border radius here
                                  ),
                                ),
                                width: width*0.7,
                                child: TextDefault(
                                  text: date,
                                  fontWeigth: FontWeight.bold,
                                  color: ColorPalette.black54,
                                  fontSize: 18,
                                ),
                              ),
                            ),
                            DropdownWithSubtitle(
                              list: ['MANHÃ','TARDE','NOITE'],
                              widthSubtitle: width*0.7,
                              subtitle: 'Turno',
                              hintDropdown: 'Turno',
                              select: selectRotation,
                              widthDropdown:  width*0.7,
                              widthContainerDropdown: width*0.6,
                              onChanged: (value){
                                setState(() {
                                  selectRotation = value!;
                                });
                              },
                              colorBorder: ColorPalette.white,
                            ),
                            DropdownWithSubtitle(
                              list: ConstVariable().listServicePlace,
                              widthSubtitle: width*0.2,
                              subtitle: 'Local de Atendimento',
                              hintDropdown: 'Local de Atendimento',
                              select: selectServicePlace,
                              widthDropdown:  width*0.7,
                              widthContainerDropdown:  width*0.6,
                              onChanged: (value)=>setState(()=>selectServicePlace = value!),
                              colorBorder: ColorPalette.white,
                            ),
                            DropdownWithSubtitle(
                              list: ConstVariable().typeService2,
                              widthSubtitle: width*0.2,
                              subtitle: 'Tipo de Atendimento',
                              hintDropdown: 'Tipo de Atendimento',
                              select: selectTypeService,
                              widthDropdown:  width*0.7,
                              widthContainerDropdown:  width*0.65,
                              onChanged: (value){
                                setState(() {
                                  selectTypeService = value!;
                                });
                              },
                              colorBorder: ColorPalette.white,
                            ),
                            Container(
                              width: width*0.7,
                              child: Row(
                                children: [
                                  TextDefault(text: 'Outros Profissionais',fontSize: 15),
                                  Spacer(),
                                  IconButton(
                                    icon: Icon(Icons.people_alt_rounded),
                                    onPressed: ()=>AlertDialogDefault().outherProfessionals(
                                        context,
                                        'Outros Profissionais',
                                        'Adicionar Profissional',
                                        selectProfessionals,
                                        selectCBO,
                                        add
                                    ),
                                  )
                                ],
                              ),
                            ),
                            InputWithSubtitle(
                              subtitle: 'Peso (em kg - 000,000)',
                              hintInput: 'Peso (em kg - 000,000)',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Peso (em kg - 000,000)',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: weigthController,
                              colorBorder: ColorPalette.white,
                              onChanged: (v)=>setState((){}),
                            ),
                            InputWithSubtitle(
                              subtitle: 'Altura (em metros - 0,00)',
                              hintInput: 'Altura (em metros - 0,00)',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Altura (em metros - 0,00)',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: heightController,
                              colorBorder: ColorPalette.white,
                              onChanged: (v)=>setState((){}),
                            ),
                            InputWithSubtitle(
                              subtitle: 'Perímetro cefálico (em centímetros - 000,00)',
                              hintInput: 'Perímetro cefálico (em centímetros - 000,00)',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Perímetro cefálico (em centímetros - 000,00)',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: cephalicPerimeterController,
                              colorBorder: ColorPalette.white,
                              onChanged: (v)=>setState((){}),
                            ),
                            SwitchWithSubtitle(
                              width: width*0.7,
                              title: 'Vacina em Dia',
                              value: switchVaccineUpToDate,
                              onChanged: (value)=>setState(()=>switchVaccineUpToDate=value)
                            ),
                            DropdownWithSubtitle(
                              list: ['EXCLUSIVO','PREDOMINANTE','COMPLEMENTADO','INEXISTENTE'],
                              widthSubtitle: width*0.7,
                              subtitle: 'Aleitamento Materno',
                              hintDropdown: 'Aleitamento Materno',
                              select: selectBreastfeeding,
                              widthDropdown:  width*0.7,
                              widthContainerDropdown: width*0.6,
                              onChanged: (value)=>setState(()=>selectBreastfeeding = value!),
                              colorBorder: ColorPalette.white,
                            ),
                          ],
                        )
                      ],
                    )
                  ],
                ),
              ),
              Card(
                margin: EdgeInsets.all(10),
                child: Column(
                  children: [
                    TitleContainers(title: 'Profissional'),
                    Row(
                      children: [
                        Container(
                          height: heigth*0.3,
                          width: width*0.2,
                          child: Icon(Icons.business_center,size: 80,),
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.start,
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            InputWithSubtitle(
                              subtitle: 'Usuário responsável Pelo Cadastro',
                              hintInput: 'Usuário responsável Pelo Cadastro',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Usuário responsável Pelo Cadastro',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: userResponsibleRegisterController,
                              colorBorder: ColorPalette.white,
                              enabled: false,
                              onChanged: (v)=>setState((){}),
                            ),
                            InputWithSubtitle(
                              subtitle: 'Unidade do Profissional',
                              hintInput:'Unidade do Profissional',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Unidade do Profissional',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: userUnitController,
                              colorBorder: ColorPalette.white,
                              enabled: false,
                              onChanged: (v)=>setState((){}),
                            ),
                            DropdownWithSubtitle(
                              list: [],
                              widthSubtitle: width*0.7,
                              subtitle: 'CBO',
                              hintDropdown: 'CBO',
                              select: selectCBO,
                              widthDropdown:  width*0.7,
                              widthContainerDropdown: width*0.6,
                              onChanged: (value){
                                setState(() {
                                  selectCBO = value!;
                                });
                              },
                              colorBorder: ColorPalette.white,
                            ),
                            DropdownWithSubtitle(
                              list: ['INE: 0001558536 / Área: 4 - Microárea:-'],
                              widthSubtitle: width*0.2,
                              subtitle: 'Código da Equipe',
                              hintDropdown: 'Código da Equipe',
                              select: selectCodTeam,
                              widthDropdown:  width*0.7,
                              widthContainerDropdown:  width*0.6,
                              onChanged: (value)=>setState(()=>selectCodTeam = value!),
                              colorBorder: ColorPalette.white,
                            ),
                          ],
                        )
                      ],
                    )
                  ],
                ),
              ),
              Card(
                margin: EdgeInsets.all(10),
                child: Column(
                  children: [
                    TitleContainers(title: 'Gestante'),
                    Row(
                      children: [
                        Container(
                          height: heigth*0.3,
                          width: width*0.2,
                          child: Icon(Icons.business_center,size: 80,),
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.start,
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            InputWithSubtitle(
                              subtitle: 'DUM',
                              hintInput: 'DUM',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'DUM',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: dumController,
                              colorBorder: ColorPalette.white,
                              enabled: false,
                              onChanged: (v)=>setState((){}),
                            ),
                            SwitchWithSubtitle(
                              onChanged: (value){},
                              value: switchPregnancyPlane,
                              width: width*0.65,
                              title: 'Gravidez Planejada'
                            ),
                            InputWithSubtitle(
                              subtitle: 'Idade Gestacional',
                              hintInput:'Idade Gestacional',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Idade Gestacional',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: oldPregnancyController,
                              colorBorder: ColorPalette.white,
                              enabled: false,
                              onChanged: (v)=>setState((){}),
                            ),
                            InputWithSubtitle(
                              subtitle: 'Partos',
                              hintInput:'Partos',
                              errorInput: 'Campo obrigatório',
                              labelInput: 'Partos',
                              widthSubtitle: width*0.7,
                              widthInput: width*0.7,
                              controller: childBirthsController,
                              colorBorder: ColorPalette.white,
                              enabled: false,
                              onChanged: (v)=>setState((){}),
                            ),
                          ],
                        )
                      ],
                    )
                  ],
                ),
              ),
              Card(
                margin: EdgeInsets.all(10),
                child: Column(
                  children: [
                    TitleContainers(title: 'Atendimento'),
                    Row(
                        children: [
                          Container(
                            height: heigth*0.4,
                            width: width*0.2,
                            child: Icon(LineIcons.edit,size: 80,),
                          ),
                          Padding(
                            padding: const EdgeInsets.symmetric(horizontal: 10.0),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.start,
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                DropdownWithSubtitle(
                                  list: ['ATENÇÃO DOMICILIAR 1','ATENÇÃO DOMICILIAR 2','ATENÇÃO DOMICILIAR 3',],
                                  widthSubtitle: width*0.2,
                                  subtitle: 'Modalidade',
                                  hintDropdown:'Modalidade',
                                  select: selectModelService,
                                  widthDropdown:  width*0.65,
                                  widthContainerDropdown:  width*0.6,
                                  onChanged: (value)=>setState(()=>selectModelService = value!),
                                  colorBorder: ColorPalette.white,
                                ),
                                TitleContainers(title: 'Condição Avaliada',width: width * 0.73,textAling: TextAlign.start),
                                Container(
                                  width: width*0.7,
                                  height: heigth*0.5,
                                  child: GridView.builder(
                                      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                                          mainAxisSpacing: 2,
                                          crossAxisSpacing: 2,
                                          crossAxisCount: 2,
                                        mainAxisExtent: 50
                                      ),
                                      physics: const NeverScrollableScrollPhysics(),
                                      itemCount: ConstVariable().serviceIndividualCheckBoxList.length,
                                      itemBuilder: (context,index){
                                        serviceConditionModel.add(
                                            CheckModel(
                                                subtitle: ConstVariable().serviceIndividualCheckBoxList[index],
                                                check: false
                                            )
                                        );
                                        return CheckBoxSubtitle(
                                          subtitle: serviceConditionModel[index].subtitle,
                                          checkbox:serviceConditionModel[index].check,
                                          width: width*0.25,
                                          fontSize: 12,
                                          onChanged: (value)=>setState(()=>serviceConditionModel[index].check=value),
                                        );
                                      }
                                  ),
                                ),
                                TitleContainers(title: 'Doenças Transmissíveis',width: width * 0.73,textAling: TextAlign.start),
                                Container(
                                  width: width*0.7,
                                  height: heigth*0.15,
                                  child: GridView.builder(
                                      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                                          mainAxisSpacing: 2,
                                          crossAxisSpacing: 2,
                                          crossAxisCount: 2,
                                          mainAxisExtent: 50
                                      ),
                                      physics: const NeverScrollableScrollPhysics(),
                                      itemCount: ConstVariable().communicableDiseasesList.length,
                                      itemBuilder: (context,index){
                                        communicableDiseasesModel.add(
                                            CheckModel(
                                                subtitle: ConstVariable().communicableDiseasesList[index],
                                                check: false
                                            )
                                        );
                                        return CheckBoxSubtitle(
                                          subtitle: communicableDiseasesModel[index].subtitle,
                                          checkbox:communicableDiseasesModel[index].check,
                                          width: width*0.25,
                                          fontSize: 12,
                                          onChanged: (value)=>setState(()=>communicableDiseasesModel[index].check=value),
                                        );
                                      }
                                  ),
                                ),
                                TitleContainers(title: 'Rastreamento',width: width * 0.73,textAling: TextAlign.start),
                                Container(
                                  width: width*0.7,
                                  height: heigth*0.15,
                                  child: ListView.builder(
                                      physics: const NeverScrollableScrollPhysics(),
                                      itemCount: ConstVariable().trackingModelList.length,
                                      itemBuilder: (context,index){
                                        trackingModel.add(
                                            CheckModel(
                                                subtitle: ConstVariable().trackingModelList[index],
                                                check: false
                                            )
                                        );
                                        return CheckBoxSubtitle(
                                          subtitle: trackingModel[index].subtitle,
                                          checkbox:trackingModel[index].check,
                                          width: width*0.5,
                                          fontSize: 12,
                                          onChanged: (value)=>setState(()=>trackingModel[index].check=value),
                                        );
                                      }
                                  ),
                                ),
                                GestureDetector(
                                    onTap: ()=>AlertDialogDefault().alert_with_search(
                                        context,
                                        controllerSearchCondition,
                                        ListView.separated(
                                          itemCount: ConstVariable().CIAP.length,
                                          separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
                                          itemBuilder: (context,index){
                                            return ListTile(
                                                onTap: ()=>setState(() {
                                                  selectCIAP1 = ConstVariable().CIAP[index];
                                                  Navigator.pop(context);
                                                }),
                                                title: TextDefault(text: ConstVariable().CIAP[index],maxLines: 2,)
                                            );
                                          },
                                        )
                                    ),
                                    child: Container(
                                        padding: EdgeInsets.symmetric(vertical: 10),
                                        width: width*0.7,
                                        child: TextDefault(
                                          text: selectCIAP1!=null?'CIAP2-01 $selectCIAP1':'CIAP2-01',
                                          color: ColorPalette.black54,
                                        )
                                    )
                                ),
                                GestureDetector(
                                    onTap: ()=>AlertDialogDefault().alert_with_search(
                                        context,
                                        controllerSearchCondition,
                                        ListView.separated(
                                          itemCount: ConstVariable().CIAP.length,
                                          separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
                                          itemBuilder: (context,index){
                                            return ListTile(
                                                onTap: ()=>setState(() {
                                                  selectCIAP2 = ConstVariable().CIAP[index];
                                                  Navigator.pop(context);
                                                }),
                                                title: TextDefault(text: ConstVariable().CIAP[index],maxLines: 2,)
                                            );
                                          },
                                        )
                                    ),
                                    child: Container(
                                        padding: EdgeInsets.symmetric(vertical: 10),
                                        width: width*0.7,
                                        child: TextDefault(
                                          text: selectCIAP2!=null?'CIAP2-01 $selectCIAP2':'CIAP2-01',
                                          color: ColorPalette.black54,
                                        )
                                    )
                                ),
                                GestureDetector(
                                    onTap: ()=>AlertDialogDefault().alert_with_search(
                                        context,
                                        controllerSearchCID,
                                        ListView.separated(
                                          itemCount: ConstVariable().CID.length,
                                          separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
                                          itemBuilder: (context,index){
                                            return ListTile(
                                                onTap: ()=>setState(() {
                                                  selectCID = ConstVariable().CIAP[index];
                                                  Navigator.pop(context);
                                                }),
                                                title: TextDefault(text: ConstVariable().CID[index],maxLines: 2,)
                                            );
                                          },
                                        )
                                    ),
                                    child: Container(
                                        padding: EdgeInsets.symmetric(vertical: 10),
                                        width: width*0.7,
                                        child: TextDefault(
                                          text: selectCID!=null?'CID $selectCID':'CID',
                                          color: ColorPalette.black54,
                                        )
                                    )
                                ),
                                GestureDetector(
                                    onTap: ()=>AlertDialogDefault().alert_with_search(
                                        context,
                                        controllerSearchCID,
                                        ListView.separated(
                                          itemCount: ConstVariable().CID.length,
                                          separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
                                          itemBuilder: (context,index){
                                            return ListTile(
                                                onTap: ()=>setState(() {
                                                  selectCID = ConstVariable().CIAP[index];
                                                  Navigator.pop(context);
                                                }),
                                                title: TextDefault(text: ConstVariable().CID[index],maxLines: 2,)
                                            );
                                          },
                                        )
                                    ),
                                    child: Container(
                                        padding: EdgeInsets.symmetric(vertical: 10),
                                        width: width*0.7,
                                        child: TextDefault(
                                          text: selectCID!=null?'CID $selectCID':'CID',
                                          color: ColorPalette.black54,
                                        )
                                    )
                                ),
                                TitleContainers(title: 'Triagem Neonatal',width: width * 0.73,textAling: TextAlign.start),
                                SwitchWithSubtitle(
                                  onChanged: (v)=>setState(()=>switchResquestedTest=v),
                                  value: switchResquestedTest,
                                  width: width*0.7,
                                  title: 'Exames Solicitados'
                                ),
                                SwitchWithSubtitle(
                                  onChanged: (v)=>setState(()=>switchAvalibleTest=v),
                                  value: switchAvalibleTest,
                                  width: width*0.7,
                                  title: 'Exames Avaliados'
                                ),
                                Container(
                                  width: width*0.7,
                                  child: Row(
                                    children: [
                                      TextDefault(text: 'Outros Exames',fontSize: 20,color: ColorPalette.black54,),
                                      Spacer(),
                                      IconButton(
                                        icon: Icon(Icons.add_circle),
                                        onPressed: ()=>AlertDialogDefault().outherExams(
                                            context,
                                            'Outros Exames',
                                            'Adicionar Exames',
                                            selectProfessionals,
                                            selectCBO,
                                            add,
                                            examsList,
                                            selectExamsRequested,
                                            selectExamsAvalible
                                        ),
                                      )
                                    ],
                                  ),
                                ),
                                DropdownWithSubtitle(
                                  list: [
                                    'MEDICINA TRADICIONAL CHINESA',
                                    'ANTROPOSOFIA APLICA À SAÚDE',
                                    'HOMEOPATIA',
                                    'FITOTERATIA',
                                    'AYURVEDA',
                                    'OUTROS',
                                  ],
                                  widthSubtitle: width*0.2,
                                  subtitle: 'Racionalidade em Saúde',
                                  hintDropdown: 'Racionalidade em Saúde',
                                  select: selectRationalityHealth,
                                  widthDropdown:  width*0.65,
                                  widthContainerDropdown:  width*0.6,
                                  onChanged: (value)=>setState(()=>selectRationalityHealth = value!),
                                  colorBorder: ColorPalette.white,
                                ),
                                SwitchWithSubtitle(
                                    onChanged: (v)=>setState(()=>switchUnderObservation=v),
                                    width: width*0.7,
                                    value: switchUnderObservation,
                                    title: 'Ficou em Observação'
                                ),
                                TitleContainers(title: 'NASF/Polo',width: width * 0.73,textAling: TextAlign.start),
                                Container(
                                  width: width*0.7,
                                  height: heigth*0.15,
                                  child: ListView.builder(
                                      physics: const NeverScrollableScrollPhysics(),
                                      itemCount: ConstVariable().nasfPoloModelList.length,
                                      itemBuilder: (context,index){
                                        nasfPoloModelList.add(
                                            CheckModel(
                                                subtitle: ConstVariable().nasfPoloModelList[index],
                                                check: false
                                            )
                                        );
                                        return CheckBoxSubtitle(
                                          subtitle: nasfPoloModelList[index].subtitle,
                                          checkbox:nasfPoloModelList[index].check,
                                          width: width*0.5,
                                          fontSize: 12,
                                          onChanged: (value)=>setState(()=>nasfPoloModelList[index].check=value),
                                        );
                                      }
                                  ),
                                ),
                                TitleContainers(title: 'Conduta',width: width * 0.73,textAling: TextAlign.start),
                                Container(
                                  width: width*0.7,
                                  height: heigth*0.3,
                                  child: ListView.builder(
                                      physics: const NeverScrollableScrollPhysics(),
                                      itemCount: ConstVariable().conductModelList.length,
                                      itemBuilder: (context,index){
                                        conductList.add(
                                            CheckModel(
                                                subtitle: ConstVariable().conductModelList[index],
                                                check: false
                                            )
                                        );
                                        return CheckBoxSubtitle(
                                          subtitle: conductList[index].subtitle,
                                          checkbox:conductList[index].check,
                                          width: width*0.5,
                                          fontSize: 12,
                                          onChanged: (value)=>setState(()=>conductList[index].check=value),
                                        );
                                      }
                                  ),
                                ),
                                TitleContainers(title: 'Encaminhamento',width: width * 0.73,textAling: TextAlign.start),
                                Container(
                                  width: width*0.7,
                                  height: heigth*0.35,
                                  child: ListView.builder(
                                      physics: const NeverScrollableScrollPhysics(),
                                      itemCount: ConstVariable().forwardingModelList.length,
                                      itemBuilder: (context,index){
                                        forwardingList.add(
                                            CheckModel(
                                                subtitle: ConstVariable().forwardingModelList[index],
                                                check: false
                                            )
                                        );
                                        return CheckBoxSubtitle(
                                          subtitle: forwardingList[index].subtitle,
                                          checkbox:forwardingList[index].check,
                                          width: width*0.5,
                                          fontSize: 12,
                                          onChanged: (value)=>setState(()=>forwardingList[index].check=value),
                                        );
                                      }
                                  ),
                                ),
                              ],
                            ),
                          ),
                        ]
                    ),
                  ],
                ),
              ),
              Card(
                margin: EdgeInsets.all(10),
                child: Column(
                  children: [
                    TitleContainers(title: 'Procedimentos'),
                    Row(
                      children: [
                        Container(
                          height: heigth*0.15,
                          width: width*0.2,
                          child: Icon(LineIcons.infoCircle,size: 80,),
                        ),
                        Padding(
                          padding: const EdgeInsets.symmetric(horizontal: 10.0),
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.start,
                            mainAxisSize: MainAxisSize.min,
                            children: [
                              SwitchWithSubtitle(
                                  onChanged: (v)=>setState(()=>switchListenStart=v),
                                  value: switchListenStart,
                                  width: width*0.7,
                                  title: 'Escuta Inicial/Orientação'
                              ),
                              Container(
                                width: width*0.7,
                                child: Row(
                                  children: [
                                    TextDefault(text: 'Procedimentos',fontSize: 20,color: ColorPalette.black54,),
                                    Spacer(),
                                    IconButton(
                                      icon: Icon(Icons.add_circle),
                                      onPressed: (){}
                                    )
                                  ],
                                ),
                              ),
                            ],
                          ),
                        )
                      ],
                    ),
                  ],
                ),
              ),
              Card(
                margin: EdgeInsets.all(10),
                child: Column(
                  children: [
                    TitleContainers(title: 'Complemento'),
                    Row(
                      children: [
                        Container(
                          height: heigth*0.15,
                          width: width*0.2,
                          child: Icon(Icons.attach_file,size: 80,),
                        ),
                        Padding(
                          padding: const EdgeInsets.symmetric(horizontal: 10.0),
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.start,
                            mainAxisSize: MainAxisSize.min,
                            children: [
                              InputText(
                                controller: controllerComplement,
                                width: width*0.7,
                                maxLines: 4,
                                colorBorder: ColorPalette.white,
                                textInputType: TextInputType.multiline,
                              )
                            ],
                          ),
                        )
                      ],
                    ),
                  ],
                ),
              ),
              Card(
                margin: EdgeInsets.all(10),
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Column(
                    children: [
                      ButtonDefault(
                        onPressed: (){},
                        title: 'Salvar',
                        borderColor: ColorPalette.appBar,
                        background: ColorPalette.appBar,
                        textColor: ColorPalette.white,
                        width: double.infinity,
                      ),
                      ButtonDefault(
                        onPressed: ()=>Navigator.pop(context),
                        title: 'Cancelar',
                        borderColor: ColorPalette.blackButton,
                        background: ColorPalette.blackButton,
                        textColor: ColorPalette.white,
                        width: double.infinity,
                      )
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
